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


C# UIElement.SetValue方法代码示例

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


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

示例1: StartAnimation

        /// <summary>
        /// Starts an animation to a particular value on the specified dependency property.
        /// You can pass in an event handler to call when the animation has completed.
        /// </summary>
        public static void StartAnimation(UIElement animatableElement, DependencyProperty dependencyProperty, double toValue, double animationDurationSeconds, EventHandler completedEvent)
        {
            #if !SILVERLIGHT
            double fromValue = (double)animatableElement.GetValue(dependencyProperty);

            DoubleAnimation animation = new DoubleAnimation();
            animation.From = fromValue;
            animation.To = toValue;
            animation.Duration = TimeSpan.FromSeconds(animationDurationSeconds);

            animation.Completed += delegate(object sender, EventArgs e)
            {
                //
                // When the animation has completed bake final value of the animation
                // into the property.
                //
                animatableElement.SetValue(dependencyProperty, animatableElement.GetValue(dependencyProperty));
                CancelAnimation(animatableElement, dependencyProperty);

                if (completedEvent != null)
                {
                    completedEvent(sender, e);
                }
            };

            animation.Freeze();

            animatableElement.BeginAnimation(dependencyProperty, animation);
            #else
            animatableElement.SetValue(dependencyProperty, toValue);
            #endif
        }
开发者ID:Zoomicon,项目名称:ZUI,代码行数:36,代码来源:AnimationHelper.cs

示例2: SetRegistration

 public static void SetRegistration(UIElement element, CommandBindingCollection value)
 {
     if (element != null)
     {
         element.SetValue(Registration, value);
     }
 }
开发者ID:nguerrera,项目名称:xunit.runner.wpf,代码行数:7,代码来源:CommandBindings.cs

示例3: StartAnimation

        /// <summary>
        /// Starts an animation to a particular value on the specified dependency property.
        /// You can pass in an event handler to call when the animation has completed.
        /// </summary>
        /// <param name="pAnimatableElement">The gui element to animate.</param>
        /// <param name="pDependencyProperty">The dependency property to animate.</param>
        /// <param name="pToValue">The final value of the dependency property.</param>
        /// <param name="pAnimationDurationSeconds">The animation duration.</param>
        /// <param name="pCompletedEvent">The callback executed when the animation ended.</param>
        public static void StartAnimation(UIElement pAnimatableElement, DependencyProperty pDependencyProperty, double pToValue, double pAnimationDurationSeconds, EventHandler pCompletedEvent)
        {
            double lFromValue = (double)pAnimatableElement.GetValue(pDependencyProperty);

            DoubleAnimation lAnimation = new DoubleAnimation();
            lAnimation.From = lFromValue;
            lAnimation.To = pToValue;
            lAnimation.Duration = TimeSpan.FromSeconds(pAnimationDurationSeconds);

            lAnimation.Completed += delegate(object pSender, EventArgs pEventArgs)
            {
                //
                // When the animation has completed bake final value of the animation
                // into the property.
                //
                pAnimatableElement.SetValue(pDependencyProperty, pAnimatableElement.GetValue(pDependencyProperty));
                CancelAnimation(pAnimatableElement, pDependencyProperty);

                if (pCompletedEvent != null)
                {
                    pCompletedEvent(pSender, pEventArgs);
                }
            };

            lAnimation.Freeze();

            pAnimatableElement.BeginAnimation(pDependencyProperty, lAnimation);
        }
开发者ID:mastertnt,项目名称:XRay,代码行数:37,代码来源:AnimationHelper.cs

示例4: SetCommand

 /// <summary>
 /// Sets the command property.
 /// </summary>
 /// <param name="element">The element.</param>
 /// <param name="value">The value.</param>
 public static void SetCommand(UIElement element, ICommand value)
 {
     if (element != null)
     {
         element.SetValue(CommandProperty, value);
     }
 }
开发者ID:yovannyr,项目名称:PropertyTools,代码行数:12,代码来源:ScreenGrab.cs

