This project has moved. For the latest updates, please go here.

CheckComboBox Not Displaying Checks

Jul 24, 2014 at 4:12 PM
While the delimited string of selected items displays correctly, their associated checkboxes remain unchecked. Surely, I'm doing something wrong. I threw together the simplest demo I could to demonstrate the behavior. Any help would be appreciated.

Code Behind:
using System.Collections.ObjectModel;
using System.Windows;

namespace TestProject
{
    public partial class Test : Window
    {
        public Test()
        {
            InitializeComponent();
            
            var selectedOptions = new ObservableCollection<string>() { "One", "Two", "Three" };
            var selectableOptions = new ObservableCollection<SelectableOption>()
            {
                new SelectableOption {Display = "One", Value = "1"},
                new SelectableOption {Display = "Two", Value = "2"},
                new SelectableOption {Display = "Three", Value = "3"},
                new SelectableOption {Display = "Four", Value = "4"},
                new SelectableOption {Display = "Five", Value = "5"}
            };

            ComboBox.ItemsSource = selectableOptions;
            ComboBox.DisplayMemberPath = "Display";
            ComboBox.SelectedMemberPath = "Value";
            ComboBox.SelectedItemsOverride = selectedOptions;
        }

        public class SelectableOption
        {
            public string Display { get; set; }
            public string Value { get; set; }
        }
    }
}
and the XAML:
<Window x:Class="TestProject.Test"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
        Title="Test" Height="178" Width="300">
    <Grid>
        <xctk:CheckComboBox  x:Name="ComboBox" 
                             Margin="10,33,10,0" 
                             VerticalAlignment="Top" 
                             TabIndex="3" 
                             Height="22"
                             RenderTransformOrigin="0.743,-1.136"
                             />
    </Grid>
</Window>
Jul 24, 2014 at 6:30 PM
Nevermind...

I needed to define an IsSelected property like:
public class SelectableOption
        {
            public string Display { get; set; }
            public string Value { get; set; }
            public bool IsSelected {get;set}
        }
...and instead of using the SelectedItemsOverride use the SelectedMemberPath="IsSelected"
Marked as answer by manicsquirrel on 7/24/2014 at 11:30 AM