We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Parent Row highlight on GridTreeControl

I have been playing with the level styles of the Grid tree control and have a question on applying the styles.  I did figure out that if I create a empty style for the first one I add that the grid retains it's primary root style.  However what I would like to do is setup the control so that if the node is a parent it is shown in a different background color.  The children work from setting the simple style as the second style.  Is there a way to make a style dependant on the haschildnodes property?

This is what I have defined in codebehind right now for a standard tree grid

 GridStyleInfo levelInfo = new GridStyleInfo();
                    GridStyleInfo level1Info = new GridStyleInfo();
                    levelInfo.Background = new SolidColorBrush(Color.FromRgb(0xB2, 0xCC, 0xFF));


1 Reply

SH Shakul Hameed M Syncfusion Team December 18, 2013 10:14 AM UTC

Hi Joshua 


Thanks for contacting Syncfusion.


We have analyzed your query and we can achieve your requirement by listening the QueryCellInfo event.

Please refer the following code snippet.


Code Snippet: [C#]

void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)


            int rowindex = e.Cell.RowIndex;


            GridTreeNode node = this.grid.InternalGrid.GetNodeAtRowIndex(rowindex);


            if (node != null)


                if (node.HasChildNodes)


                        this.grid.InternalGrid.Model.RowStyles[rowindex].Background = new SolidColorBrush(Color.FromArgb(255, 239, 200, 230));                       





We have prepared the sample based on your requirement and please find the attached sample.


Please let us know, if you have any concerns.



Shakul Hameed


Live Chat Icon For mobile
Up arrow icon