예제 #1
0
        /// <summary>
        /// Moves focus to the SearchViewControl
        /// </summary>
        /// <returns>True if focus move succeeded</returns>
        /// <remarks>The SearchViewControl is the application's default data template for viewing search results. This control has custom logic
        /// to move focus to search results. Search control in MainWindow UI interacts with this control to focus on search results
        /// when the Down key is hit. If SearchViewControl is not used as the search result data template, this code path will need to
        /// be changed</remarks>
        private bool MoveFocusToSearchView()
        {
            bool focusMoved = false;

            if (ServiceProvider.ViewManager.CurrentNavigator is SearchNavigator)
            {
                SearchViewControl searchViewControl = ServiceProvider.ViewManager.CurrentVisual as SearchViewControl;
                if (searchViewControl != null)
                {
                    searchViewControl.MoveFocusToSearchResults();
                    focusMoved = true;
                }
            }
            else if (ServiceProvider.ViewManager.CurrentVisual != null)
            {
                UIElement element = ServiceProvider.ViewManager.CurrentVisual as UIElement;
                if (element != null)
                {
                    // Otherwise, focus on current visual, whatever it is
                    element.Focus();
                    focusMoved = true;
                }
            }
            return(focusMoved);
        }
예제 #2
0
 public SearchViewControlAutomationPeer(SearchViewControl owner) :
     base(owner)
 {
 }