Hi
I use the grid to display a hierarchical multi-level data. I bind the selected datarecord to another control. So that control 'displays' DataRow currently selected in xamDataGrid.
Is there a possibility to select a DataRecord in xamDataGrid having a DataRow only? Can SelectedRow be two-way bound to anything?
This is pretty critical for us right now
Thank you
Just for some background, there are 2 concepts regarding records in the xamDataGrid, active and selected. There can be any # of selected records so they are exposed via the grid's SelectedItems.Records collection. There can never be more than 1 active record so the grid exposes an ActiveRecord property.
Both of these return the Records. Record is the base class for DataRecord, GroupByRecord and ExpandableFieldRecord. In order to get to the underlying data item, in this case the DataRow or DataRowView, you need to cast the Record to a DataRecord which exposes a DataItem property, e.g.
DataRecord dr = grid.ActiveRecord as DataRecord;
if (dr != null )
{
DataRowView drv = dr.DataItem as DataRowView;
...
}
If you are setting up a binding in xaml it might look something like this:
I hope this helps.
Thanks for the answer, now it's more clear.
But I'm more interested in making xamDataGrid's ActiveRecord the target of a binding. So that changing some property (of DataRow type) would force the xamDataGrid to change its ActiveRecord. Is it possible to achive this through data-binding, without having to loop through all records?