Hi,
From what I can see, the Collections are set to a value, but the get returns a new collection. I would suggest to initialize the collection when defining the variable, or in the get, if the variable is null, initialize it (for the 2 collections):
From what I can see, the Collections are set to a value, but the get returns a new collection. I would suggest to initialize the collection when defining the variable, or in the get, if the variable is null, initialize it (for the 2 collections):
private ObservableCollection<String> selectedTaskStatuses = new ObservableCollection<string>();
public ObservableCollection<String> SelectedTaskStatuses
{
get
{
return selectedTaskStatuses;
}
set
{
selectedTaskStatuses = value;
}
}
Also, the setter will be called only if the entire collection is changed. If you want to be notified when items are selected/unselected (added/removed) from the collection, listen to the collectionChanged event :this.SelectedTaskStatuses.CollectionChanged += SelectedTaskStatuses_CollectionChanged;
private void SelectedTaskStatuses_CollectionChanged( object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e )
{
}