0
votes

Is anyone aware of a way to manually enable (turning on the tick) on the Check Boxes within the CheckComboBox for WPFToolkit?

Unfortunately, the Items in the Combo-box are all strings.

I'm trying to enable all flags when "Select All" checkbox is ticked.

3
Have you tried using SelectedItems="{Binding SelectedItems}"James Sampica
It's SelectedItem="{Binding SelectedItems}" - but yes I have :)Dane Balia
According to the documentation there's both "SelectedItem" and "SelectedItems"James Sampica
Thanks yes - it gets you the Item selected, but with Extended WPF Toolkit, their not the actual checkboxes, only their values, so you cannot manipulate the Checkbox state.Dane Balia

3 Answers

2
votes

This is a rather late response but I thought it best to post this in case it helps someone out. I have used the following approach for the WPFToolkit version:

public class Descriptor : INotifyPropertyChanged
{
    private bool isSelected;

    public bool IsSelected
    {
        get
        {
            return this.isSelected;
        }
        set
        {
            if (this.isSelected != value)
            {
                this.isSelected = value;
                // Raise INotifyPropertyChanged
            }
        }
    }

    public string Name { get; set; }
}

Create a collection of these and then assign them to the ItemsSource of the CheckComboBox.

To handle select all we have an option labelled: "" as the first item in the collection, then if this item is ticked all the items are de-selected and the all case is handle under the hood. To handle the selection Changed it does involve adding an event to the Descriptor class and firing it each time the IsSelected property is changed.

0
votes

I eventually tossed out Extended WPFToolkit due to it's inability to access the checkboxes directly.

Instead I created a ComboBox and manually defined Checkboxes within it, which I access directly by name, and there able to implement a "Select All" by using it's [Checked/Unchecked[ event, and use the ComboBox SelectionChanged to show a default value that expresses what has been selected in a CSV format.

Maybe be clunky, but it gets the job done.

PS. I did not need to even bother with a DataTemplate for the ComboBox

0
votes

One way in the code Behind is

var ComboSelector = MyCheckComboBox as  Xceed.Wpf.Toolkit.Primitives.Selector;
foreach(var item in MyCheckComboBox.Items)
ComboSelector.SelectedItems.Add(item);