wpfcomboboxcheckedlistbox

Looking for a WPF ComboBox with checkboxes


My google skills fail me. Anyone heard of a control like that for WPF. I am trying to make it look like this (winforms screenshot).


Solution

  • You can do this yourself by setting the DataTemplate of the combo box. This article shows you how - for a listbox, but the principle is the same.


    Another article here is perhaps a better fit for what you are trying to do, simple set the first column of the item template to be a checkbox and bind it to a bool on your business object.

    <ComboBox.ItemTemplate>
        <DataTemplate>
            <StackPanel Orientation="Horizontal">
                <CheckBox IsChecked="{Binding IsSelected}"
                           Width="20" />
                <TextBlock Text="{Binding DayOfWeek}"
                           Width="100" />
            </StackPanel>
        </DataTemplate>
    </ComboBox.ItemTemplate>