我试图在ViewModel/Presentation Model繁忙时触发进度动画。我有一个IsBusy属性,并将ViewModel设置为UserControl的DataContext。当IsBusy属性为true时,触发“progressAnimation”故事板的最佳方式是什么? Blend只允许med在UserControl级别添加事件触发器,并且我只能在我的数据模板中创建属性触发器。WPF数据触发器和故事板
“progressAnimation”被定义为用户控件中的资源。
我尝试添加了DataTriggers作为对用户控件样式,但是当我尝试启动故事板,我得到了以下错误:
'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中使用数据绑定技术来解决这个问题,而不是必须通过代码公开事件并开始/停止动画。
那么,那正是我所希望的避免...但是,说我这样做:关于如何在不从UIElement派生的类中实现RoutedEvent的任何示例? – 2008-09-17 07:18:19