예제 #1
0
        private void OnContextMenuClosed(object source, RoutedEventArgs e)
        {
            ContextMenu cm = source as ContextMenu;

            if (cm != null)
            {
                cm.Closed -= OnContextMenuClosed;

                DependencyObject o = (DependencyObject)cm.GetValue(OwnerProperty);
                if (o != null)
                {
                    cm.ClearValue(OwnerProperty);

                    UIElement uie = GetTarget(o);
                    if (uie != null)
                    {
                        if (!IsPresentationSourceNull(uie))
                        {
                            IInputElement        inputElement = (o is ContentElement || o is UIElement3D) ? (IInputElement)o : (IInputElement)uie;
                            ContextMenuEventArgs args         = new ContextMenuEventArgs(inputElement, false /*opening */);
                            inputElement.RaiseEvent(args);
                        }
                    }
                }
            }
        }
예제 #2
0
        private void OnContextMenuClosed(object source, RoutedEventArgs e)
        {
            ContextMenu contextMenu = source as ContextMenu;

            if (contextMenu != null)
            {
                contextMenu.Closed -= new RoutedEventHandler(this.OnContextMenuClosed);
                DependencyObject dependencyObject = (DependencyObject)contextMenu.GetValue(PopupControlService.OwnerProperty);
                if (dependencyObject != null)
                {
                    contextMenu.ClearValue(PopupControlService.OwnerProperty);
                    UIElement target = PopupControlService.GetTarget(dependencyObject);
                    if (target != null && !PopupControlService.IsPresentationSourceNull(target))
                    {
                        object arg_6A_0;
                        if (!(dependencyObject is ContentElement) && !(dependencyObject is UIElement3D))
                        {
                            IInputElement inputElement = target;
                            arg_6A_0 = inputElement;
                        }
                        else
                        {
                            arg_6A_0 = (IInputElement)dependencyObject;
                        }
                        object expr_6A          = arg_6A_0;
                        ContextMenuEventArgs e2 = new ContextMenuEventArgs(expr_6A, false);
                        ((IInputElement)expr_6A).RaiseEvent(e2);
                    }
                }
            }
        }
예제 #3
0
        // Token: 0x060053F2 RID: 21490 RVA: 0x001745F0 File Offset: 0x001727F0
        private void OnContextMenuClosed(object source, RoutedEventArgs e)
        {
            ContextMenu contextMenu = source as ContextMenu;

            if (contextMenu != null)
            {
                contextMenu.Closed -= this.OnContextMenuClosed;
                DependencyObject dependencyObject = (DependencyObject)contextMenu.GetValue(PopupControlService.OwnerProperty);
                if (dependencyObject != null)
                {
                    contextMenu.ClearValue(PopupControlService.OwnerProperty);
                    UIElement target = PopupControlService.GetTarget(dependencyObject);
                    if (target != null && !PopupControlService.IsPresentationSourceNull(target))
                    {
                        IInputElement inputElement2;
                        if (!(dependencyObject is ContentElement) && !(dependencyObject is UIElement3D))
                        {
                            IInputElement inputElement = target;
                            inputElement2 = inputElement;
                        }
                        else
                        {
                            inputElement2 = (IInputElement)dependencyObject;
                        }
                        IInputElement        inputElement3 = inputElement2;
                        ContextMenuEventArgs e2            = new ContextMenuEventArgs(inputElement3, false);
                        inputElement3.RaiseEvent(e2);
                    }
                }
            }
        }