【问题标题】:VisualStateManager inconsistencyVisualStateManager 不一致
【发布时间】:2013-06-02 21:22:49
【问题描述】:
如何在继承自 FrameworkElement 的任何对象上声明 VisualStates 和 VisualStateGroups 但要调用 VisualStateManager.GoToState 需要指定一个控件?声明无法导航到它们的状态有什么意义?
这在我看来是不一致的。我是对的还是我错过了什么?
提前致谢
【问题讨论】:
标签:
.net
silverlight
visualstatemanager
visualstates
【解决方案1】:
VisualStateManager.VisualStateGroups 属性设置在ControlTemplate 的根元素上,它可以是FrameworkElement,如Panel。但是,GoToState() 方法的 control 参数不是模板的根元素,它是 Control 本身,它绑定了 ControlTemplate。
有点混乱?也许。不是很OOP?绝对的。