Exemplo n.º 1
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);
                    }
                }
            }
        }
Exemplo n.º 2
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);
                    }
                }
            }
        }
Exemplo n.º 3
0
        internal static object CoerceProperty(DependencyObject o, object value, DependencyProperty dp)
        {
            DependencyObject dependencyObject = (DependencyObject)o.GetValue(PopupControlService.OwnerProperty);

            if (dependencyObject != null)
            {
                bool flag;
                if (dependencyObject.GetValueSource(dp, null, out flag) != BaseValueSourceInternal.Default | flag)
                {
                    return(dependencyObject.GetValue(dp));
                }
                if (dp == ToolTip.PlacementTargetProperty || dp == ContextMenu.PlacementTargetProperty)
                {
                    UIElement target = PopupControlService.GetTarget(dependencyObject);
                    if (target != null)
                    {
                        return(target);
                    }
                }
            }
            return(value);
        }