【发布时间】:2010-09-09 23:19:47
【问题描述】:
我试图在 ViewModel/Presentation Model 忙碌时触发进度动画。我有一个 IsBusy 属性,并将 ViewModel 设置为 UserControl 的 DataContext。当 IsBusy 属性为真时,触发“progressAnimation”故事板的最佳方式是什么? Blend 只允许 med 在 UserControl 级别添加 Event-Triggers,而我只能在我的数据模板中创建属性触发器。
“progressAnimation”被定义为用户控件中的资源。
我尝试将 DataTriggers 添加为 UserControl 上的样式,但是当我尝试启动 StoryBoard 时出现以下错误:
'System.Windows.Style' value cannot be assigned to property 'Style'
of object'Colorful.Control.SearchPanel'. A Storyboard tree in a Style
cannot specify a TargetName. Remove TargetName 'progressWheel'.
ProgressWheel 是我要制作动画的对象的名称,因此删除目标名称显然不是我想要的。
我希望使用数据绑定技术在 XAML 中解决这个问题,而不是通过代码公开事件和启动/停止动画。
【问题讨论】:
标签: wpf animation expression-blend