Reader Level:
ARTICLE

WPF DataGrid Style

On January 01, 2011 Articles | WPF
The DataGrid control provides a flexible way to display a collection of data in rows and columns. The DataGrid includes built-in column types and a template column for hosting custom content. The built-in row type includes a drop-down details section that you can use to display additional content below the cell values.
  • 6
  • 0
  • 90859
Download Files:
 


The DataGrid control provides a flexible way to display a collection of data in rows and columns. The DataGrid includes built-in column types and a template column for hosting custom content. The built-in row type includes a drop-down details section that you can use to display additional content below the cell values.
Here is a simple style for WPF DataGrid that I want to share with all.

Style features:-
1. Rounded Border
2. Gradient DataGridColumnHeader with MouseOver effect
3. Custom ValidationErrorTemplate
4. DataGridRow MouseOver effect
5. DataGridCell IsSelected effect

1.png

 

<!--DataGrid -->

    <!--Style and template for the resize control on the DataGridColumnHeader.-->

    <Style x:Key="ColumnHeaderGripperStyle" TargetType="{x:Type Thumb}">

        <Setter Property="Width" Value="5" />

        <Setter Property="Background" Value="Transparent" />

        <Setter Property="Cursor" Value="SizeWE" />

        <Setter Property="Template">

            <Setter.Value>

                <ControlTemplate TargetType="{x:Type Thumb}">

                    <Border Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" />

                </ControlTemplate>

            </Setter.Value>

        </Setter>

    </Style>

 

    <!--Style and template for the DataGridColumnHeader.-->

    <Style TargetType="{x:Type DataGridColumnHeader}">

        <Setter Property="Background" Value="{DynamicResource NormalBorderBrush}"/>

        <Setter Property="Foreground" Value="{DynamicResource TextBrush}"/>

        <Setter Property="VerticalContentAlignment" Value="Center" />

        <Setter Property="Height" Value="30"/>

        <Setter Property="SeparatorBrush" Value="#FFC9CACA" />

        <Setter Property="FontSize" Value="14"/>

        <Setter Property="FontWeight" Value="SemiBold"/>

        <Setter Property="Padding" Value="4 0 0 0"/>

        <Setter Property="Template">

            <Setter.Value>

                <ControlTemplate TargetType="{x:Type DataGridColumnHeader}">

                    <ControlTemplate.Resources>

                        <Storyboard x:Key="HoverOn">

                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Hover" Storyboard.TargetProperty="(UIElement.Opacity)">

                                <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1"/>

                            </DoubleAnimationUsingKeyFrames>

                        </Storyboard>

                        <Storyboard x:Key="HoverOff">

                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Hover" Storyboard.TargetProperty="(UIElement.Opacity)">

                                <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0" />

                            </DoubleAnimationUsingKeyFrames>

                        </Storyboard>

                    </ControlTemplate.Resources>

                    <Grid Background='Transparent' >

                        <Grid.ColumnDefinitions>

                            <ColumnDefinition Width='Auto' />

                            <ColumnDefinition Width='Auto' />

                            <ColumnDefinition Width='*' />

                            <ColumnDefinition Width='Auto' />

                        </Grid.ColumnDefinitions>

                        <Rectangle x:Name="BackgroundRectangle" Grid.ColumnSpan="4" Grid.RowSpan="2"

                                   Fill="{StaticResource NormalBrush}" Stretch="Fill" Stroke="{StaticResource NormalBorderBrush}" StrokeThickness="1" />

                        <Rectangle x:Name="Hover" Grid.ColumnSpan="4" Grid.RowSpan="2" Stretch="Fill"

                                   Fill="{StaticResource MouseOverBrush}" Opacity="0" />

                        <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"

                                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}"

                                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"

                                                  Margin='{TemplateBinding Padding}'

                                                  Cursor="{TemplateBinding Cursor}"/>

                        <Path HorizontalAlignment="Left" x:Name="SortArrow" VerticalAlignment="Center"

                                      Width="8" Opacity="0" RenderTransformOrigin=".5,.5" Grid.Column="2" Grid.RowSpan="2" Fill="#FF000000" Stretch="Uniform" Data="F1 M -5.215,6.099L 5.215,6.099L 0,0L -5.215,6.099 Z ">

                            <Path.RenderTransform>

                                <TransformGroup>

                                    <ScaleTransform ScaleX=".9" ScaleY=".9" x:Name="SortIconTransform" />

                                </TransformGroup>

                            </Path.RenderTransform>

                        </Path>

                        <Thumb x:Name="PART_LeftHeaderGripper" Grid.Column="0" HorizontalAlignment="Left" Style="{StaticResource ColumnHeaderGripperStyle}"/>

                        <Thumb x:Name="PART_RightHeaderGripper" Grid.Column="3" HorizontalAlignment="Right" Style="{StaticResource ColumnHeaderGripperStyle}"/>

                    </Grid>

                    <ControlTemplate.Triggers>

                        <Trigger Property="SortDirection" Value="Ascending">

                            <Setter TargetName="SortArrow" Property="Opacity" Value="1" />

                            <Setter TargetName="SortArrow" Property="RenderTransform">

                                <Setter.Value>

                                    <RotateTransform Angle="180" />

                                </Setter.Value>

                            </Setter>

                            <Setter TargetName="BackgroundRectangle" Property="Opacity" Value="1" />

                        </Trigger>

                        <Trigger Property="SortDirection" Value="Descending">

                            <Setter TargetName="SortArrow" Property="Opacity" Value="1" />

                            <Setter TargetName="BackgroundRectangle" Property="Opacity" Value="1" />

                        </Trigger>

                        <Trigger Property="IsMouseOver" Value="true">

                            <Trigger.EnterActions>

                                <BeginStoryboard Storyboard="{StaticResource HoverOn}"/>

                            </Trigger.EnterActions>

                            <Trigger.ExitActions>

                                <BeginStoryboard Storyboard="{StaticResource HoverOff}"/>

                            </Trigger.ExitActions>

                        </Trigger>

                    </ControlTemplate.Triggers>

                </ControlTemplate>

            </Setter.Value>

        </Setter>       

    </Style>

 

    <!--Style and template for the DataGridColumnHeadersPresenter.-->

    <Style TargetType="{x:Type DataGridColumnHeadersPresenter}">

        <Setter Property="Template">

            <Setter.Value>

                <ControlTemplate TargetType="{x:Type DataGridColumnHeadersPresenter}">

                    <Grid>

                        <DataGridColumnHeader x:Name="PART_FillerColumnHeader" IsHitTestVisible="False" />

                        <ItemsPresenter />

                    </Grid>

                </ControlTemplate>

            </Setter.Value>

        </Setter>

    </Style>

 

    <Style x:Key="{ComponentResourceKey ResourceId=DataGridSelectAllButtonStyle, TypeInTargetAssembly={x:Type DataGrid}}" TargetType="{x:Type Button}">

        <Setter Property="Template">

            <Setter.Value>

                <ControlTemplate TargetType="{x:Type Button}">

                    <Grid>

                        <Rectangle x:Name="Border" Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" SnapsToDevicePixels="True"/>

                        <Polygon x:Name="Arrow" Fill="Black" HorizontalAlignment="Right" Margin="8,8,3,3" Opacity="0.15" Points="0,10 10,10 10,0" Stretch="Uniform" VerticalAlignment="Bottom"/>

                    </Grid>

                    <ControlTemplate.Triggers>

                        <Trigger Property="IsMouseOver" Value="True">

                            <Setter Property="Stroke" TargetName="Border" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"/>

                        </Trigger>

                        <Trigger Property="IsPressed" Value="True">

                            <Setter Property="Fill" TargetName="Border" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"/>

                        </Trigger>

                        <Trigger Property="IsEnabled" Value="False">

                            <Setter Property="Visibility" TargetName="Arrow" Value="Collapsed"/>

                        </Trigger>

                    </ControlTemplate.Triggers>

                </ControlTemplate>

            </Setter.Value>

        </Setter>

    </Style>

 

    <Style TargetType="{x:Type DataGrid}">

        <Setter Property="Background" Value="{StaticResource ControlContentBrush}"/>

        <Setter Property="RowDetailsVisibilityMode" Value="VisibleWhenSelected"/>

        <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>

        <Setter Property="ScrollViewer.PanningMode" Value="Both"/>

        <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>

        <Setter Property="Margin" Value="5"/>

        <Setter Property="BorderBrush" Value="{StaticResource NormalBorderBrush}" />

        <Setter Property="AlternatingRowBackground" Value="{StaticResource AlternateBackgroundBrush}"/>

        <Setter Property="HorizontalGridLinesBrush" Value="{StaticResource NormalBorderBrush}"/>

        <Setter Property="VerticalGridLinesBrush" Value="{StaticResource NormalBorderBrush}"/>

        <Setter Property="Template">

            <Setter.Value>

                <ControlTemplate TargetType="{x:Type DataGrid}">

                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="2" CornerRadius="5" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True">

                        <ScrollViewer x:Name="DG_ScrollViewer" Focusable="false">

                            <ScrollViewer.Template>

                                <ControlTemplate TargetType="{x:Type ScrollViewer}">

                                    <Grid>

                                        <Grid.ColumnDefinitions>

                                            <ColumnDefinition Width="Auto"/>

                                            <ColumnDefinition Width="*"/>

                                            <ColumnDefinition Width="Auto"/>

                                        </Grid.ColumnDefinitions>

                                        <Grid.RowDefinitions>

                                            <RowDefinition Height="Auto"/>

                                            <RowDefinition Height="*"/>

                                            <RowDefinition Height="Auto"/>

                                        </Grid.RowDefinitions>

                                        <Button Command="{x:Static DataGrid.SelectAllCommand}" Focusable="false" Style="{DynamicResource {ComponentResourceKey ResourceId=DataGridSelectAllButtonStyle, TypeInTargetAssembly={x:Type DataGrid}}}" Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.All}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" Width="{Binding CellsPanelHorizontalOffset, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>

                                        <DataGridColumnHeadersPresenter x:Name="PART_ColumnHeadersPresenter" Grid.Column="1" Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.Column}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>

                                        <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" Grid.ColumnSpan="2" Grid.Row="1"/>

                                        <ScrollBar x:Name="PART_VerticalScrollBar" Grid.Column="2" Maximum="{TemplateBinding ScrollableHeight}" Orientation="Vertical" Grid.Row="1" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"/>

                                        <Grid Grid.Column="1" Grid.Row="2">

                                            <Grid.ColumnDefinitions>

                                                <ColumnDefinition Width="{Binding NonFrozenColumnsViewportHorizontalOffset, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>

                                                <ColumnDefinition Width="*"/>

                                            </Grid.ColumnDefinitions>

                                            <ScrollBar x:Name="PART_HorizontalScrollBar" Grid.Column="1" Maximum="{TemplateBinding ScrollableWidth}" Orientation="Horizontal" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/>

                                        </Grid>

                                    </Grid>

                                </ControlTemplate>

                            </ScrollViewer.Template>

                            <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>

                        </ScrollViewer>

                    </Border>

                </ControlTemplate>

            </Setter.Value>

        </Setter>

        <Style.Triggers>

            <Trigger Property="IsGrouping" Value="true">

                <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>

            </Trigger>

        </Style.Triggers>

    </Style>

 

    <Style TargetType="{x:Type DataGridRow}">

        <Setter Property="SnapsToDevicePixels" Value="true"/>

        <Setter Property="Validation.ErrorTemplate" Value="{x:Null}"/>

        <Setter Property="ValidationErrorTemplate">

            <Setter.Value>

                <ControlTemplate>

                    <Grid>

                        <Ellipse Width="12" Height="12" Margin="0 2 0 0"

                        Fill="Red" Stroke="Black" VerticalAlignment="Top"

                        StrokeThickness="0.5"/>

                        <TextBlock FontWeight="Bold" Padding="4,0,0,0"

                        VerticalAlignment="Top" Foreground="White" Text="!"

                        ToolTip="{Binding (Validation.Errors)[0].ErrorContent, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type DataGridRow}}}"/>

                    </Grid>

                </ControlTemplate>

            </Setter.Value>

        </Setter>

 

        <Setter Property="Template">

            <Setter.Value>

                <ControlTemplate TargetType="{x:Type DataGridRow}">

                    <ControlTemplate.Resources>

                        <Storyboard x:Key="SelectedOn">

                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="select_gradient" Storyboard.TargetProperty="(UIElement.Opacity)">

                                <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1" />

                            </DoubleAnimationUsingKeyFrames>

                        </Storyboard>

                        <Storyboard x:Key="SelectedOff">

                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="select_gradient" Storyboard.TargetProperty="(UIElement.Opacity)">

                                <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0" />

                            </DoubleAnimationUsingKeyFrames>

                        </Storyboard>

                        <Storyboard x:Key="HoverOn">

                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="hover_gradient" Storyboard.TargetProperty="(UIElement.Opacity)">

                                <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="0.85" />

                            </DoubleAnimationUsingKeyFrames>

                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="highlight" Storyboard.TargetProperty="(UIElement.Opacity)">

                                <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="0.65" />

                            </DoubleAnimationUsingKeyFrames>

                        </Storyboard>

                        <Storyboard x:Key="HoverOff">

                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="hover_gradient" Storyboard.TargetProperty="(UIElement.Opacity)">

                                <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0" />

                            </DoubleAnimationUsingKeyFrames>

                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="highlight" Storyboard.TargetProperty="(UIElement.Opacity)">

                                <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0" />

                            </DoubleAnimationUsingKeyFrames>

                        </Storyboard>

                    </ControlTemplate.Resources>

                    <Border x:Name="DGR_Border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">

                        <SelectiveScrollingGrid>

                            <SelectiveScrollingGrid.ColumnDefinitions>

                                <ColumnDefinition Width="Auto"/>

                                <ColumnDefinition Width="*"/>

                            </SelectiveScrollingGrid.ColumnDefinitions>

                            <SelectiveScrollingGrid.RowDefinitions>

                                <RowDefinition Height="*"/>

                                <RowDefinition Height="Auto"/>

                            </SelectiveScrollingGrid.RowDefinitions>

 

                            <Rectangle x:Name="hover_gradient" Stroke="{DynamicResource FocusBrush}" StrokeThickness="1" RadiusX="1" RadiusY="1" Opacity="0" IsHitTestVisible="False" Grid.Column="1" Fill="{DynamicResource MouseOverBrush}"/>

                            <Rectangle x:Name="highlight" Margin="1" StrokeThickness="1" RadiusX="0.5" RadiusY="0.5" Opacity="0" IsHitTestVisible="False" Grid.Column="1" Stroke="{DynamicResource MouseOverHighlightBrush}" Fill="{DynamicResource MouseOverHighlightBrush}"/>

                            <Rectangle x:Name="select_gradient" Grid.Row="0" Grid.ColumnSpan="2" StrokeThickness="1" RadiusX="1" RadiusY="1" Opacity="0" IsHitTestVisible="False" Fill="{DynamicResource PressedBrush}" Stroke="{DynamicResource PressedBorderBrush}"/>

 

                            <DataGridCellsPresenter Grid.Column="1" ItemsPanel="{TemplateBinding ItemsPanel}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>

                            <DataGridDetailsPresenter Grid.Column="1" Grid.Row="1" SelectiveScrollingGrid.SelectiveScrollingOrientation="{Binding AreRowDetailsFrozen, ConverterParameter={x:Static SelectiveScrollingOrientation.Vertical}, Converter={x:Static DataGrid.RowDetailsScrollingConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" Visibility="{TemplateBinding DetailsVisibility}"/>

                            <DataGridRowHeader Grid.RowSpan="2" SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.Row}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>

 

                        </SelectiveScrollingGrid>

                    </Border>

                    <ControlTemplate.Triggers>

                        <Trigger Property="IsMouseOver" Value="True" SourceName="DGR_Border">

                            <Trigger.ExitActions>

                                <BeginStoryboard Storyboard="{StaticResource HoverOff}" x:Name="HoverOff_BeginStoryboard" />

                            </Trigger.ExitActions>

                            <Trigger.EnterActions>

                                <BeginStoryboard Storyboard="{StaticResource HoverOn}" x:Name="HoverOn_BeginStoryboard" />

                            </Trigger.EnterActions>

                        </Trigger>

                        <Trigger Property="IsSelected" Value="true">

                            <Trigger.ExitActions>

                                <BeginStoryboard x:Name="SelectedOff_BeginStoryboard" Storyboard="{StaticResource SelectedOff}" />

                            </Trigger.ExitActions>

                            <Trigger.EnterActions>

                                <BeginStoryboard Storyboard="{StaticResource SelectedOn}" />

                            </Trigger.EnterActions>

                        </Trigger>

                    </ControlTemplate.Triggers>

                </ControlTemplate>

            </Setter.Value>

        </Setter>

    </Style>

 

    <Style TargetType="{x:Type DataGridCell}">

        <Setter Property="Template">

            <Setter.Value>

                <ControlTemplate TargetType="{x:Type DataGridCell}">

                    <ControlTemplate.Resources>

                        <Storyboard x:Key="SelectedOn">

                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="select_gradient" Storyboard.TargetProperty="(UIElement.Opacity)">

                                <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1" />

                            </DoubleAnimationUsingKeyFrames>

                        </Storyboard>

                        <Storyboard x:Key="SelectedOff">

                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="select_gradient" Storyboard.TargetProperty="(UIElement.Opacity)">

                                <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0" />

                            </DoubleAnimationUsingKeyFrames>

                        </Storyboard>

                    </ControlTemplate.Resources>

                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">

                        <Grid>

                            <Rectangle x:Name="select_gradient" Margin="-2 -1 -2 -1"  Grid.Column="1" StrokeThickness="1" RadiusX="1" RadiusY="1" Opacity="0" IsHitTestVisible="False" Fill="{DynamicResource PressedBrush}" Stroke="{DynamicResource PressedBorderBrush}"/>

                            <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>

                        </Grid>

                    </Border>

                    <ControlTemplate.Triggers>

                        <Trigger Property="IsSelected" Value="true">

                            <Trigger.ExitActions>

                                <BeginStoryboard x:Name="SelectedOff_BeginStoryboard" Storyboard="{StaticResource SelectedOff}" />

                            </Trigger.ExitActions>

                            <Trigger.EnterActions>

                                <BeginStoryboard Storyboard="{StaticResource SelectedOn}" />

                            </Trigger.EnterActions>

                        </Trigger>

                    </ControlTemplate.Triggers>

                </ControlTemplate>

 

            </Setter.Value>

        </Setter>

    </Style>

    <BooleanToVisibilityConverter x:Key="bool2VisibilityConverter"/>

    <Style x:Key="RowHeaderGripperStyle" TargetType="{x:Type Thumb}">

        <Setter Property="Height" Value="8"/>

        <Setter Property="Background" Value="Transparent"/>

        <Setter Property="Cursor" Value="SizeNS"/>

        <Setter Property="Template">

            <Setter.Value>

                <ControlTemplate TargetType="{x:Type Thumb}">

                    <Border Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}"/>

                </ControlTemplate>

            </Setter.Value>

        </Setter>

    </Style>

 

    <Style TargetType="{x:Type DataGridRowHeader}">

        <Setter Property="Width" Value="20"/>

        <Setter Property="Template">

            <Setter.Value>

                <ControlTemplate TargetType="{x:Type DataGridRowHeader}">

                    <Grid>

                        <Microsoft_Windows_Themes:DataGridHeaderBorder BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" IsPressed="{TemplateBinding IsPressed}" IsHovered="{TemplateBinding IsMouseOver}" IsSelected="{TemplateBinding IsRowSelected}" Orientation="Horizontal" Padding="{TemplateBinding Padding}" SeparatorBrush="{TemplateBinding SeparatorBrush}" SeparatorVisibility="{TemplateBinding SeparatorVisibility}">

                            <StackPanel Orientation="Horizontal">

                                <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/>

                                <Control SnapsToDevicePixels="false" Template="{Binding ValidationErrorTemplate, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}" Visibility="{Binding (Validation.HasError), Converter={StaticResource bool2VisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}"/>

                            </StackPanel>

                        </Microsoft_Windows_Themes:DataGridHeaderBorder>

                        <Thumb x:Name="PART_TopHeaderGripper" Style="{StaticResource RowHeaderGripperStyle}" VerticalAlignment="Top"/>

                        <Thumb x:Name="PART_BottomHeaderGripper" Style="{StaticResource RowHeaderGripperStyle}" VerticalAlignment="Bottom"/>

                    </Grid>

                </ControlTemplate>

            </Setter.Value>

        </Setter>    </Style>



Nipun Tomar

Nipun is competent and experienced project leader, with 9 years of experience in managing multi-disciplinary teams of varying sizes and complex programs of work. Has the ability to build stro...

  • 27rank
  • 4M readers
  • 1times
COMMENT USING

Trending up