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


C# UIElement.AddHandler方法代码示例

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


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

示例1: EngineHandlerBase

    /// <summary>
    /// Initializes a new instance of the <see cref="EngineHandler"/> class.
    /// </summary>
    /// <param name="engineCreator">The function used to create an instance of the engine that actually recognizes the gesture.</param>
    /// <param name="trackedElement">The tracked element.</param>
    /// <param name="handleTouchEvent">if set to <c>true</c> then all touch events occurring on the tracked element will get e.Handled set to true to avoid further routing of the events.</param>
    public EngineHandlerBase(Func<IGestureEngine> engineCreator, UIElement trackedElement, bool handleTouchEvent = false)
    {
      this._engineCreator = engineCreator;
      this._trackedElement = trackedElement;
      this.HandlesTouchEvents = handleTouchEvent;
      trackedElement.AddHandler(UIElement.TouchDownEvent, new EventHandler<TouchEventArgs>(OnTrackedElementTouchDown), true);
      trackedElement.AddHandler(UIElement.TouchUpEvent, new EventHandler<TouchEventArgs>(OnTrackedElementTouchUp), true);
      trackedElement.AddHandler(UIElement.TouchMoveEvent, new EventHandler<TouchEventArgs>(OnTrackedElementTouchMove), true);


      //trackedElement.AddHandler(UIElement.MouseDownEvent, new EventHandler<MouseButtonEventArgs>(OnTrackedElementMouseDown));
      //trackedElement.AddHandler(UIElement.MouseUpEvent, new EventHandler<MouseButtonEventArgs>(OnTrackedElementMouseUp));
      //trackedElement.AddHandler(UIElement.MouseMoveEvent, new EventHandler<MouseButtonEventArgs>(OnTrackedElementMouseMove));

    }
开发者ID:TNOCS,项目名称:csTouch,代码行数:21,代码来源:EngineHandler.cs

示例2: RegisterEvent

        /// <summary>
        /// 注册事件
        /// </summary>
        /// <param name="element"></param>
        public void RegisterEvent(UIElement element)
        {
            if (element != null)
            {

                element.AddHandler(UIElement.MouseLeftButtonDownEvent, new MouseButtonEventHandler(ElementMouseDown), true);
            }
        }
开发者ID:SaintLoong,项目名称:PD,代码行数:12,代码来源:DoubleEventHelper.cs

示例3: AddPreviewExecutedHandler

        /// <summary>
        ///     Attaches the handler on the element.
        /// </summary>
        /// <param name="element">The element on which to attach the handler.</param>
        /// <param name="handler">The handler to attach.</param>
        public static void AddPreviewExecutedHandler(UIElement element, ExecutedRoutedEventHandler handler)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }
            if (handler == null)
            {
                throw new ArgumentNullException("handler");
            }

            element.AddHandler(PreviewExecutedEvent, handler);
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:18,代码来源:CommandManager.cs

示例4: CaptureThief

 // Methods
 public CaptureThief(UIElement element)
 {
     this.Owner = element;
     SetHasCaptureThief(this.Owner, true);
     element.AddHandler(UIElement.GotMouseCaptureEvent, new MouseEventHandler(this.OnGotMouseCapture), true);
     element.AddHandler(UIElement.GotTouchCaptureEvent, new EventHandler<TouchEventArgs>(this.OnGotTouchCapture), true);
     element.AddHandler(UIElement.MouseMoveEvent, new MouseEventHandler(this.OnMouseMove), true);
     element.AddHandler(UIElement.TouchMoveEvent, new EventHandler<TouchEventArgs>(this.OnTouchMove), true);
     element.AddHandler(UIElement.LostMouseCaptureEvent, new MouseEventHandler(this.OnLostMouseCapture), true);
     element.AddHandler(UIElement.LostTouchCaptureEvent, new EventHandler<TouchEventArgs>(this.OnLostTouchCapture), true);
 }
开发者ID:AmrReda,项目名称:PixelSenseLibrary,代码行数:12,代码来源:CaptureThief.cs

