尝试在 WP7 上使用 xaml 根据自定义控件的事件对属性进行动画处理
我的 XAML 看起来像这样:
<me:MyControl x:Name="Publisher">
<me:MyControl.Triggers>
<EventTrigger RoutedEvent="me:MyControl.MyEvent">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="Publisher"
Storyboard.TargetProperty="Opacity"
To="1" Duration="0:0:1"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger -->
</me:MyControl.Triggers>
</me:MyControl>
当加载时,我收到一个异常,说
Attribute me:MyControl.MyEventvalue is out of range
我已经尝试过
- :MyControl.MyEvent
- MyControl.MyEvent
- MyEvent
- Publisher.MyEvent
让它工作的神奇咒语是什么?
My XAML looks like this:
<me:MyControl x:Name="Publisher">
<me:MyControl.Triggers>
<EventTrigger RoutedEvent="me:MyControl.MyEvent">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="Publisher"
Storyboard.TargetProperty="Opacity"
To="1" Duration="0:0:1"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger -->
</me:MyControl.Triggers>
</me:MyControl>
When this loads I get an exception saying
Attribute me:MyControl.MyEventvalue is out of range
I've tried
- me:MyControl.MyEvent
- MyControl.MyEvent
- MyEvent
- Publisher.MyEvent
What's the magic incantation to get this to work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在查看 WPF 示例,Silverlight 不直接支持除已加载事件之外的任何触发器。
考虑使用
VisualStateManager
代替。然后,您需要通过事件代码更改状态。You've be looking at WPF examples, Silverlight doesn't directly support any trigger other than for the loaded event.
Consider using the
VisualStateManager
instead. You then need to change the state via code on the event.