本文整理汇总了C#中System.Windows.FrameworkElement.ApplyAnimationClock方法的典型用法代码示例。如果您正苦于以下问题:C# FrameworkElement.ApplyAnimationClock方法的具体用法?C# FrameworkElement.ApplyAnimationClock怎么用?C# FrameworkElement.ApplyAnimationClock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.FrameworkElement
的用法示例。
在下文中一共展示了FrameworkElement.ApplyAnimationClock方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AnimationExpressionFillBehaviorStopTest
public void AnimationExpressionFillBehaviorStopTest()
{
DoubleAnimation animation = new DoubleAnimation { From = 10, To = 20, FillBehavior = FillBehavior.Stop };
TestRootClock rootClock = new TestRootClock();
rootClock.Tick(TimeSpan.FromSeconds(1));
FrameworkElement element = new FrameworkElement();
Assert.AreEqual(Double.NaN, element.Width);
AnimationTimelineClock animationClock = (AnimationTimelineClock)animation.CreateClock();
element.ApplyAnimationClock(FrameworkElement.WidthProperty, animationClock);
animationClock.Begin(rootClock);
rootClock.Tick(TimeSpan.FromSeconds(1));
Assert.AreEqual(10, element.Width);
rootClock.Tick(TimeSpan.FromSeconds(2));
Assert.AreEqual(Double.NaN, element.Width);
}
示例2: ApplyAnimationClockTest
private void ApplyAnimationClockTest(DoubleAnimation animation)
{
FrameworkElement element = new FrameworkElement();
TestRootClock rootClock = new TestRootClock();
rootClock.Tick(TimeSpan.FromSeconds(0));
AnimationTimelineClock clock = (AnimationTimelineClock)animation.CreateClock();
clock.Begin(rootClock);
element.Width = 10;
Assert.AreEqual(10, element.Width);
element.ApplyAnimationClock(FrameworkElement.WidthProperty, clock);
Assert.AreEqual(10, element.Width);
rootClock.Tick(TimeSpan.FromSeconds(0.5));
Assert.AreEqual(15, element.Width);
rootClock.Tick(TimeSpan.FromSeconds(1));
Assert.AreEqual(20, element.Width);
clock.Stop();
element.Width = 30;
Assert.AreEqual(30, element.Width);
}