将 VisualStateManager.VisualStateGroups 分离到资源字典中
有什么方法可以将 VisualStateManager.VisualStateGroups
分离到 ResourceDictionary
中吗?
基本上我想要类似的东西
<VisualStateManager.VisualStateGroups x:Name="MyVisualGroups">
<VisualStateGroup x:Name="A" />
<VisualStateGroup x:Name="B" />
<VisualStateGroup x:Name="C" />
</VisualStateManager.VisualStateGroups>
,但显然行不通。有什么办法让它发挥作用吗?
Is there any way to separate the VisualStateManager.VisualStateGroups
into a ResourceDictionary
?
Basically I want something like
<VisualStateManager.VisualStateGroups x:Name="MyVisualGroups">
<VisualStateGroup x:Name="A" />
<VisualStateGroup x:Name="B" />
<VisualStateGroup x:Name="C" />
</VisualStateManager.VisualStateGroups>
but it obviously doesn't work. Any way to make it work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您将它们包装在样式对象中,您应该能够完成这项工作。查看我对这个问题的回答这是一个示例,说明如何包装 VSM 内容以重新设置列表框中所选状态的样式。
注意:不过,我不确定这是否适用于一组通用的 VisualStates。不过,它确实适用于整个列表框 ItemContainerStyle 设置。
If you wrap them in a style objct, you should be able to make this work. Check out my answer to this question for an example of how the VSM stuff is wrapped to restyle the selected state in a listbox.
Note : I am not sure if that would work for a set of generic VisualStates, though. It does work for the whole of a listbox ItemContainerStyle settings, though.