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

AlternatingRowStyle and RowStyle

Thread ID:

Created:

Updated:

Platform:

Replies:

123859 Apr 27,2016 02:28 PM UTC Apr 28,2016 03:26 PM UTC WPF 1
loading
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" >
                <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



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. 

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 
 


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

;