コード例 #1
0
 void OnSearchBoxTextChanged(Microsoft.UI.Xaml.Controls.AutoSuggestBox sender, Microsoft.UI.Xaml.Controls.AutoSuggestBoxTextChangedEventArgs args)
 {
     if (args.Reason != Microsoft.UI.Xaml.Controls.AutoSuggestionBoxTextChangeReason.ProgrammaticChange)
     {
         _currentSearchHandler.Query = sender.Text;
     }
 }
コード例 #2
0
        public ShellSectionRenderer()
        {
            Microsoft.Maui.Controls.Shell.VerifyShellUWPFlagEnabled(nameof(ShellSectionRenderer));
            MenuItemTemplate      = (Microsoft.UI.Xaml.DataTemplate)Microsoft.UI.Xaml.Application.Current.Resources["ShellSectionMenuItemTemplate"];
            IsBackButtonVisible   = Microsoft.UI.Xaml.Controls.NavigationViewBackButtonVisible.Collapsed;
            IsSettingsVisible     = false;
            AlwaysShowHeader      = false;
            PaneDisplayMode       = Microsoft.UI.Xaml.Controls.NavigationViewPaneDisplayMode.Top;
            ItemInvoked          += OnMenuItemInvoked;
            ShellContentMenuItems = new ObservableCollection <ShellContent>();
            MenuItemsSource       = ShellContentMenuItems;
            AutoSuggestBox        = new Microsoft.UI.Xaml.Controls.AutoSuggestBox()
            {
                Width = 300
            };
            AutoSuggestBox.TextChanged      += OnSearchBoxTextChanged;
            AutoSuggestBox.QuerySubmitted   += OnSearchBoxQuerySubmitted;
            AutoSuggestBox.SuggestionChosen += OnSearchBoxSuggestionChosen;

            Frame             = new Microsoft.UI.Xaml.Controls.Frame();
            Content           = Frame;
            this.SizeChanged += OnShellSectionRendererSizeChanged;
            Resources["NavigationViewTopPaneBackground"]            = new Microsoft.UI.Xaml.Media.SolidColorBrush(ShellRenderer.DefaultBackgroundColor);
            Resources["TopNavigationViewItemForeground"]            = new Microsoft.UI.Xaml.Media.SolidColorBrush(ShellRenderer.DefaultForegroundColor);
            Resources["TopNavigationViewItemForegroundSelected"]    = new Microsoft.UI.Xaml.Media.SolidColorBrush(ShellRenderer.DefaultForegroundColor);
            Resources["NavigationViewSelectionIndicatorForeground"] = new Microsoft.UI.Xaml.Media.SolidColorBrush(ShellRenderer.DefaultForegroundColor);
            FormsNavigationStack = new List <Page>();
        }
コード例 #3
0
 void OnSearchBoxQuerySubmitted(Microsoft.UI.Xaml.Controls.AutoSuggestBox sender, Microsoft.UI.Xaml.Controls.AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     ((ISearchHandlerController)_currentSearchHandler).QueryConfirmed();
 }
コード例 #4
0
 void OnSearchBoxSuggestionChosen(Microsoft.UI.Xaml.Controls.AutoSuggestBox sender, Microsoft.UI.Xaml.Controls.AutoSuggestBoxSuggestionChosenEventArgs args)
 {
     ((ISearchHandlerController)_currentSearchHandler).ItemSelected(args.SelectedItem);
 }