本文整理汇总了C#中System.Windows.Media.Animation.DoubleAnimation.SetTarget方法的典型用法代码示例。如果您正苦于以下问题:C# DoubleAnimation.SetTarget方法的具体用法?C# DoubleAnimation.SetTarget怎么用?C# DoubleAnimation.SetTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.Animation.DoubleAnimation
的用法示例。
在下文中一共展示了DoubleAnimation.SetTarget方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DialogPanelShow
public void DialogPanelShow(bool bShow)
{
if (bShow) // force visibility since you can't animate the Visible property
{
m_this.Visibility = Visibility.Visible;
if (m_BackgroundElement != null)
m_BackgroundElement.Visibility = Visibility.Visible;
}
Storyboard storyBoard = new Storyboard();
//j m_this.Resources.Add("SomeSortofKeyName", storyBoard);
DoubleAnimation animation = new DoubleAnimation();
animation.From = (bShow ? 0 : 1);
animation.To = (bShow ? 1 : 0);
animation.Duration = TimeSpan.FromSeconds(0.5);
animation.SetTarget(m_RootDialogElement);
animation.SetTargetProperty("(UIElement.Opacity)");
storyBoard.Children.Add(animation);
if (bShow) storyBoard.Completed += ShowCompleted; else storyBoard.Completed += HideCompleted;
storyBoard.Begin();
}
示例2: GetGenericAnimation
/// <summary>
///
/// </summary>
/// <param name="from"></param>
/// <param name="to"></param>
/// <param name="millis"></param>
/// <param name="easingFunction"></param>
/// <param name="target"></param>
/// <returns></returns>
private static DoubleAnimation GetGenericAnimation(double from, double to, double millis, IEasingFunction easingFunction, UIElement target = null)
{
DoubleAnimation d = new DoubleAnimation();
d.EasingFunction = easingFunction;
d.Duration = TimeSpan.FromMilliseconds(millis);
d.From = from;
d.To = to;
d.SetTarget(target);
return d;
}