Note that there are some explanatory texts on larger screens.

plurals
  1. POColorAnimation in MultiDataTrigger's EnterActions not triggering when item is added to ListView
    primarykey
    data
    text
    <p>I have a ListView with AlternationCount set to 2. I have a ListViewItem style that currently sets the background color of the ListViewItem to alternating colors, and I would like to add a third trigger which triggers a ColorAnimation to animate the color between Red and White when a property of the bound ViewModel is true (in this case a property called "Locked").</p> <p>I came across this post, and tried the xaml at the bottom:</p> <p><a href="http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/e7897cbd-71d9-45e6-9b17-0cd5bde5859f" rel="nofollow">http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/e7897cbd-71d9-45e6-9b17-0cd5bde5859f</a></p> <p>But, the animation doesn't appear to trigger for me until I mouse over or select the item, then select or mouse over a different item. I get the alternating colors from the first two MultiDataTriggers, but the animation doesn't trigger when the item is added to the collection. Here is my XAML:</p> <pre><code> &lt;Style x:Key="alternatingListViewItemStyle" TargetType="{x:Type ListViewItem}"&gt; &lt;Setter Property="Background" Value="White" /&gt; &lt;Style.Triggers&gt; &lt;MultiDataTrigger &gt; &lt;MultiDataTrigger.Conditions&gt; &lt;Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(ItemsControl.AlternationIndex)}" Value="0" /&gt; &lt;Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(ListViewItem.IsSelected)}" Value="False" /&gt; &lt;Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(Panel.IsMouseOver)}" Value="False" /&gt; &lt;Condition Binding="{Binding Locked}" Value="False" /&gt; &lt;/MultiDataTrigger.Conditions&gt; &lt;Setter Property="Background" Value="DarkGray" /&gt; &lt;/MultiDataTrigger&gt; &lt;MultiDataTrigger &gt; &lt;MultiDataTrigger.Conditions&gt; &lt;Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(ItemsControl.AlternationIndex)}" Value="1" /&gt; &lt;Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(ListViewItem.IsSelected)}" Value="False" /&gt; &lt;Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(Panel.IsMouseOver)}" Value="False" /&gt; &lt;Condition Binding="{Binding Locked}" Value="False" /&gt; &lt;/MultiDataTrigger.Conditions&gt; &lt;Setter Property="Background" Value="SlateGray" /&gt; &lt;/MultiDataTrigger&gt; &lt;MultiDataTrigger&gt; &lt;MultiDataTrigger.Conditions&gt; &lt;Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(ListViewItem.IsSelected)}" Value="False" /&gt; &lt;Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(Panel.IsMouseOver)}" Value="False" /&gt; &lt;Condition Binding="{Binding Locked}" Value="True" /&gt; &lt;/MultiDataTrigger.Conditions&gt; &lt;MultiDataTrigger.EnterActions&gt; &lt;BeginStoryboard&gt; &lt;Storyboard&gt; &lt;ColorAnimation Storyboard.TargetProperty="(Control.Background).(SolidColorBrush.Color)" From="Red" To="White" Duration="0:0:0.2" AutoReverse="True" RepeatBehavior="Forever" /&gt; &lt;/Storyboard&gt; &lt;/BeginStoryboard&gt; &lt;/MultiDataTrigger.EnterActions&gt; &lt;/MultiDataTrigger&gt; &lt;/Style.Triggers&gt; &lt;/Style&gt; </code></pre>
    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.
    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