从开始一个XAML过渡的VisualState [英] Start a VisualState transition from XAML
问题描述
在该VisualStateManger可以在代码被用来启动一个过渡,或动画,像这样的用户控件(或其他),大家都知道:
In a user control (or whatever), we all know that the VisualStateManger can be used in code to start a transition, or animation, like so:
if (target.IsLocked)
{
VisualStateManager.GoToState(this, "Locked", true);
}
else if (target.IsBroken)
{
VisualStateManager.GoToState(this, "Broken", true);
}
else
{
VisualStateManager.GoToState(this, "Normal", true);
}
然而,似乎是关于触发这些类型的很少或没有信息从XAML动画。难道一个DataTemplate或触发定义,可以提供相当于行为上面列出的代码?
However, there seems to be very little or no information about triggering these type of animations from XAML. Could a DataTemplate or Trigger be defined that could provide behaviour equivalent to the code listed above?
推荐答案
使用 Interativity
从混合SDK < 。/ A>我相信你可以做这样的事情。
Using Interativity
from the Blend SDK i am sure you could do something like this.
编辑:它包含的 GoToStateAction
专门针对这一点。
It contains a GoToStateAction
specifically for this.
有喜欢的这可能是能够做同样的事情标记编程。这也表明,如果你愿意,你可以做在XAML中相当多的东西。
There are other libraries like Markup Programming which might be able to do something similar. It also demonstrates that you can do pretty much anything in XAML if you want to.
这篇关于从开始一个XAML过渡的VisualState的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!