当前位置: 首页>>代码示例>>C#>>正文


C# ListBox.BeginAnimation方法代码示例

本文整理汇总了C#中System.Windows.Controls.ListBox.BeginAnimation方法的典型用法代码示例。如果您正苦于以下问题:C# ListBox.BeginAnimation方法的具体用法?C# ListBox.BeginAnimation怎么用?C# ListBox.BeginAnimation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Controls.ListBox的用法示例。


在下文中一共展示了ListBox.BeginAnimation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Restore

 private void Restore(ListBox menu)
 {
     menu.IsEnabled = false;
     menu.Visibility = Visibility.Visible;
     var breadcrumbItem = BreadcrumbContainer.Items.Count > 0
         ? (ListBoxItem)BreadcrumbContainer.Items[BreadcrumbContainer.Items.Count - 1]
         : null;
     Point
         origin = new Point(0, 0),
         menuPoint = menu.TranslatePoint(origin, this),
         breadcrumbPoint = breadcrumbItem == null ? origin : breadcrumbItem.TranslatePoint(origin, this)
     ;
     var duration = new Duration(TimeSpan.FromMilliseconds(300));
     DoubleAnimation
         posXAnimation = new DoubleAnimation { Duration = duration, From = breadcrumbPoint.X - menuPoint.X },
         posYAnimation = new DoubleAnimation { Duration = duration, From = breadcrumbPoint.Y - menuPoint.Y },
         scaleXAnimation = new DoubleAnimation { Duration = duration, From = 0.3 },
         scaleYAnimation = new DoubleAnimation { Duration = duration, From = 0.3 },
         opacityAnimation = new DoubleAnimation { Duration = duration, From = 0 }
     ;
     var translateTransform = ((TransformGroup)menu.RenderTransform).Children[0];
     var scaleTransform = ((TransformGroup)menu.RenderTransform).Children[1];
     translateTransform.BeginAnimation(TranslateTransform.XProperty, posXAnimation);
     translateTransform.BeginAnimation(TranslateTransform.YProperty, posYAnimation);
     scaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, scaleXAnimation);
     scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, scaleYAnimation);
     opacityAnimation.Completed += (object sender, EventArgs e) =>
     {
         menu.IsEnabled = true;
         translateTransform.BeginAnimation(TranslateTransform.XProperty, null);
         translateTransform.BeginAnimation(TranslateTransform.YProperty, null);
         scaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, null);
         scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, null);
         menu.BeginAnimation(OpacityProperty, null);
     };
     menu.BeginAnimation(OpacityProperty, opacityAnimation);
 }
开发者ID:kpozin,项目名称:kinect_menu,代码行数:37,代码来源:MainWindow.xaml.cs

示例2: Discard

 private void Discard(ListBox menu)
 {
     menu.IsEnabled = false;
     var duration = new Duration(TimeSpan.FromMilliseconds(400));
     DoubleAnimation
         posXAnimation = new DoubleAnimation { Duration = duration, To = -80 },
         posYAnimation = new DoubleAnimation { Duration = duration, To = -80 },
         scaleXAnimation = new DoubleAnimation { Duration = duration, To = 1.5 },
         scaleYAnimation = new DoubleAnimation { Duration = duration, To = 1.5 },
         opacityAnimation = new DoubleAnimation { Duration = duration, To = 0 }
     ;
     var translateTransform = ((TransformGroup)menu.RenderTransform).Children[0];
     var scaleTransform = ((TransformGroup)menu.RenderTransform).Children[1];
     translateTransform.BeginAnimation(TranslateTransform.XProperty, posXAnimation);
     translateTransform.BeginAnimation(TranslateTransform.YProperty, posYAnimation);
     scaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, scaleXAnimation);
     scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, scaleYAnimation);
     opacityAnimation.Completed += (object sender, EventArgs e) =>
     {
         menu.Visibility = Visibility.Collapsed;
         menu.IsEnabled = true;
         translateTransform.BeginAnimation(TranslateTransform.XProperty, null);
         translateTransform.BeginAnimation(TranslateTransform.YProperty, null);
         scaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, null);
         scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, null);
         menu.BeginAnimation(OpacityProperty, null);
     };
     menu.BeginAnimation(OpacityProperty, opacityAnimation);
 }
开发者ID:kpozin,项目名称:kinect_menu,代码行数:29,代码来源:MainWindow.xaml.cs

示例3: MenuAnimation

        static public void MenuAnimation(DoubleAnimation animation, ListBox lb, DependencyProperty dp, int size)
        {
            animation.To = size;

            lb.BeginAnimation(dp, animation, HandoffBehavior.Compose);
        }
开发者ID:gawallsibya,项目名称:BIT_TeamProject,代码行数:6,代码来源:MyAnimation.cs


注:本文中的System.Windows.Controls.ListBox.BeginAnimation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。