I have a Hierarchical data structure that is a simple parent/child relationship. I need to be able to access the selected child record.
How do I access the selected child record of the xamDataGrid.
Seems like it should be a snap to do, but for the life of me I can't seem see how that would be done.
Just in case you need to obtain the record when selected, you can use the RecordActivated or the SelectedItemChanged events of the grid and check the record. There are couple of helpfull properties that can be used e.g.HasChildren, NestingDepth, ParentDataRecord etc. If you need to obtain all of the selected child records e.g. on a button click or any other action than you may consider using the SelectedItems.Records collection of the grid. It is possible to iterate through the records and check the same properties.
Let me know if you have any questions with this matter.
Thank you for your reply. I'm sorry but I am still not able to obtain the child record. The selectedItems.Records only gives me the parent record. HasChildren only gives a boolean value. NestingDepth is also not what I am after. I added a handler for SelectedItemsChanged and I am not getting any better information. All I seem to be getting is the parent record of the selected child.
I must be able to access the actual values of the selected child record.
Can you please supply a snippet of code that shows me how to access the actual values of a selected child record?
I have found the problem.
I am using a control that derives from xamDataGrid. It seems that there is some processing going on in a SelectedItemsChanged handler that is causing me to only see the parent.
Thank you for your help.
As I said in my previous comment, I was able to get this hierarchical data to display correctly but I'm having a problem selecting rows within my XamDataGrid when there is a hierarchy of records displayed. I set the 'SelectionTypeRecord' property in my FieldLayoutSettings to "Extended" and I'm able to multi-select child records in any of my top-level records. But once I select multiple records under one parent node, I can’t select any other child records in the other nodes. What am I missing here? Anyone have any ideas?
I have also tried to set the SelectionTypeRecord property of the child Layout in the FieldLayoutInitialized method of XamDataGrid like below but of no use.XamDataGrid1.FieldLayouts.Settings.SelectionTypeRecord = Infragistics.Windows.Controls.SelectionType.Extended;XamDataGrid1.FieldLayouts.Settings.SelectionTypeField = Infragistics.Windows.Controls.SelectionType.Extended;XamDataGrid1.Records.FieldLayout.Settings.SelectionTypeRecord = Infragistics.Windows.Controls.SelectionType.Extended;
I was wondering if you had ever figured this out.
We have a requirement where we need to be able to select multiple items as well as items at different 'levels'.
For instance, my hierarchy is three levels deep. I might need to select a level 1 item and multiple level 2 items not necessarily under the same level 1 item.