gpt4 book ai didi

silverlight-3.0 - 如何使用 VisualStateManager 返回 "Base"状态?

转载 作者:行者123 更新时间:2023-12-03 14:34:01 28 4
gpt4 key购买 nike

我知道我们可以使用

VisualStateManager.GoToState(this,"SomeState1",true);

进入 SomeState1 ,但现在如何回到基本状态,比如没有状态,控件加载的状态。
VisualStateManager.GoToState(this,"base",true); 

// OR

VisualStateManager.GoToState(this,"",true);

// OR

VisualStateManager.GoToState(this,null,true);

问题是如果没有这样的方法可以回到初始状态或基本状态,那么我将必须始终创建第一个状态,并在构造函数中在控制开始时转到第一个状态。

我没有找到任何文档,所以我正在尝试所有组合,但没有找到任何有效的组合。

最佳答案

正常!= 基地。

Base 只是在应用任何视觉状态之前(即在 VSM 处于事件状态之前)控件的初始状态。

如果您在 Expression blog 上阅读本文我在这里提出了一个很好的描述:

... when you author your own templated control or UserControl, you should define a ‘default’ state in each state group. Have the control go to those ‘default’ states when it initializes, and do so with transitions suppressed so that it happens without delay. Once it’s on the state graph, the control is ready for state transitions to occur so now you can implement the event-handlers that trigger the transitions within the state graph.



简单地看一下 VSM 源代码,似乎没有办法摆脱 VSM 并返回到您原来的基本状态……所以是的,您确实需要一个“正常”状态。 :(

我也觉得这有点烦人,因为 VSM 状态不能轻易删除,尽管上述解决方案确实有意义。也许他们将来会解决这个问题。

关于silverlight-3.0 - 如何使用 VisualStateManager 返回 "Base"状态?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1508323/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com