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
335
How to hide rows programatically.
posted

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.

Parents
  • 1935
    posted

    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.

    XamTreeGrid_GetRecordFromDataItem.zip
Reply Children