I am using a treegrid that has hierarchy. I want to hide some rows based on the value in the dataItem of the record.
My idea is to iterate through every record, look at the value in the dataitem of the record and set the record.Visibility = Collapsed.
But my grid.Records attribute only gives me the top level records. How can I access the child records of the given record in the grid.
Hello Viswanath Chennuru,
XamTreeGrid has GetRecordFromDataItem method that gets the DataRecord associated with a specific item in the DataSource.
I have created a sample with a XamTreeGrid and two buttons for hiding and displaying the second child record of the second parent record.
That's a snippet code for hiding the record
(this.treeGrid.GetRecordFromDataItem(this.fileNodes[this.parentRecordIndex] .SubNodes[this.childRecordIndex], true) as DataRecord) .Visibility = System.Windows.Visibility.Collapsed;
Please take a look at the sample and let me know if that works for you or if you have any other questions on this matter.
I am wondering how this will impact my grids performance. I have thousands of records in my grid and if I call the GetRecordFromDataItem for each dataItem, will it go through all the records in the grid each time I make the call or does it has some kind of lookup using which it will return the records for the dataItem?