HI,
I have data grid and style like this below:
Issue is: If I apply style to daatgrid then my RowValidationErrorTemplate does not work. i don't see that error icon and If I remove style then it works.
How would i solve that?
Data Grid
<loc:RhinoDataGrid Grid.Row="0" VirtualizingStackPanel.IsVirtualizing="False" ItemsSource="{Binding DataTable, Mode=TwoWay}">
<DataGrid.RowValidationRules>
<loc:CourseValidationRule ValidationStep="RawProposedValue"/>
</DataGrid.RowValidationRules>
<DataGrid.RowValidationErrorTemplate>
<ControlTemplate>
<Grid Margin="0,-2,0,-2">
<Ellipse StrokeThickness="0" Fill="Red"
Width="{TemplateBinding FontSize}"
Height="{TemplateBinding FontSize}" />
<TextBlock Text="!" FontSize="{TemplateBinding FontSize}"
FontWeight="Bold" Foreground="White"
HorizontalAlignment="Center" />
</Grid>
</ControlTemplate>
</DataGrid.RowValidationErrorTemplate>
</loc:RhinoDataGrid>
Datagrid Style
<Window.Resources>
<!-- Control template for row header -->
<ControlTemplate TargetType="{x:Type DataGridRowHeader}" x:Key="RowHeaderControlTemplate">
<Grid Background="{TemplateBinding Background}" x:Name="dgRowHeader">
<Border x:Name="border" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Grid.ColumnSpan="1">
<Rectangle Margin="3,3,3,3" HorizontalAlignment="Stretch" RadiusX="5" RadiusY="5" x:Name="PART_RectangleRow"/>
</Border>
<ContentPresenter x:Name="content" HorizontalAlignment="Center" VerticalAlignment="Center" Content="{TemplateBinding Content}" />
</Grid>
</ControlTemplate>
<Style x:Key="MyDataGridStyle" TargetType="{x:Type DataGrid}">
<Style.Resources>
<!--DataGridRowHeader default style-->
<Style TargetType="{x:Type DataGridRowHeader}">
<Setter Property="Width" Value="36" />
<Setter Property="BorderBrush" Value="Black"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0,0,1,1"/>
<Setter Property="Content" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type DataGridRow}}, Converter={StaticResource RowNameConverter}}"/>
<Setter Property="Template" Value="{StaticResource RowHeaderControlTemplate}" />
</Style>
</Style.Resources>
</Style>
</Window.Resources>
Please help
Thanks
Dee