示例5: HexMouseProcessorCollection

		public HexMouseProcessorCollection(UIElement mouseElement, UIElement manipulationElement, DefaultHexMouseProcessor defaultMouseProcessor, HexMouseProcessor[] mouseProcessors, Func<MouseEventArgs, bool> allowEvent) {
			if (mouseElement == null)
				throw new ArgumentNullException(nameof(mouseElement));
			if (defaultMouseProcessor == null)
				throw new ArgumentNullException(nameof(defaultMouseProcessor));
			if (mouseProcessors == null)
				throw new ArgumentNullException(nameof(mouseProcessors));
			this.mouseElement = mouseElement;
			this.manipulationElement = manipulationElement;
			this.defaultMouseProcessor = defaultMouseProcessor;
			this.mouseProcessors = mouseProcessors;
			this.allowEvent = allowEvent ?? defaultAllowEvent;
			mouseElement.AddHandler(UIElement.QueryContinueDragEvent, new QueryContinueDragEventHandler(MouseElement_QueryContinueDrag), true);
			mouseElement.AddHandler(UIElement.MouseWheelEvent, new MouseWheelEventHandler(MouseElement_MouseWheel), true);
			mouseElement.AddHandler(UIElement.MouseUpEvent, new MouseButtonEventHandler(MouseElement_MouseUp), true);
			mouseElement.AddHandler(UIElement.MouseRightButtonUpEvent, new MouseButtonEventHandler(MouseElement_MouseRightButtonUp), true);
			mouseElement.AddHandler(UIElement.MouseRightButtonDownEvent, new MouseButtonEventHandler(MouseElement_MouseRightButtonDown), true);
			mouseElement.AddHandler(UIElement.MouseMoveEvent, new MouseEventHandler(MouseElement_MouseMove), true);
			mouseElement.AddHandler(UIElement.MouseLeftButtonUpEvent, new MouseButtonEventHandler(MouseElement_MouseLeftButtonUp), true);
			mouseElement.AddHandler(UIElement.MouseLeftButtonDownEvent, new MouseButtonEventHandler(MouseElement_MouseLeftButtonDown), true);
			mouseElement.AddHandler(UIElement.MouseLeaveEvent, new MouseEventHandler(MouseElement_MouseLeave), true);
			mouseElement.AddHandler(UIElement.MouseEnterEvent, new MouseEventHandler(MouseElement_MouseEnter), true);
			mouseElement.AddHandler(UIElement.MouseDownEvent, new MouseButtonEventHandler(MouseElement_MouseDown), true);
			mouseElement.AddHandler(UIElement.GiveFeedbackEvent, new GiveFeedbackEventHandler(MouseElement_GiveFeedback), true);
			mouseElement.AddHandler(UIElement.DropEvent, new DragEventHandler(MouseElement_Drop), true);
			mouseElement.AddHandler(UIElement.DragOverEvent, new DragEventHandler(MouseElement_DragOver), true);
			mouseElement.AddHandler(UIElement.DragLeaveEvent, new DragEventHandler(MouseElement_DragLeave), true);
			mouseElement.AddHandler(UIElement.DragEnterEvent, new DragEventHandler(MouseElement_DragEnter), true);
			if (manipulationElement != null) {
				manipulationElement.AddHandler(UIElement.TouchUpEvent, new EventHandler<TouchEventArgs>(ManipulationElement_TouchUp), true);
				manipulationElement.AddHandler(UIElement.TouchDownEvent, new EventHandler<TouchEventArgs>(ManipulationElement_TouchDown), true);
				manipulationElement.AddHandler(UIElement.StylusSystemGestureEvent, new StylusSystemGestureEventHandler(ManipulationElement_StylusSystemGesture), true);
				manipulationElement.AddHandler(UIElement.ManipulationStartingEvent, new EventHandler<ManipulationStartingEventArgs>(ManipulationElement_ManipulationStarting), true);
				manipulationElement.AddHandler(UIElement.ManipulationInertiaStartingEvent, new EventHandler<ManipulationInertiaStartingEventArgs>(ManipulationElement_ManipulationInertiaStarting), true);
				manipulationElement.AddHandler(UIElement.ManipulationDeltaEvent, new EventHandler<ManipulationDeltaEventArgs>(ManipulationElement_ManipulationDelta), true);
				manipulationElement.AddHandler(UIElement.ManipulationCompletedEvent, new EventHandler<ManipulationCompletedEventArgs>(ManipulationElement_ManipulationCompleted), true);
			}
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:38,代码来源:HexMouseProcessorCollection.cs

示例6: AddQueryInteractionStatusHandler

        /// <summary>
        /// Adds a handler for the QueryGripInteractionStatus attached event
        /// </summary>
        /// <param name="element">UIElement that listens to this event</param>
        /// <param name="handler">Event Handler to be added</param>
        public static void AddQueryInteractionStatusHandler(UIElement element, EventHandler<QueryInteractionStatusEventArgs> handler)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            element.AddHandler(KinectRegion.QueryInteractionStatusEvent, handler);
        }
