Category / Section
How to differentiate Frozen/Footer rows and Normal rows in the Windows Phone DataGrid?
1 min read
In the SfDataGrid, you can differentiate the frozen/footer rows and normal rows by customizing the border in the FrozenRow and FooterRow visual states of the VirtualizingCellsControl. In the following code example, the BorderThickness is changed in the FrozenRow and FooterRow visual states.
XAML
<Style TargetType="syncfusion:VirtualizingCellsControl"> <Setter Property="Background" Value="Transparent" /> <Setter Property="BorderBrush" Value="Gray" /> <Setter Property="BorderThickness" Value="0" /> <Setter Property="IsTabStop" Value="False" /> <Setter Property="FocusVisualStyle" Value="{x:Null}" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="syncfusion:VirtualizingCellsControl"> <Grid> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="BorderStates"> <VisualState x:Name="NormalRow" /> <VisualState x:Name="FrozenRow"> <Storyboard BeginTime="0"> <ThicknessAnimationUsingKeyFrames BeginTime="0" Duration="1" Storyboard.TargetName="PART_RowBorder" Storyboard.TargetProperty="BorderThickness"> <!--Sets the Border Thickness for Frozen Rows-->. <EasingThicknessKeyFrame KeyTime="0" Value="0, 0, 0, 3" /> </ThicknessAnimationUsingKeyFrames> </Storyboard> </VisualState> <VisualState x:Name="FooterRow"> <Storyboard BeginTime="0"> <ThicknessAnimationUsingKeyFrames BeginTime="0" Duration="1" Storyboard.TargetName="PART_RowBorder" Storyboard.TargetProperty="BorderThickness"> <!--Sets the Border Thickness for Footer Rows-->. <EasingThicknessKeyFrame KeyTime="0" Value="0, 3, 0, 0" /> </ThicknessAnimationUsingKeyFrames> <ThicknessAnimationUsingKeyFrames BeginTime="0" Duration="1" Storyboard.TargetName="PART_RowBorder" Storyboard.TargetProperty="Margin"> <EasingThicknessKeyFrame KeyTime="0" Value="0, -1, 0, 0" /> </ThicknessAnimationUsingKeyFrames> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Border x:Name="PART_RowBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"> </Border> <Rectangle x:Name="PART_CurrentFocusRow" Margin="{TemplateBinding CurrentFocusBorderMargin}" Stroke="DarkGray" StrokeDashArray="2,2" StrokeThickness="1" Visibility="{TemplateBinding CurrentFocusRowVisibility}" /> <Border Background="{TemplateBinding RowHoverBackgroundBrush}" BorderBrush="{TemplateBinding RowHoverBackgroundBrush}" BorderThickness="{TemplateBinding RowHighlightBorderThickness}" Clip="{TemplateBinding HighlightBorderClipRect}" SnapsToDevicePixels="True" Visibility="{TemplateBinding HighlightSelectionBorderVisiblity}" /> <Rectangle Clip="{TemplateBinding RowBackgroundClip}" Fill="{TemplateBinding Background}" /> <Border Background="{TemplateBinding RowSelectionBrush}" Clip="{TemplateBinding SelectionBorderClipRect}" Visibility="{TemplateBinding SelectionBorderVisiblity}" /> <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"> <ContentPresenter /> </Border> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style>
Note:
The above code example is for the WPF platform. For other platforms, refer to the following.
Sample Links: