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
close icon

AlternatingRowStyle and RowStyle

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" >
                <Setter.Value>
                    <SolidColorBrush Opacity="0.5" Color="#F7F7F7F7" />
                </Setter.Value>
            </Setter>
        </Style>

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


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



1 Reply

SV Srinivasan Vasu Syncfusion Team 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. 

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


Loader.
Live Chat Icon For mobile
Up arrow icon