When I try to start my app with this code it throws an exception saying error text cannot be found.
<Button>
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Duration="0:0:05"
To="1" From="0"
Storyboard.TargetName="ContentGrid"
Storyboard.TargetProperty="Opacity" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
</Button>
Seems like something wrong with the routed event property. What will fix this exception.
I think the best way is to use a Behavior. It's their purpose to extend the functions of basic controls combined with reusability. You can see a snippet right over here on Windows blog (and as I see, it's a part of the framework in Namespace: Microsoft.Xaml.Interactions.Core Assembly: Microsoft.Xaml.Interactions in Microsoft.Xaml.Interactions.dll).
<Button x:Name="button">
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="Click">
<Media:ControlStoryboardAction Storyboard="storyboard1"/>
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
</Button>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With