CheckComboBox

CheckComboBox is a combo box in which the items in the dropdown are preceded by a checkbox. As items are checked or unchecked, the Text property displayed above the dropdown is updated using the concatenated string representations of the checked items. The text displayed is formated using the value of the Delimiter property to separate the individual strings.

checkcombobox.jpg

         <xctk:CheckComboBox x:Name="_combo" 
                             HorizontalAlignment="Center" 
                             VerticalAlignment="Center" 
                             DisplayMemberPath="Color"
                             ValueMemberPath="Level"
                             SelectedValue="{Binding SelectedValue}"
                             SelectedItems="{Binding SelectedItems}" />


Properties / Events

Property Description
Command Gets/Sets the command to execute when an item is checked/unchecked. (Inherited from Selector.)
Delimiter Gets/Sets the string used to separate the concatenated string representations of the checked items. (Inherited from Selector.)
IsDropDownOpen Gets/Sets a value indicating whether the combo box drop-down is currently open.
SelectedItem Gets/Sets the last checked or unchecked item. (Inherited from Selector.)
SelectedItems Gets the collection of checked items. (Inherited from Selector.)
SelectedMemberPath Gets/Sets a path to a value on the source object used to determine whether an item is selected. (Inherited from Selector.)
SelectedValue Gets or sets a string containing the selected items separated by the value of Delimiter (ex., "Item1, Item2, Item3"). (Inherited from Selector.)
Text Gets/Sets the formated text of the currently checked items.
ValueMemberPath Gets/Sets a path to a value on the source object representing the value to use. (Inherited from Selector.)



Event Description
SelectedItemChanged Invoked when a check or uncheck operation occurs. (Inherited from Selector.)


Support this project, check out the Plus Edition.
---

Last edited May 9, 2013 at 8:44 PM by Kosmatos, version 7

Comments

BoucherS Mar 27 at 1:52 PM 
Hi,
Yes, the documention will need to be updated. If you want examples on how to use the Toolkit, please download the LiveExplorer App available on this page : https://wpftoolkit.codeplex.com/.
It contains many examples and you have access to the XAML and code-behind through the LiveExplorer. Unfortunately, it doesn't contains examples with the property "SelectedItemsOverride".
The Property "SelectedItems" is Get only, not Get/Set.
The Property "SelectedItemsOverride" is used to set a list of SelectedItems to the CheckComboBox.
Here's how to use it :
<xctk:CheckComboBox x:Name="_checkComboBox"
Width="125"
Height="22"
ItemsSource="{Binding MyCollection}"
SelectedItemsOverride="{Binding MySelectedObjects}">
</xctk:CheckComboBox>

public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
_checkComboBox.DataContext = this;
this.MyCollection = new ObservableCollection<int>() { 1, 2, 3, 4, 5 };
this.MySelectedObjects = new ObservableCollection<int>() { this.MyCollection[ 0 ], this.MyCollection[ 2 ] };
}
public ObservableCollection<int> MyCollection
{ get; set; }

public ObservableCollection<int> MySelectedObjects
{ get; set; }
}

thelehehmanlip Mar 27 at 1:14 PM 
This "documentation" page is totally useless. It does not give a valid example of how to use this product, and even references properties that aren't even accessible. I get a build error trying to use SelectedItems. SelectedItemsOverride exists, but there's no mention of how it works on this page. Trying to bind to it, I don't have any two way access.

BoucherS Feb 6 at 12:32 PM 
Set the ItemsSource and SelectedItemsOverride to the same List of items :
_checkComboBox.ItemsSource = myList;
_checkComboBox.SelectedItemsOverride = myList;

prasant38 Feb 6 at 8:06 AM 
Please suggest me how to check all checkboxes in CheckComboBox by default

BoucherS Jan 21 at 6:19 PM 
Discussion https://wpftoolkit.codeplex.com/discussions/517953 has been created.

sriharshakolluru Jan 21 at 4:53 AM 
Please post a code snippet on how to bind data to this checkedcomb box. I find it difficult to understand how to pass two data valus, one containing the total Items and the other containing selected items of these.

I tried the following and it worked but I just want to bind a single data source.
1. I set
cmbBox.Itemsource=listOfItems;

2. I added the items to be selected to the SelectedItems property using a foreach loop. And these items are also added in the
foreach(string str in LstSelectedItems)
cmbBox.SelectedItems.Add(str);

But there should be a better option right??

BoucherS Dec 17, 2013 at 7:22 PM 
Hi, can you please create a discussion tab and submit a code snippet of problem ?
Thanks

AXG1010 Dec 11, 2013 at 3:36 PM 
I get strange non-working behavior with this control. The last checked item does not show the check box as marked (even though it is listed in the concatenated value). The binding to SelectedValue also does not work. I found an older version of the source (at the time I didn't realize it was an older release, was going to use it to step through the code and see what I was doing wrong) on GitHub, but that version seemed to work just fine (at least for this control, I didn't test the others). I guess I'm probably just going to make my own version of this control since I don't have to to wait for an update...too bad, it was exactly what I needed.

wbradney Aug 15, 2013 at 5:28 PM 
This doesn't bind when it placed inside a DataTemplate. What am I missing?

fun_vikas Apr 28, 2013 at 6:19 AM 
When I select an item in combobox... its text changes to checkedCombobox.selecteditem.value:ITEM1
Ho can that be fixed?

rahulpatil2009 Oct 29, 2012 at 9:34 AM 
the binding does not work correctly when the combo box is bound to a source which is changed at runtime. e.g. ItemSource=>Country.AvailableStates and SelectedItems=>Country.SelectedStates, in this case when 'Country' object is changed, selected values for first country are still there in 'SelectedValues' as well as 'Text' properties

to fix this issue, we need to modify source code to make 'Selector.UpdateSelectedValue' method 'Public' (Selector is base class for this combo box) and call this method on combo boxes whenever a source object changes (Country in above example)

timmyboyyy Mar 16, 2012 at 11:14 AM 
When will it be available?

momarf Feb 22, 2012 at 9:57 PM 
It will be very useful if SelectedItems is TwoWay property. Currently it is oneway which means we can only set SelectedValue property and pass delimeter separated Value Property values.