WPF Data Triggers and Story Boards
What you want is possible by declaring the animation on the progressWheel itself: The XAML: <UserControl x:Class=”TriggerSpike.UserControl1″ xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” Height=”300″ Width=”300″> <UserControl.Resources> <DoubleAnimation x:Key=”SearchAnimation” Storyboard.TargetProperty=”Opacity” To=”1″ Duration=”0:0:4″/> <DoubleAnimation x:Key=”StopSearchAnimation” Storyboard.TargetProperty=”Opacity” To=”0″ Duration=”0:0:4″/> </UserControl.Resources> <StackPanel> <TextBlock Name=”progressWheel” TextAlignment=”Center” Opacity=”0″> <TextBlock.Style> <Style> <Style.Triggers> <DataTrigger Binding=”{Binding IsBusy}” Value=”True”> <DataTrigger.EnterActions> <BeginStoryboard> <Storyboard> <StaticResource ResourceKey=”SearchAnimation”/> </Storyboard> </BeginStoryboard> </DataTrigger.EnterActions> <DataTrigger.ExitActions> <BeginStoryboard> … Read more