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


C# FrameworkElement.SetCurrentValue方法代码示例

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


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

示例1: Apply

 public void Apply(FrameworkElement frameworkElement)
 {
     if (frameworkElement == null) throw new ArgumentNullException("frameworkElement");
     
     frameworkElement.SetCurrentValue(FrameworkElement.WidthProperty, _width);
     frameworkElement.SetCurrentValue(FrameworkElement.HeightProperty, _height);
 }
开发者ID:CensoredHF,项目名称:Snappie,代码行数:7,代码来源:LocationSnapShot.cs

示例2: UpdateObservedSizesForFrameworkElement

        private static void UpdateObservedSizesForFrameworkElement(FrameworkElement frameworkElement)
        {
            // WPF 4.0 onwards
            frameworkElement.SetCurrentValue(ObservedWidthProperty, frameworkElement.ActualWidth);
            frameworkElement.SetCurrentValue(ObservedHeightProperty, frameworkElement.ActualHeight);

            // WPF 3.5 and prior
            ////SetObservedWidth(frameworkElement, frameworkElement.ActualWidth);
            ////SetObservedHeight(frameworkElement, frameworkElement.ActualHeight);
        }
开发者ID:AlternateIf,项目名称:huddle-engine,代码行数:10,代码来源:SizeObserver.cs

示例3: UpdateObservedSizesForFrameworkElement

 private static void UpdateObservedSizesForFrameworkElement(FrameworkElement frameworkElement)
 {
     frameworkElement.SetCurrentValue(ObservedWidthProperty, frameworkElement.ActualWidth);
     frameworkElement.SetCurrentValue(ObservedHeightProperty, frameworkElement.ActualHeight);
 }
开发者ID:jcw-,项目名称:MiningController,代码行数:5,代码来源:SizeObserverBehavior.cs

示例4: CreateEntryAnimation

            public Storyboard CreateEntryAnimation(FrameworkElement animatedObject, double xDelta, double yDelta)
            {
                var translateTransform = animatedObject.RenderTransform as TranslateTransform;

                animatedObject.Opacity = 0.0;
                animatedObject.SetCurrentValue(FrameworkElement.OpacityProperty, 0.0);

                if (translateTransform == null)
                {
                    animatedObject.RenderTransform = translateTransform = new TranslateTransform(xDelta, yDelta);
                }
                else
                {
                    translateTransform.SetCurrentValue(TranslateTransform.XProperty, translateTransform.X + xDelta);
                    translateTransform.SetCurrentValue(TranslateTransform.YProperty, translateTransform.X + yDelta);
                }

                var storyboard = new Storyboard { FillBehavior = FillBehavior.Stop };

                var animationOpacity = new DoubleAnimation
                {
                    Duration = _exitDuration,
                    BeginTime = CalculateStagger(),
                    From = 0,
                    To = 1,
                    EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut }
                };

                Storyboard.SetTarget(animationOpacity, animatedObject);
                Storyboard.SetTargetProperty(animationOpacity, new PropertyPath(UIElement.OpacityProperty));
                storyboard.Children.Add(animationOpacity);

                var animationX = new DoubleAnimation
                {
                    Duration = _exitDuration,
                    BeginTime = CalculateStagger(),
                    To = 0,                    
                    EasingFunction = new CubicEase { EasingMode = EasingMode.EaseOut }
                };

                Storyboard.SetTarget(animationX, animatedObject);
                Storyboard.SetTargetProperty(animationX, new PropertyPath("(UIElement.RenderTransform).(TranslateTransform.X)"));
                storyboard.Children.Add(animationX);

                var animationY = new DoubleAnimation
                {
                    Duration = _exitDuration,
                    BeginTime = CalculateStagger(),
                    To = 0,
                    EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut }
                };

                Storyboard.SetTarget(animationY, animatedObject);
                Storyboard.SetTargetProperty(animationY, new PropertyPath("(UIElement.RenderTransform).(TranslateTransform.Y)"));
                storyboard.Children.Add(animationY);

                storyboard.Completed += (s, e) =>
                {
                    animatedObject.Opacity = 1.0;
                    translateTransform.X = translateTransform.X;
                    translateTransform.Y = translateTransform.Y;
                };

                return storyboard;
            }
开发者ID:TheFabFab,项目名称:ObservableLinq,代码行数:65,代码来源:AnimationManager.cs


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