Help needed. Why the below binding is not working. I want to have checkbox on each row of data. When the checkbox is checked/unchecked, it should invoke some event.
<Grid.Resources>
<Style x:Key="CheckboxStyle" TargetType="{x:Type igDP:CellValuePresenter}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">
<CheckBox Command="{Binding DataContext.IsCheckedBoolean, RelativeSource={RelativeSource AncestorType={x:Type igDP:XamDataGrid}}}" CommandParameter="{Binding}" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Grid.Resources>
<igDP:UnboundField Label="Action" Width="auto">
<igDP:UnboundField.Settings>
<igDP:FieldSettings CellValuePresenterStyle="{StaticResource CheckboxStyle}" />
</igDP:UnboundField.Settings>
</igDP:UnboundField>
In order to test the binding, I use the below property returned in my viewmodel. The default value is false.
public Boolean IsCheckedBoolean
{
get { return _isChecked; }
set
{
_isChecked = value;
RaisePropertyChanged("IsCheckedBoolean");
}
}
I'm referring to this WPF Binding : Add Button to Unbound Field in grid