Although somewhat experienced with writing Winforms applications, the... \"vagueness\" of WPF still eludes me in terms of best practices and design patterns.
Despite pop
Use ObservableCollection
instead of List
Edit
it implements INotifyCollectionChanged interface to let WPF know when you add/remove/modify items
Edit 2
Since you set TopicList
in code, it should be a Dependency Property, not a common field
public ObservableCollection TopicList {
get { return (ObservableCollection)GetValue(TopicListProperty); }
set { SetValue(TopicListProperty, value); }
}
public static readonly DependencyProperty TopicListProperty =
DependencyProperty.Register("TopicList", typeof(ObservableCollection), typeof(MainWindow), new UIPropertyMetadata(null));
Edit 3
To see changes in items
INotifyPropertyChanged
interface in CheckedListItem
(each setter should call PropertyChanged(this, new PropertyChangedEventArgs())
event)CheckedListItem
from DependencyObject
, and convert Name
, ID
, IsChecked
to dependency propertiestopicList[0] = new CheckedListItem() { Name = ..., ID = ... }
)