Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1070
How to bind IsSelected property to the IsSelected of the item in the XamDataGrid
posted

When I use the standard WPF DataGrid I can bind to the IsSelected property of the DataGridRow by doing the following.

<DataGrid ItemsSource=”{Binding FindResults}” ...>
    <DataGrid.RowStyle>
        <Style TargetType=”{x:Type DataGridRow}”>
            <Setter Property”IsSelected” Value=”{Binding Selected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}” />
        </Style>
    </DataGrid.RowStyle>
</DataGrid>

The ItemSource of my DataGrid is FindResults which is a List<FindResult> and the FindResult has a bool Selected property. I would like to do something similar with the XamDataGrid. I have the following XAML so far.

<igDP:XamDataGrid DataSource=”{WorkbenchRecords}” .....>
  <igDP:XamDataGrid.FieldLayoutSettings>
    <igDP:FieldLayoutSettings.DataRecordPresenterStyle>
      <Style TargetType=”{x:Type igDP:DataRecordPresenter}” BasedOn=”{StaticResource {x:Type igDP:DataRecordPresenter}}”>
        <Setter Property=”IsSelected” Value=”{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}” />
      </Style>
    </igDP:FieldLayoutSettings.DataRecordPresenterStyle>
  </igDP:XamDataGrid.FieldLayoutSettings>
</igDP:XamDataGrid>

The DataSource of the XamDataGrid is WorkbenchRecords which is a List<WorkbenchRecord> and the WorkbenchRecord has a bool IsSelected property. I am not getting any binding errors but selecting rows the XamDataGrid is not setting the IsSelected property of my WorkbenchRecord to true.

What is the best way to create a XAML binding the IsSelected property of my Workbench object?