本文整理汇总了C#中System.Windows.Media.Animation.Storyboard.BeginAsync方法的典型用法代码示例。如果您正苦于以下问题:C# Storyboard.BeginAsync方法的具体用法?C# Storyboard.BeginAsync怎么用?C# Storyboard.BeginAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.Animation.Storyboard
的用法示例。
在下文中一共展示了Storyboard.BeginAsync方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SlideIn
private async void SlideIn()
{
this.Opacity = 1.0;
Rectangle workingArea = Screen.PrimaryScreen.WorkingArea;
DoubleAnimation a_top = new DoubleAnimation {
From = new double?(workingArea.Bottom + this.Height),
To = new double?((workingArea.Bottom - this.Height) - 5.0),
Duration = new Duration(TimeSpan.FromSeconds(0.5))
};
DoubleAnimation a_bottom = new DoubleAnimation {
To = new double?((workingArea.Bottom + this.Height) + 5.0),
Duration = new Duration(TimeSpan.FromSeconds(0.5))
};
Storyboard storyboard = new Storyboard();
storyboard.Children.Add(a_top);
Storyboard.SetTarget(a_top, this);
Storyboard.SetTargetProperty(a_top, new PropertyPath(Window.TopProperty));
await storyboard.BeginAsync();
await Task.Delay(0xbb8);
storyboard.Children.Clear();
storyboard.Children.Add(a_bottom);
Storyboard.SetTarget(a_bottom, this);
Storyboard.SetTargetProperty(a_bottom, new PropertyPath(Window.TopProperty));
await storyboard.BeginAsync();
this.Close();
}
示例2: SlideOut
private async Task SlideOut()
{
this.lvGames.IsHitTestVisible = false;
ThicknessAnimation a = new ThicknessAnimation {
From = 0.0,
To = new Thickness(0.0, this.Height, 0.0, 0.0),
Duration = new Duration(TimeSpan.FromSeconds(0.5))
};
Storyboard storyboard = new Storyboard();
storyboard.Children.Add(a);
Storyboard.SetTarget(a, this.lvGames);
Storyboard.SetTargetProperty(a, new PropertyPath(FrameworkElement.MarginProperty));
await storyboard.BeginAsync();
this.lvGames.Visibility = Visibility.Collapsed;
}