I have the following code:
public class ViewModel
{
private IServiceAccess _svcAccess;
public ViewModel(IServiceAccess svcAccess)
{
_svcAccess = svcAccess;
}
public ObservableCollection<Item> ExistingItems
{
get
{
return new ObservableCollection<Item>(_svcAccess.GetExistingItems());
}
}
}
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding Path=Ignore, UpdateSourceTrigger=PropertyChanged}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
I want to be able to instantly responsd when the User checks the box - Everywhere I've read this says it "updates the source", but how do I actually respond to that? The only other examples I've found have been the other way around, i.e. a change in the ViewModel raises the event to notify the View.
At the moment I've got an ObservableCollection in my ViewModel that is bound to the datagrid. Ignore is a field on my Item object, stored in the DB as a bool.
What I'd like to happen is checking the box triggers an event I can respond to in the ViewModel.
Note - I was going to map my EF entities into separate VM entities for the WPF layer, but was advised it was unecessary and overkill.