开发者ID:dolphinlcj,项目名称:motion-paint,代码行数:14,代码来源:KinectRegion.cs

示例7: AddHandPointerLostCaptureHandler

        /// <summary>
        /// Adds a handler for the HandPointerLostCapture attached event
        /// </summary>
        /// <param name="element">UIElement that listens to this event</param>
        /// <param name="handler">Event Handler to be added</param>
        public static void AddHandPointerLostCaptureHandler(UIElement element, EventHandler<HandPointerEventArgs> handler)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            element.AddHandler(KinectRegion.HandPointerLostCaptureEvent, handler);
        }
开发者ID:dolphinlcj,项目名称:motion-paint,代码行数:14,代码来源:KinectRegion.cs

示例8: Relay

        public static void Relay(UIElement element)
        {
            element.AddHandler(CommandManager.ExecutedEvent, new RoutedEventHandler(HandleExecute), true);
            element.AddHandler(CommandManager.CanExecuteEvent, new RoutedEventHandler(HandleCanExecute), true);

            element.AddHandler(CommandManager.PreviewExecutedEvent, new RoutedEventHandler(HandlePreviewExecute), true);
            element.AddHandler(CommandManager.PreviewCanExecuteEvent, new RoutedEventHandler(HandlePreviewCanExecute), true);
        }
开发者ID:lucaslra,项目名称:SPM,代码行数:8,代码来源:MessengerBinding.cs

示例9: AddClearPropertyItemHandler

 /// <summary>
 /// Adds a handler for the ClearPropertyItem attached event
 /// </summary>
 /// <param name="element">the element to attach the handler</param>
 /// <param name="handler">the handler for the event</param>
 public static void AddClearPropertyItemHandler( UIElement element, PropertyItemEventHandler handler )
 {
   element.AddHandler( PropertyGrid.ClearPropertyItemEvent, handler );
 }
开发者ID:Gainedge,项目名称:BetterExplorer,代码行数:9,代码来源:PropertyGrid.cs

示例10: AddPreparePropertyItemHandler

 /// <summary>
 /// Adds a handler for the PreparePropertyItem attached event
 /// </summary>
 /// <param name="element">the element to attach the handler</param>
 /// <param name="handler">the handler for the event</param>
 public static void AddPreparePropertyItemHandler( UIElement element, PropertyItemEventHandler handler )
 {
   element.AddHandler( PropertyGrid.PreparePropertyItemEvent, handler );
 }
开发者ID:Gainedge,项目名称:BetterExplorer,代码行数:9,代码来源:PropertyGrid.cs

示例11: AddCanExecuteHandler

        /// <summary>
        ///     Attaches the handler on the element.
        /// </summary>
        /// <param name="element">The element on which to attach the handler.</param>
        /// <param name="handler">The handler to attach.</param>
        public static void AddCanExecuteHandler(UIElement element, CanExecuteRoutedEventHandler handler)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }
            if (handler == null)
            {
                throw new ArgumentNullException("handler");
            }

            element.AddHandler(CanExecuteEvent, handler);
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:18,代码来源:CommandManager.cs

示例12: PairExpanded

 public static void PairExpanded(this TreeViewItem item, UIElement pairToObject, RoutedEvent pairToExpandEvent, RoutedEvent pairToCollapseEvent, DependencyProperty pairToProperty)
 {
     item.AddSelfExpanded((sender, args) => pairToObject.SetValue(pairToProperty, true));
     item.AddSelfCollapsed((sender, args) => pairToObject.SetValue(pairToProperty, false));
     pairToObject.SetValue(pairToProperty, item.IsExpanded);
     pairToObject.AddHandler(pairToExpandEvent, new RoutedEventHandler((sender, args) => item.IsExpanded = true));
     pairToObject.AddHandler(pairToCollapseEvent, new RoutedEventHandler((sender, args) => item.IsExpanded = false));
 }
开发者ID:kswoll,项目名称:restless,代码行数:8,代码来源:TreeViewExtensions.cs


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