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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Parent Row highlight on GridTreeControl

Thread ID:

Created:

Updated:

Platform:

Replies:

114892 Dec 12,2013 07:58 PM UTC Dec 18,2013 10:14 AM UTC WPF 1
loading
Tags: GridControl
Joshua Cauble
Asked On December 12, 2013 07:58 PM UTC

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));
                    
                    this.myGrid.LevelStyles.Add(level1Info);
                    this.myGrid.LevelStyles.Add(levelInfo);

Thanks.

Shakul Hameed M [Syncfusion]
Replied On 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.

 

Thanks,

Shakul Hameed



Highlighting_Row_280a8b9c.zip

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;