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

alternative alternative colours for sfTreefgrid rows

Thread ID:





131198 Jun 27,2017 06:45 PM UTC Jun 28,2017 04:52 AM UTC UWP 1
Tags: SfTreeGrid
Asked On June 27, 2017 06:45 PM UTC


  How can I create alternative colours for sfTreefgrid rows and child collections


Muthukumar Kalyanasundaram [Syncfusion]
Replied On June 28, 2017 04:52 AM UTC

Hi Siju, 

Thank you for contacting Syncfusion support. 

We have checked your query. You can achieve your requirement by customizing the style of  “TreeGridRowControl” as shown like below code, 
Code Snippet: Xaml 
<local:StyleConverter x:Key="styleConverter" /> 
<Style TargetType="syncfusion:TreeGridRowControl"> 
    <Setter Property="utils:SetterValueBindingHelper.PropertyBinding"> 
            <utils:SetterValueBindingHelper Binding="{Binding Converter={StaticResource styleConverter}, RelativeSource={RelativeSource Self}}" Property="Background" />                   
Code Snippet: C# 
// based on Nodelevel and RowIndex, you can apply the background color 
internal class StyleConverter : IValueConverter 
    public object Convert(object value, Type targetType, object parameter, string language) 
        if((value as TreeGridRowControl).DataRow.Level == 0) 
            return new SolidColorBrush(Colors.SkyBlue); 
        if (((value as TreeGridRowControl).DataRow.RowIndex %2 ==0) && ((value as TreeGridRowControl).DataRow.Level !=0)) 
            return new SolidColorBrush(Color.FromArgb(255, 255, 211, 86)); 
        else if (((value as TreeGridRowControl).DataRow.RowIndex % 2 != 0) && ((value as TreeGridRowControl).DataRow.Level !=0)) 
            return new SolidColorBrush(Colors.Bisque); 
            return new SolidColorBrush(Color.FromArgb(255, 112, 252, 160));            
    public object ConvertBack(object value, Type targetType, object parameter, string language) 
        throw new NotImplementedException(); 

Please let us know if you have any query. 

Muthukumar K 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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