void OnSearchBoxTextChanged(global::Windows.UI.Xaml.Controls.AutoSuggestBox sender, global::Windows.UI.Xaml.Controls.AutoSuggestBoxTextChangedEventArgs args) { if (args.Reason != global::Windows.UI.Xaml.Controls.AutoSuggestionBoxTextChangeReason.ProgrammaticChange) { _currentSearchHandler.Query = sender.Text; } }
public ShellSectionRenderer() { System.Maui.Shell.VerifyShellUWPFlagEnabled(nameof(ShellSectionRenderer)); MenuItemTemplate = (global::Windows.UI.Xaml.DataTemplate)global::Windows.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; AutoSuggestBox = new global::Windows.UI.Xaml.Controls.AutoSuggestBox() { Width = 300 }; AutoSuggestBox.TextChanged += OnSearchBoxTextChanged; AutoSuggestBox.QuerySubmitted += OnSearchBoxQuerySubmitted; AutoSuggestBox.SuggestionChosen += OnSearchBoxSuggestionChosen; Frame = new global::Windows.UI.Xaml.Controls.Frame(); Content = Frame; this.SizeChanged += OnShellSectionRendererSizeChanged; Resources["NavigationViewTopPaneBackground"] = new global::Windows.UI.Xaml.Media.SolidColorBrush(ShellRenderer.DefaultBackgroundColor); Resources["TopNavigationViewItemForeground"] = new global::Windows.UI.Xaml.Media.SolidColorBrush(ShellRenderer.DefaultForegroundColor); Resources["TopNavigationViewItemForegroundSelected"] = new global::Windows.UI.Xaml.Media.SolidColorBrush(ShellRenderer.DefaultForegroundColor); Resources["NavigationViewSelectionIndicatorForeground"] = new global::Windows.UI.Xaml.Media.SolidColorBrush(ShellRenderer.DefaultForegroundColor); }
void OnSearchBoxQuerySubmitted(global::Windows.UI.Xaml.Controls.AutoSuggestBox sender, global::Windows.UI.Xaml.Controls.AutoSuggestBoxQuerySubmittedEventArgs args) { ((ISearchHandlerController)_currentSearchHandler).QueryConfirmed(); }
void OnSearchBoxSuggestionChosen(global::Windows.UI.Xaml.Controls.AutoSuggestBox sender, global::Windows.UI.Xaml.Controls.AutoSuggestBoxSuggestionChosenEventArgs args) { ((ISearchHandlerController)_currentSearchHandler).ItemSelected(args.SelectedItem); }