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
Inquiry how to use ActiveDataItem and SelectedDataItem


In the DataGrid, when an item is selected, the SelectedItem property changes, and the selected row changes its background color, so I can see that it is selected. Then, use that property by binding it to the ViewModel. To cancel the selected item in the DataGrid, set the property bound to the ViewModel to null to cancel the selected row.

In xamDataGrid, there are two properties, SelectedDataItem and ActiveDataItem. When the user selects a row, SelectedDataItem and ActiveDataItem designate the same row.
To cancel the selected row, it is possible to use it as follows.

<igDP:XamDataGrid DataSource="{Binding CodeHelpers}"
  Style='{StaticResource NoDataStyle}'
  SelectedDataItem="{Binding SelectedItem, Mode=TwoWay}"
  ActiveDataItem="{Binding SelectedItem, Mode=TwoWay}"> ...</igDP>

What I am curious about is whether it is the correct usage to bind to two properties like this.

If I do not bind to these two properties, the selected background color will remain visible.

  • 530
    Offline posted

    Hello Connor,

    Yes, you can use these properties the way how you describe. As a side note, when you set ActiveDataItem property, you can navigate active row by using keyboard arrows. Also, once you set ActiveDataItem, you notice that a triangle icon appears on the corresponding row header.

    If you have any question with this, please let me know.