private void SetScopeTarget(KeyEventArgs e) { if (_scopeTarget != null) { return; } var keyBinding = GetKeyBinding(e); if (keyBinding == null) { return; } var shortCutCommand = keyBinding.Command as ShortCutCommand; if (shortCutCommand != null && shortCutCommand.Item != null) { try { var item = shortCutCommand.Item; var parent = LayoutHelper.FindAmongParents <BarManager>(item, null); _scopeTarget = parent; } catch { _scopeTarget = null; } } }
protected override void OnLostFocus(RoutedEventArgs e) { base.OnLostFocus(e); var focusedElement = FocusManager.GetFocusedElement() as DependencyObject; if (LayoutHelper.FindAmongParents <RibbonControlBase>(focusedElement, null) != null) { if (DeviceFamilyHelper.IsDesktop && focusedElement is Control && (focusedElement as Control).FocusState == FocusState.Pointer && !(focusedElement is TextBox || focusedElement is RibbonFlyoutTitleControl)) { FocusRepair(); } } }