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; } }
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>(); }
void OnSearchBoxQuerySubmitted(Microsoft.UI.Xaml.Controls.AutoSuggestBox sender, Microsoft.UI.Xaml.Controls.AutoSuggestBoxQuerySubmittedEventArgs args) { ((ISearchHandlerController)_currentSearchHandler).QueryConfirmed(); }
void OnSearchBoxSuggestionChosen(Microsoft.UI.Xaml.Controls.AutoSuggestBox sender, Microsoft.UI.Xaml.Controls.AutoSuggestBoxSuggestionChosenEventArgs args) { ((ISearchHandlerController)_currentSearchHandler).ItemSelected(args.SelectedItem); }