I’m trying to style the DataGrid to show the red error border when there are no items in it’s ItemsSource collection. I already have all the code written and working for the Triggers.
Here is what I tried:
<Style x:Key="WarningDataGrid" TargetType="DataGrid" BasedOn="{StaticResource {x:Type DataGrid}}">
<Style.Triggers>
<Trigger Property="ocean:DataGridBehavior.HasWarning" Value="true">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Border BorderThickness="1" BorderBrush="Red">
<AdornedElementPlaceholder />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(ocean:CheckBoxBehavior.Warning)}" />
</Trigger>
</Style.Triggers>
</Style>
But since I’m not using the validation framework all that happens is the red border replaces the DataGrid.
Do I need to start with the default style? If so where do I find it.
You are replacing the whole template. Just set the
BorderBrush: