Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Change your Style's <code>TargetType</code> from a <code>TextBlock</code> to a <code>DataGridCell</code>, then apply the style as the <code>DataGrid.CellStyle</code>. Since you already have a <code>CellStyle</code> set to <code>DGCellStyle</code>, you'll probably have to merge the two styles.</p> <p>Also, you'll need to change <code>TextAlignment</code> to <code>HorizontalAlignment</code> in your base style since <code>TextAlignment</code> is not a property of <code>DataGridCell</code></p> <pre><code>&lt;Style x:Key="BaseStyle" TargetType="{x:Type DataGridCell}"&gt; &lt;Setter Property="Background" Value="Transparent"/&gt; &lt;Setter Property="Foreground" Value="Black"/&gt; &lt;Setter Property="FontSize" Value="10"/&gt; &lt;Setter Property="HorizontalAlignment" Value="Center"/&gt; &lt;/Style&gt; &lt;Style TargetType="{x:Type DataGridCell}" x:Key="Col1Style" BasedOn="{StaticResource BaseStyle}"&gt; &lt;Setter Property="Background"&gt; &lt;Setter.Value&gt; &lt;SolidColorBrush Color="Tomato"/&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;Style.Triggers&gt; &lt;EventTrigger RoutedEvent="Binding.TargetUpdated"&gt; &lt;BeginStoryboard HandoffBehavior="Compose"&gt; &lt;Storyboard TargetProperty="(DataGridCell.Background).(SolidColorBrush.Color)"&gt; &lt;ColorAnimation Duration="0:0:1.5" To="DarkRed" AutoReverse="True" RepeatBehavior="1" /&gt; &lt;/Storyboard&gt; &lt;/BeginStoryboard&gt; &lt;/EventTrigger&gt; &lt;/Style.Triggers&gt; &lt;/Style&gt; </code></pre> <p>And</p> <pre><code>&lt;DataGrid CellStyle="{StaticResource Col1Style}" ... /&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload