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


C# UIElement.GetValue方法代码示例

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


在下文中一共展示了UIElement.GetValue方法的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)
        {
            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);
        }
开发者ID:modopotato,项目名称:LibnoiseDesigner,代码行数:32,代码来源:AnimationHelper.cs

示例2: 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

示例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>
        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

示例4: GetGroupRecordInfo

        public static GroupRecord GetGroupRecordInfo(UIElement element)
        {
            if (element == null)
                return null;

            return (GroupRecord)element.GetValue(GroupRecordInfoProperty);
        }
开发者ID:mparsin,项目名称:Elements,代码行数:7,代码来源:GroupRowPropertySupplier.cs

示例5: GetCommandBindings

        /// <summary>
        ///   Gets the command bindings.
        /// </summary>
        /// 
        public static CommandBindingCollection GetCommandBindings(UIElement element)
        {
            if (element == null)
                return null;

            return (CommandBindingCollection)element.GetValue(RegisterCommandBindingsProperty);
        }
开发者ID:amurshed,项目名称:statistics-workbench,代码行数:11,代码来源:AttachedProperties.cs

示例6: GetNavigationOutTransition

 /// <summary>
 /// Gets the
 /// <see cref="T:Microsoft.Phone.Controls.NavigationTransition"/>s
 /// of
 /// <see cref="M:Microsoft.Phone.Controls.TransitionService.NavigationOutTransitionProperty"/>
 /// for a
 /// <see cref="T:System.Windows.UIElement"/>.
 /// </summary>
 /// <param name="element">The <see cref="T:System.Windows.UIElement"/>.</param>
 /// <returns>The </returns>
 public static NavigationOutTransition GetNavigationOutTransition(UIElement element)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     return (NavigationOutTransition)element.GetValue(NavigationOutTransitionProperty);
 }
开发者ID:kazyx,项目名称:WP8Toolkit,代码行数:18,代码来源:TransitionService.cs

示例7: GetIsEdit

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

示例8: GetSortDirection

        public static ListSortDirection? GetSortDirection(UIElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

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

示例9: GetFocusedChild

		public static IInputElement GetFocusedChild(UIElement element)
		{
			if (element == null)
				throw new ArgumentNullException("element");
			WeakReference r = (WeakReference)element.GetValue(FocusedChildProperty);
			if (r != null)
				return (IInputElement)r.Target;
			else
				return null;
		}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:10,代码来源:CustomFocusManager.cs

示例10: GetContextMenu

        /// <summary>
        /// Gets the value of the Menu attached property from a given DependencyObject. 
        /// </summary>
        /// <param name="control">The element from which to read the property value.</param>
        /// <returns>The value of the Menu attached property.</returns>
        public static Menu GetContextMenu(UIElement control)
        {
            // preconditions

            Argument.IsNotNull("control", control);

            // implementation

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

示例11: GetMouseScrollUp

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

示例12: GetPreviewDropCommand

 public static ICommand GetPreviewDropCommand(UIElement obj)
 {
     return (ICommand)obj.GetValue(PreviewDropCommandProperty);
 }
开发者ID:BrokenGlass,项目名称:AsfMojo,代码行数:4,代码来源:DropBehavior.cs

示例13: GetMouseDoubleClick

 public static ICommand GetMouseDoubleClick(UIElement element)
 {
     return (ICommand)element.GetValue(MouseDoubleClickProperty);
 }
开发者ID:grarup,项目名称:SharpE,代码行数:4,代码来源:MouseHelper.cs

示例14: GetMouseClicktoggleBool

 public static bool? GetMouseClicktoggleBool(UIElement element)
 {
     return (bool?)element.GetValue(MouseClicktoggleBoolProperty);
 }
开发者ID:grarup,项目名称:SharpE,代码行数:4,代码来源:MouseHelper.cs

示例15: GetMouseActions

 public static MouseActionCollection GetMouseActions(UIElement element)
 {
     return (MouseActionCollection)element.GetValue(MouseActionsProperty);
 }
开发者ID:grarup,项目名称:SharpE,代码行数:4,代码来源:MouseHelper.cs


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