This control provides all of the functionality expected from a ListBox with the addition of checkboxes as a visual cue to indicate the selection state of each item.
Using the control is quite simple. Here's an example of the XAML required to display a CheckedListBox on a WPF window. It is binding to the same collection of Sentence objects used in Tip #17.
<tk:CheckListBox ItemsSource="{Binding Sentences, IsAsync=True}" SelectedItem="{Binding SelectedSentence}" Command="{Binding ItemSelectedCommand}"/>
ItemsSource binding to a collection to populate the list items. SelectedItem provides a way to find out the currently 'selected' item, the last item checked/unchecked. The Command will fire each time an item in the list is checked or unchecked, allowing ViewModel logic to act on this change.
Go give it a try in your WPF project. Happy coding!
del.icio.us Tags: extended wpf toolkit,mvvm
This comment has been removed by the author.
ReplyDelete