Exemple #1
0
        /// <summary>
        /// Moves the logical focus and keyboard focus to the content of the <see cref="AutoHidePane"/>.
        /// </summary>
        /// <returns>
        /// <see langword="true"/> if logical focus and keyboard focus was moved to the content;
        /// otherwise <see langword="false"/>.
        /// </returns>
        public bool FocusContent()
        {
            if (!IsLoaded)
            {
                Loaded          += DeferredFocusContent;
                _isFocusDeferred = true;
                return(false);
            }

            bool hasFocusMoved = false;

            var dockTabPane = _contentPresenter.GetContentContainer <DockTabPane>();

            if (dockTabPane != null)
            {
                hasFocusMoved = dockTabPane.FocusSelectedContent();
            }
            else if (_contentPresenter != null)
            {
                hasFocusMoved = _contentPresenter.MoveFocus(new TraversalRequest(FocusNavigationDirection.First));
            }

            return(hasFocusMoved);
        }