我有一个故事板,并希望设置附加属性VisualStateUtility.InitialState.我尝试了各种组合,但财产永远不会得到解决.
我收到以下错误:无法解析TargetProperty(VisualStateUtility.InitialState)
<ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="(Fully.Qualified.Namespace.VisualStateUtility.InitialState)" Storyboard.TargetName="ExpanderButton">
public static string GetinitialState(DependencyObject obj) { return (string)obj.GetValue(InitialStateProperty); } public static void SetinitialState(DependencyObject obj,string value) { obj.SetValue(InitialStateProperty,value); } // Using a DependencyProperty as the backing store for InitialState. This enables animation,styling,binding,etc... public static readonly DependencyProperty InitialStateProperty = DependencyProperty.Registerattached("InitialState",typeof(string),typeof(VisualStateUtility),new PropertyMetadata(null,OnInitialStatePropertyChanged));
解决方法
这应该可以解决问题
<ObjectAnimationUsingKeyFrames x:Name="animation" Duration="0" Storyboard.TargetProperty="xmlnsAlias:VisualStateUtility.InitialState" Storyboard.TargetName="ExpanderButton">
注意如何将名称添加到动画中,从目标属性名称中删除括号,然后使用xaml标头中的xmlns别名作为前缀.
InitializeComponent(); Storyboard.SetTargetProperty(animation,new PropertyPath(Fully.Qualified.Namespace.VisualStateUtility.InitialState));
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。