Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF Animation of DataGridRow Background color from transparent to "Current" (current is set with Trigger)
    primarykey
    data
    text
    <p>I'm setting <code>DataGridRow BackgroundColor</code> to Green or to Red with trigger based on <code>LogError</code> value.</p> <p>I want to animate newly added rows with transparency. </p> <p>This works fine:</p> <pre><code>From="Transparent" To="Red" </code></pre> <p>But what I want color to goes to is current color set with Style. Its not always Red it could be Green as well.</p> <p>This does not work:</p> <pre><code>From="Transparent" To="{TemplateBinding DataGridRow.Background}" </code></pre> <p>or</p> <pre><code>From="Transparent" To="{Binding RelativeSource={RelativeSource Self}, Path=Backgound}" </code></pre> <p>Code:</p> <pre><code>&lt;DataGrid.Resources&gt; &lt;Style TargetType="{x:Type DataGridRow}"&gt; &lt;Setter Property = "Background" Value="LimeGreen"/&gt; &lt;Style.Triggers&gt; &lt;DataTrigger Binding="{Binding LogMessage}" Value="Exception has occured"&gt; &lt;Setter Property = "Background" Value="Red"/&gt; &lt;/DataTrigger&gt; &lt;/Style.Triggers&gt; &lt;/Style&gt; &lt;/DataGrid.Resources&gt; &lt;DataGrid.RowStyle&gt; &lt;Style TargetType="DataGridRow"&gt; &lt;Style.Triggers&gt; &lt;EventTrigger RoutedEvent="Loaded"&gt; &lt;BeginStoryboard&gt; &lt;Storyboard&gt; &lt;ColorAnimation Storyboard.TargetProperty="(DataGridRow.Background).(SolidColorBrush.Color)" Duration="00:00:03" From="Transparent" To="{TemplateBinding DataGridRow.Background}"/&gt; &lt;/Storyboard&gt; &lt;/BeginStoryboard&gt; &lt;/EventTrigger&gt; &lt;/Style.Triggers&gt; &lt;/Style&gt; &lt;/DataGrid.RowStyle&gt; </code></pre> <p>Error message: <code>Cannot freeze this Storyboard timeline tree for use across threads.</code></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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