[英]VisualStateManager.GoToState() ignores useTransitions
I have a UserControl that has visual states in it. 我有一个具有可视状态的UserControl。 When the control constructs, I want to move to one of the states which is the "initial" one (not Default - there are modifications).
在构造控件时,我想移至一种状态,即“初始”状态(不是默认状态-有修改)。
public MyUserControl()
{
this.InitializeComponent();
Loaded += MyUserControl_Loaded;
VisualStateManager.GoToState(this, "HideImageState", false);
}
However, when the control loads up, there's an obvious transition happening (the one that HideImageState represents). 但是,在加载控件时,会发生明显的过渡(HideImageState表示的过渡)。
Why is that if I am passing in useTransitions? 如果我传入useTransitions,为什么会这样?
Since you aren't providing any more information, there are few things to work through "generally" that might help. 由于您不提供任何更多信息,因此“通常”需要进行的工作很少,可能会有所帮助。 Again, I am shooting from the hip with common problems...
再说一次,我遇到了常见问题,从臀部射击。
The first is that your storyboard is inaccurate. 首先是您的情节提要不正确。 If you created your transitions in Blend, then this is not likely.
如果您在Blend中创建了过渡,则不太可能。 But if you coded them by hand, then the targets may not be what you expect.
但是,如果您手动编码它们,则目标可能不是您期望的。
The animations could also be occurring but being occluded by other elements in the UI. 动画也可能会发生,但被UI中的其他元素遮挡。 This can sometimes occur when you are resizing an object inside a container that cannot stretch.
当您在无法拉伸的容器内调整对象大小时,有时可能会发生这种情况。
Finally, and most importantly, if your visual state transitions are in a user control that is wrapped in a Viewbox
then your view states are ignored for some reason. 最后,最重要的是,如果您的视觉状态转换位于包装在
Viewbox
中的用户控件中,则出于某种原因,您的视图状态将被忽略。
There are other possible reasons for you to get the result you are seeing. 您还有其他可能的原因要获得所看到的结果。 However, with so little information given, I can't keep on guessing.
但是,由于给出的信息很少,我无法继续猜测。 I would assume one of the above three reasons.
我认为上述三个原因之一。
Best of luck! 祝你好运!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.