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

Is it possible to change RowHeader Style ?


I would like to better show to the user when a record in a datagrid has been changed.
It should be nice for me, for example, to draw a red background color all the row Headers of all the records that have been changed.
I already have in the model record a bool property that identifies if the relative record has been changed.
So I ask you if it's possible to change the row Header style of each row according to the change status of the related binded record.
Thank you,


5 Replies

JG Jai Ganesh S Syncfusion Team March 21, 2017 11:36 AM UTC

Hi Silvio, 
You can change the background color of RowHeader when the record property changed by write the style for GridRowHeaderCell,  
<Style  TargetType= "syncfusion:GridRowHeaderCell"> 
   <Setter Property="Background" Value="{Binding Status,Converter={StaticResource converter }}"/> 
public class CustomConverter:IValueConverter 
    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 
        bool statusvalue = (bool)value; 
        if (statusvalue == true) 
            return Brushes.Red; 
            return Brushes.Green; 
        return value; 
    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 
        throw new NotImplementedException(); 
In the above sample, we have changed the RowHeader background based on the Status column value. 
Jai Ganesh S 

SI Silvio March 21, 2017 12:02 PM UTC

Thank you Ganesh for your answer.

This is good if you don't use SfSkinManager for grid styles.
If instead you use it, your sugestion seems not to work.
Please find here attached the same your example that I have changed applying a Blend Style to the whole window.
I'd like the red background appears only when the record is changed, otherwise I'd like the standard Blend background is applied.
But, as you can see, in this example Blend background is always applied.
What changes have I to make in order to let it work as I'd like ?
Thank you.


Attachment: BackgroundColorForRowHeader_f44158a5.zip

JG Jai Ganesh S Syncfusion Team March 22, 2017 06:00 PM UTC

Hi Silvo, 
The already applied styles (setting in App.Xaml) are disabled while applying the theme through SfSkiManager in code behind. You can overcome this by setting a theme in xaml instead of code behind like below, 
                <ResourceDictionary Source="/Syncfusion.Themes.Blend.WPF;Component/SfDataGrid/SfDataGrid.xaml"/> 
            <local:CustomConverter x:Key="converter"/> 
            <Style TargetType= "syncfusion:GridRowHeaderCell"> 
                <!--By using converter the Background color is changed based on the business logic--> 
                <Setter Property="Background" Value="{Binding Status,Converter={StaticResource converter }}"/> 
Jai Ganesh S 

SI Silvio March 23, 2017 08:34 AM UTC

Thank you very much for your help, Ganesh!

JG Jai Ganesh S Syncfusion Team March 24, 2017 03:59 AM UTC

Hi Silvo,  
Thank you for the update. 
Please let us know if you need further assistance on this. 
Jai Ganesh S 

Live Chat Icon For mobile
Up arrow icon