当我尝试使用此代码启动我的应用程序时,它将引发异常,提示找不到错误文本。
<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>
似乎路由事件属性有问题。什么将解决此异常。
我认为最好的方法是使用行为。他们的目的是扩展基本控件的功能并结合可重用性。您可以在Windows博客上的此处看到一个摘要(而且正如我所看到的,它是名称空间框架的一部分:Microsoft.Xaml.Interactions.Core程序集:Microsoft.Xaml.Interactions.dll中的Microsoft.Xaml.Interactions)。
<Button x:Name="button">
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="Click">
<Media:ControlStoryboardAction Storyboard="storyboard1"/>
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
</Button>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句