视觉状态造型
我正在使用 WPF 工具包中的 VisualStateManager。我创建了一个自定义控件,它是可重用控件库的一部分,具有多种视觉状态。现在我想允许我的库的客户轻松地重新设计这些视觉状态的字体和颜色。这样做的标准方法是什么?我是否必须要求客户替换整个控件模板并替换所有视觉状态,即使他们只对修改一个感兴趣?或者是否有更好的方法...比如我如何使 GoToState 遵循客户端提供的触发器,旨在覆盖视觉状态的默认字体和颜色?还有其他想法吗?
I am using the VisualStateManager from the WPF Toolkit. I've created a custom control, part of a reusable controls library, with numerous visual states. Now I want to allow the client of my library to easily restyle the fonts and colors of these visual states. What's the standard way of doing this? Must I require the client to replace the entire control template and replace all the visual states, even if they're only interested in modifying just one? Or is there a better way... like how could I make GoToState defer to a client-supplied trigger intended to override a visual state's default font and color? Other ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在尝试的第一个案例中就成功了。目标是使此代码产生效果:
这就是我的做法:
注意 Style.Merge 扩展方法。我从 http://bea.stollnitz.com/blog/?p=384< /a> .它使我能够结合多个视觉状态组的效果。
I got this working for the first case I tried. The goal was to make it so that this code would have an effect:
This is how I did it:
Notice the Style.Merge extension method. I got it from http://bea.stollnitz.com/blog/?p=384 . It enables me to combine the effects of multiple visual state groups.