VisualStateManager,DiscreteObjectKeyFrame.KeyTime和Default过渡 [英] VisualStateManager, DiscreteObjectKeyFrame.KeyTime and Default transitions

查看:229
本文介绍了VisualStateManager,DiscreteObjectKeyFrame.KeyTime和Default过渡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图弄清楚如何在转换开始时播放ObjectAnimationUsingKeyFrames。

I am trying to figure out how to play ObjectAnimationUsingKeyFrames at the beginning of the transition.

假设我有一个默认状态和其他状态。

Let's say I have a default state and other state.

在其他状态VIsualState我有类似的东西(Blend 2013生成):

In other state VIsualState I have something like (Blend 2013 generated):

<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="border">
							<DiscreteObjectKeyFrame KeyTime="0">
								<DiscreteObjectKeyFrame.Value>
									<Visibility>Visible</Visibility>
								</DiscreteObjectKeyFrame.Value>
							</DiscreteObjectKeyFrame>
						</ObjectAnimationUsingKeyFrames>


注意KeyTime =" 0"。$

我已将默认转换设置为1s。

Note the KeyTime="0".

And I have set the Default transition to 1s.

我希望Visiblity立即改变,但事实并非如此。相反,它仅在转换结束时(1s后)更改。如果我设置了更高的KeyTime,那么它会在*转换结束后播放很长时间*。

I'd expect Visiblity to change immediately, but that isn't the case. Instead it is changed only at the end of transition (after 1s). If I set a higher KeyTime then it is played that much time *after* transition ended.

因此,问题是是否可以使用默认转换在转换开始时播放。

So, the question is whether is possible to play that at the beginning of the transition using Default transitions.

Miha Markic [MVP C#] http://blog.rthand.com

Miha Markic [MVP C#] http://blog.rthand.com

推荐答案

你好Miha,

Hi Miha,

我不确定是否可以使用XAML,但总是可以使用代码,例如动画完成时,我们可以拥有

已完成的事件
已触发,我们可以执行转换。

I'm not sure if it is possible with XAML but always possible with code, for example when the animation finished, we can have the Completed event fire and we can execute the transition.

- 詹姆斯


这篇关于VisualStateManager,DiscreteObjectKeyFrame.KeyTime和Default过渡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