У меня есть MainWindow.xaml с одной сеткой
<Grid.Effect>
<BlurEffect x:Name="blurEffect" Radius="{StaticResource StartBluringValue}"/>
</Grid.Effect>
<Grid.Triggers>
<EventTrigger RoutedEvent="local:MainWindow.Blured">
<BeginStoryboard Storyboard="{StaticResource MainWindow_Bluring}"/>
</EventTrigger>
<EventTrigger RoutedEvent="local:MainWindow.UnBlured">
<BeginStoryboard Storyboard="{StaticResource MainWindow_UnBluring}"/>
</EventTrigger>
</Grid.Triggers>
И у меня есть MainWindow.xaml.cs с некоторыми RoutedEvents, подобными этому
public static readonly RoutedEvent BluredEvent =
EventManager.RegisterRoutedEvent("Blured", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(MainWindow));
public event RoutedEventHandler Blured
{
add { AddHandler(BluredEvent, value); }
remove { RemoveHandler(BluredEvent, value); }
}
private void OnBlured()
{
RaiseEvent(new RoutedEventArgs(BluredEvent));
}
Но раскадровка не запускается.Например, StoryBoard:
<Storyboard x:Key="MainWindow_Bluring">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(BlurEffect.Radius)" Storyboard.TargetName="blurEffect">
<DiscreteDoubleKeyFrame KeyTime="{StaticResource AnimationStartTime}" Value="{StaticResource StartBluringValue}"/>
<DiscreteDoubleKeyFrame KeyTime="{StaticResource AnimationEndTime}" Value="{StaticResource StopBluringValue}"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>