How can I bind my object collection to CheckedListBox items with IsChecked property?
Here is my objects:
public class Person
{
public int Id {get;set;}
public string Name {get;set;}
public bool IsChecked {get;set;}
}
public class EditorModel
{
public BindingList<Person> People {get;set;}
}
These objects both implement INotifyPropertyChanged also.
I can do binding like this:
checkedListBox.DataSource = editorViewModel.People;
checkedListBox.ValueMember = "Id";
checkedListBox.DisplayMember = "Name";
How can I bind the third property IsChecked? I tried to google it, but I haven't found any solution.
Problem
All the solutions in binding a datasource to a CheckedListBox aren't very elegant.
Solution
Use a DataGridView with a Checkbox column instead.