Exemplo n.º 1
0
        private static void OnOverflowOpenChanged(DependencyObject element, DependencyPropertyChangedEventArgs e)
        {
            ToolBar toolBar = (ToolBar)element;

            if ((bool)e.NewValue)
            {
                // When the drop down opens, take capture
                Mouse.Capture(toolBar, CaptureMode.SubTree);
                toolBar.SetFocusOnToolBarOverflowPanel();
            }
            else
            {
                // If focus is still within the ToolBarOverflowPanel, make sure we the focus is restored to the main focus scope
                ToolBarOverflowPanel overflow = toolBar.ToolBarOverflowPanel;
                if (overflow != null && overflow.IsKeyboardFocusWithin)
                {
                    Keyboard.Focus(null);
                }

                if (Mouse.Captured == toolBar)
                {
                    Mouse.Capture(null);
                }
            }

            toolBar.CoerceValue(ToolTipService.IsEnabledProperty);
        }
Exemplo n.º 2
0
        // Token: 0x0600581D RID: 22557 RVA: 0x001867C0 File Offset: 0x001849C0
        private static void OnOverflowOpenChanged(DependencyObject element, DependencyPropertyChangedEventArgs e)
        {
            ToolBar toolBar = (ToolBar)element;

            if ((bool)e.NewValue)
            {
                Mouse.Capture(toolBar, CaptureMode.SubTree);
                toolBar.SetFocusOnToolBarOverflowPanel();
            }
            else
            {
                ToolBarOverflowPanel toolBarOverflowPanel = toolBar.ToolBarOverflowPanel;
                if (toolBarOverflowPanel != null && toolBarOverflowPanel.IsKeyboardFocusWithin)
                {
                    Keyboard.Focus(null);
                }
                if (Mouse.Captured == toolBar)
                {
                    Mouse.Capture(null);
                }
            }
            toolBar.CoerceValue(ToolTipService.IsEnabledProperty);
        }