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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to configure GridTreeStyleManager.RowAppearance from code behind

Thread ID:

Created:

Updated:

Platform:

Replies:

103631 May 18,2012 08:08 PM UTC May 25,2012 10:23 AM UTC WPF 1
loading
Tags: GridControl
Albert Gao
Asked On May 18, 2012 08:08 PM UTC

Is it possible to change the GridTreeControl row appearance during runtime?

Thanks
Ariel

Sivakumar R [Syncfusion]
Replied On May 25, 2012 10:23 AM UTC

Hi Ariel,

You can make use of QueryCellInfo event if you want to style the rows based on some conditions. Please find the code snippet and sample from the below location,

this.AssociatedObject.InternalGrid.QueryCellInfo += InternalGrid_QueryCellInfo;

void InternalGrid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)

{

GridTreeNode node = this.AssociatedObject.InternalGrid.GetNodeAtRowIndex(e.Style.RowIndex);

if (node != null)

{

PersonInfo person = node.Item as PersonInfo;

if (person.MyEyeColor.Equals("Red"))

{

e.Style.Foreground = Brushes.White;

e.Style.Background = Brushes.Red;

e.Style.Font.FontWeight = FontWeights.Bold;

}

else if (person.MyEyeColor.Equals("Blue"))

{

e.Style.Foreground = Brushes.White;

e.Style.Background = Brushes.Blue;

e.Style.Font.FontWeight = FontWeights.Bold;

}

else if (person.MyEyeColor.Equals("Brown"))

{

e.Style.Foreground = Brushes.White;

e.Style.Background = Brushes.Brown;

e.Style.Font.FontWeight = FontWeights.Bold;

}

}

}

Screen shot:

Sample:

You can style the Row using GridTreeStyleManager. Please find the same to change the RowStyle using GridTreeStyleManager.

Sample:

Please let me know if you need more details.

Thanks,

Sivakumar

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

;