I have a check list box from the wpf toolkit 2. I cannot get all of the selected items. I read that I am supposed to use SelectedItemsOverride to get all of my selected items but it does not seem to work. I put a break point in the setter for TestClassSelected but it is never fired. Any Ideas?
<xctk:CheckListBox Name="MyCheckList"
ItemsSource="{Binding TestClassCollection}"
DisplayMemberPath="DisplayName"
SelectedItemsOverride="{Binding TestClassSelected}" />
.
public IEnumerable<TestClass> TestClassCollection
{
get { return _testClassCollection; }
set
{
_testClassCollection = value;
OnPropertyChanged("TestClassCollection");
}
}
public List<TestClass> TestClassSelected
{
get { return _testClassSelected; }
set
{
_testClassSelected = value;
OnPropertyChanged("TestClassSelected");
}
}
.
public class TestClass
{
public String FirstName { get; set; }
public String LastName { get; set; }
public String DisplayName {
get { return string.Format("{0} {1}", FirstName, LastName); }
}
}
This is my test data I have been using.
TestClassCollection = new List<TestClass>
{
new TestClass {FirstName = "FIrstName", LastName = "LastName"},
new TestClass {FirstName = "Brad", LastName = "Holder"},
new TestClass {FirstName = "Sam", LastName = "Ryans"},
new TestClass {FirstName = "Ryan", LastName = "Thomas"},
new TestClass {FirstName = "Lee", LastName = "Rod"},
new TestClass {FirstName = "Amanda", LastName = "Gustaf"},
new TestClass {FirstName = "Chris", LastName = "Holems"},
new TestClass {FirstName = "Doug", LastName = "Schnitzel"},
new TestClass {FirstName = "Lisa", LastName = "Bull"},
new TestClass {FirstName = "Fred", LastName = "Simpson"},
new TestClass {FirstName = "Scott", LastName = "Rogers"}
};
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…