コード例 #1
0
        public static void RemoveEventHandler(DependencyObject element, RoutedEvent routedEvent, Delegate handler)
        {
            UIElement uiElement = element as UIElement;

            if (uiElement != null)
            {
                uiElement.RemoveHandler(routedEvent, handler);
            }
            else
            {
                ContentElement contentElement = element as ContentElement;
                if (contentElement != null)
                {
                    contentElement.RemoveHandler(routedEvent, handler);
                }
                else
                {
                    UIElement3D uiElement3d = element as UIElement3D;
                    if (uiElement3d != null)
                    {
                        uiElement3d.RemoveHandler(routedEvent, handler);
                    }
                }
            }
        }
コード例 #2
0
ファイル: Helper.cs プロジェクト: pentest30/MenuRibbon
        public static void RemoveHandler(this DependencyObject element, RoutedEvent routedEvent, Delegate handler)
        {
            Debug.Assert(element != null, "Element must not be null");
            Debug.Assert(routedEvent != null, "RoutedEvent must not be null");

            UIElement uiElement = element as UIElement;

            if (uiElement != null)
            {
                uiElement.RemoveHandler(routedEvent, handler);
            }
            else
            {
                ContentElement contentElement = element as ContentElement;
                if (contentElement != null)
                {
                    contentElement.RemoveHandler(routedEvent, handler);
                }
                else
                {
                    UIElement3D uiElement3D = element as UIElement3D;
                    if (uiElement3D != null)
                    {
                        uiElement3D.RemoveHandler(routedEvent, handler);
                    }
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// A static helper method that removes a handler for a routed event
        /// from a target UIElement or ContentElement.
        /// </summary>
        /// <param name="element">UIElement or ContentElement that listens to the event</param>
        /// <param name="routedEvent">Event that will no longer be handled</param>
        /// <param name="handler">Event handler to be removed</param>
        internal static void RemoveHandler(DependencyObject element, RoutedEvent routedEvent, Delegate handler)
        {
            UIElement uie = element as UIElement;

            if (uie != null)
            {
                uie.RemoveHandler(routedEvent, handler);
            }
            else
            {
                ContentElement ce = element as ContentElement;
                ce?.RemoveHandler(routedEvent, handler);
            }
        }
コード例 #4
0
ファイル: Class0.cs プロジェクト: wangzhaoming/HearthBuddy
        internal static void smethod_2(DependencyObject dependencyObject_0, RoutedEvent routedEvent_0, Delegate delegate_0)
        {
            UIElement element = dependencyObject_0 as UIElement;

            if (element != null)
            {
                element.RemoveHandler(routedEvent_0, delegate_0);
            }
            else
            {
                ContentElement element2 = dependencyObject_0 as ContentElement;
                if (element2 != null)
                {
                    element2.RemoveHandler(routedEvent_0, delegate_0);
                }
            }
        }