示例5: StartAnimation

        /// <summary>
        /// Starts an animation to a particular value on the specified dependency property.
        /// You can pass in an event handler to call when the animation has completed.
        /// </summary>
        public static void StartAnimation(UIElement animationElement, DependencyProperty dependencyProperty, double toValue, double animationDurationSeconds, EventHandler completedEvent)
        {
            if (animationElement == null)
            {
                throw new ArgumentNullResourceException("animationElement", Resources.General_Given_Parameter_Cannot_Be_Null);
            }

            var fromValue = (double)animationElement.GetValue(dependencyProperty);

            var animation = new DoubleAnimation { From = fromValue, To = toValue, Duration = TimeSpan.FromSeconds(animationDurationSeconds) };

            animation.Completed += (sender, e) =>
                                       {
                                           // When the animation has completed bake final value of the animation
                                           // into the property.
                                           animationElement.SetValue(dependencyProperty, animationElement.GetValue(dependencyProperty));
                                           CancelAnimation(animationElement, dependencyProperty);

                                           if (completedEvent != null)
                                           {
                                               completedEvent(sender, e);
                                           }
                                       };

            animation.Freeze();

            animationElement.BeginAnimation(dependencyProperty, animation);
        }
开发者ID:Benrnz,项目名称:TypeVisualiser,代码行数:32,代码来源:AnimationHelper.cs

示例6: SetIsEdit

 public static void SetIsEdit(UIElement uiElement, bool value)
 {
     if (uiElement == null)
     {
         throw new ArgumentNullException("uiElement");
     }
     uiElement.SetValue(IsEditProperty, value);
 }
开发者ID:Esri,项目名称:arcgis-viewer-silverlight,代码行数:8,代码来源:LayerExtensions.cs

示例7: SetSortDirection

        public static void SetSortDirection(UIElement element, ListSortDirection? value)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            element.SetValue(SortDirectionProperty, value);
        }
开发者ID:HexWrench,项目名称:VisualHG2015,代码行数:9,代码来源:AttachedProperty.cs

示例8: SetContextMenu

        /// <summary>
        /// Sets the value of the Menu attached property to a given DependencyObject. 
        /// </summary>
        /// <param name="control">The element on which to set the property value.</param>
        /// <param name="menu">The property value to set.</param>
        public static void SetContextMenu(UIElement control, Menu menu)
        {
            // preconditions

            Argument.IsNotNull("control", control);

            // implementation

            control.SetValue(ContextMenuProperty, menu);
        }
开发者ID:adamwyss,项目名称:slexplorer,代码行数:15,代码来源:RightClick.cs

示例9: SetInputBindings

 public static void SetInputBindings( UIElement element, InputBindingCollection inputBindings )
 {
     element.SetValue( InputBindingsProperty, inputBindings );
 }
开发者ID:JackWangCUMT,项目名称:Plainion,代码行数:4,代码来源:InputBindingsExtension.cs

示例10: SetParameter

 public static void SetParameter(UIElement element, object parameter)
 {
     element.SetValue(OnParameterProperty, parameter);
 }
开发者ID:RonaldValkenburg,项目名称:NDragDrop,代码行数:4,代码来源:DropTarget.cs

示例11: SetDropDataType

 public static void SetDropDataType(UIElement element, string type)
 {
     element.SetValue(DropDataTypeProperty, type);
 }
开发者ID:RonaldValkenburg,项目名称:NDragDrop,代码行数:4,代码来源:DropTarget.cs

示例12: SetIsMouseOverDispatcherTimer

 private static void SetIsMouseOverDispatcherTimer(UIElement element, DispatcherTimer value)
 {
     element.SetValue(IsMouseOverDispatcherTimerProperty, value);
 }
开发者ID:grarup,项目名称:SharpE,代码行数:4,代码来源:MouseHelper.cs

示例13: SetMouseScrollUp

 public static void SetMouseScrollUp(UIElement element, ICommand value)
 {
     element.SetValue(MouseScrollUpProperty, value);
 }
开发者ID:grarup,项目名称:SharpE,代码行数:4,代码来源:MouseHelper.cs

示例14: SetIgnoreIsMouseDown

 public static void SetIgnoreIsMouseDown(UIElement element, bool value)
 {
     element.SetValue(IgnoreIsMouseDownProperty, value);
 }
开发者ID:grarup,项目名称:SharpE,代码行数:4,代码来源:MouseHelper.cs

示例15: SetMagnifier

 public static void SetMagnifier(UIElement element, Magnifier value)
 {
     element.SetValue(CurrentProperty, value);
 }
开发者ID:zzilla,项目名称:ONVIF-Device-Manager,代码行数:4,代码来源:MagnifierManager.cs


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