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

AlternatingRowStyle and RowStyle

Thread ID:





123859 Apr 27,2016 02:28 PM UTC Apr 28,2016 03:26 PM UTC WPF 1
Tags: SfDataGrid
marco del frate
Asked On April 27, 2016 02:28 PM UTC

Good evening,

in my sfDataGrid i set an alternatingRowStyle and a Row Styel as follow:
AlternatingRowStyle="{StaticResource alternatingRowStyle}" RowStyle="{StaticResource RowStyle}"

 <Style x:Key="alternatingRowStyle" TargetType="Syncfusion:VirtualizingCellsControl">
            <Setter Property="Background" >
                    <SolidColorBrush Opacity="0.5" Color="#F7F7F7F7" />

  <Style x:Key="RowStyle" TargetType="Syncfusion:VirtualizingCellsControl" >
                <DataTrigger Binding="{Binding Path=Annullata}" Value="True">
                    <Setter Property="Background" Value="Tomato"/>
                    <Setter Property="FontStyle" Value="Oblique"/>
                <DataTrigger Binding="{Binding Path=Superata}" Value="True">
                    <Setter Property="Background" Value="SandyBrown"/>

The problem is that if a Row is "colored" by the alternatingRowStyle, it will not "coloured" by the Rowstyle.
It's a problem of priority? I would like to set with higher priority the rowstyle, while at the moment it seems that the alternatingrowstyle has the higher proprity.

thank you in advance,

best regards
Marco Del Frate

Srinivasan Vasu [Syncfusion]
Replied On April 28, 2016 03:26 PM UTC

Hi Marco, 
Thanks for contacting Syncfusion support.  
We have analyzed your query and you can achieve your requirement by using Style.BasedOn property to apply style for row with higher priority. 
Please refer the below code example and we have prepared a sample for this. You can download the same from the below location. 

        <Style x:Key="RowStyle" TargetType="syncfusion:VirtualizingCellsControl" > 
                <DataTrigger Binding="{Binding Path=IsChecked}" Value="True"> 
                    <Setter Property="Background" Value="Yellow"/> 
                    <Setter Property="FontStyle" Value="Oblique"/> 
                <DataTrigger Binding="{Binding Path=IsChecked}" Value="False"> 
                    <Setter Property="Background" Value="Red"/> 
        <Style x:Key="alternatingRowStyle" TargetType="syncfusion:VirtualizingCellsControl" BasedOn="{StaticResource RowStyle}" > 
            <Setter Property="Background" > 
                    <SolidColorBrush  Opacity="0.5" Color="Green" />                     


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