I have bounded a ObservableCollection to a ItemSource to a DataGrid, however, I want to retrieve (via a setter) individual properties via the ViewModel.
Ok sounds confusing so will explain.
in my ObservableCollection, I have a property called "Active" so I want this element to be set when a user clicks on or off on a the checkbox in the DataGrid.
so the XAML
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding Active, Mode=TwoWay}" HorizontalAlignment="Center"></CheckBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
And I want this to trigger this code in the ViewModel when the box is unchecked or checked
private bool m_Active = false;
public bool Active
{
get { return m_Active; }
set
{
m_Active = value;
OnPropertyChanged("Active");
}
}
but even with two way mode on, it doesn't. Any reasons why?
Note: On the SelectedItem property of the DataGrid I can get the SelectedRow , so basically I want the selected Individual property!
Thanks