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


C# UIElement.RemoveHandler方法代码示例

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


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

示例1: RemoveEvent

 /// <summary>
 /// 注销事件
 /// </summary>
 /// <param name="element"></param>
 public void RemoveEvent(UIElement element)
 {
     if (element != null)
     {
         element.RemoveHandler(UIElement.MouseLeftButtonDownEvent, new MouseButtonEventHandler(ElementMouseDown));
     }
 }
开发者ID:SaintLoong,项目名称:PD,代码行数:11,代码来源:DoubleEventHelper.cs

示例2: RemoveRoutedEventHandlers

        /// <summary>
        /// Removes all event handlers subscribed to the specified routed event from the specified element.
        /// See http://stackoverflow.com/questions/6828054
        /// </summary>
        /// <param name="element">The UI element on which the routed event is defined.</param>
        /// <param name="routedEvent">The routed event for which to remove the event handlers.</param>
        public static void RemoveRoutedEventHandlers(UIElement element, RoutedEvent routedEvent)
        {
            // Get the EventHandlersStore instance which holds event handlers for the specified element.
              // The EventHandlersStore class is declared as internal.
              var eventHandlersStoreProperty = typeof(UIElement).GetProperty("EventHandlersStore",
            BindingFlags.Instance | BindingFlags.NonPublic);
              object eventHandlersStore = eventHandlersStoreProperty.GetValue(element, null);

              // Invoke the GetRoutedEventHandlers method on the EventHandlersStore instance
              // for getting an array of the subscribed event handlers.
              var getRoutedEventHandlers = eventHandlersStore.GetType().GetMethod("GetRoutedEventHandlers",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
              var routedEventHandlers = (RoutedEventHandlerInfo[])getRoutedEventHandlers.Invoke(
            eventHandlersStore, new object[] { routedEvent });

              // Iteratively remove all routed event handlers from the element.
              if (routedEventHandlers != null && routedEventHandlers.Length != 0)
            foreach (var routedEventHandler in routedEventHandlers)
              element.RemoveHandler(routedEvent, routedEventHandler.Handler);
        }
开发者ID:birbilis,项目名称:Hotspotizer,代码行数:26,代码来源:EventLogic.cs

示例3: RemoveQueryInteractionStatusHandler

        /// <summary>
        /// Removes 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 removed</param>
        public static void RemoveQueryInteractionStatusHandler(UIElement element, EventHandler<QueryInteractionStatusEventArgs> handler)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

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

示例4: RemoveHandPointerLostCaptureHandler

        /// <summary>
        /// Removes 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 removed</param>
        public static void RemoveHandPointerLostCaptureHandler(UIElement element, EventHandler<HandPointerEventArgs> handler)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

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

示例5: RemoveClearPropertyItemHandler

 /// <summary>
 /// Removes 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 RemoveClearPropertyItemHandler( UIElement element, PropertyItemEventHandler handler )
 {
   element.RemoveHandler( PropertyGrid.ClearPropertyItemEvent, handler );
 }
开发者ID:Gainedge,项目名称:BetterExplorer,代码行数:9,代码来源:PropertyGrid.cs

示例6: RemovePreviewExecutedHandler

        /// <summary>
        ///     Removes the handler from the element.
        /// </summary>
        /// <param name="element">The element from which to remove the handler.</param>
        /// <param name="handler">The handler to remove.</param>
        public static void RemovePreviewExecutedHandler(UIElement element, ExecutedRoutedEventHandler handler)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }
            if (handler == null)
            {
                throw new ArgumentNullException("handler");
            }

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


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