Exemplo n.º 1
0
 void OnSearchBoxTextChanged(Windows.UI.Xaml.Controls.AutoSuggestBox sender, Windows.UI.Xaml.Controls.AutoSuggestBoxTextChangedEventArgs args)
 {
     if (args.Reason != Windows.UI.Xaml.Controls.AutoSuggestionBoxTextChangeReason.ProgrammaticChange)
     {
         _currentSearchHandler.Query = sender.Text;
     }
 }
Exemplo n.º 2
0
        public ShellSectionRenderer()
        {
            Xamarin.Forms.Shell.VerifyShellUWPFlagEnabled(nameof(ShellSectionRenderer));
            MenuItemTemplate    = (Windows.UI.Xaml.DataTemplate)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 Windows.UI.Xaml.Controls.AutoSuggestBox()
            {
                Width = 300
            };
            AutoSuggestBox.TextChanged      += OnSearchBoxTextChanged;
            AutoSuggestBox.QuerySubmitted   += OnSearchBoxQuerySubmitted;
            AutoSuggestBox.SuggestionChosen += OnSearchBoxSuggestionChosen;

            Frame             = new Windows.UI.Xaml.Controls.Frame();
            Content           = Frame;
            this.SizeChanged += OnShellSectionRendererSizeChanged;
            Resources["NavigationViewTopPaneBackground"]            = new Windows.UI.Xaml.Media.SolidColorBrush(ShellRenderer.DefaultBackgroundColor);
            Resources["TopNavigationViewItemForeground"]            = new Windows.UI.Xaml.Media.SolidColorBrush(ShellRenderer.DefaultForegroundColor);
            Resources["TopNavigationViewItemForegroundSelected"]    = new Windows.UI.Xaml.Media.SolidColorBrush(ShellRenderer.DefaultForegroundColor);
            Resources["NavigationViewSelectionIndicatorForeground"] = new Windows.UI.Xaml.Media.SolidColorBrush(ShellRenderer.DefaultForegroundColor);
        }
 private void MyNavView_ChildChanged(object sender, EventArgs e)
 {
     if (MyAutoBox.Child is XamlIslands.AutoSuggestBox autoSuggestBox)
     {
         _autoSuggestBox                   = autoSuggestBox;
         _autoSuggestBox.TextChanged      += _autoSuggestBox_TextChanged;
         _autoSuggestBox.QuerySubmitted   += _autoSuggestBox_QuerySubmitted;
         _autoSuggestBox.SuggestionChosen += _autoSuggestBox_SuggestionChosen;
         _autoSuggestBox.PlaceholderText   = "Search";
     }
 }
Exemplo n.º 4
0
 void OnSearchBoxQuerySubmitted(Windows.UI.Xaml.Controls.AutoSuggestBox sender, Windows.UI.Xaml.Controls.AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     ((ISearchHandlerController)_currentSearchHandler).QueryConfirmed();
 }
Exemplo n.º 5
0
 void OnSearchBoxSuggestionChosen(Windows.UI.Xaml.Controls.AutoSuggestBox sender, Windows.UI.Xaml.Controls.AutoSuggestBoxSuggestionChosenEventArgs args)
 {
     ((ISearchHandlerController)_currentSearchHandler).ItemSelected(args.SelectedItem);
 }
 private void _autoSuggestBox_TextChanged(XamlIslands.AutoSuggestBox sender, XamlIslands.AutoSuggestBoxTextChangedEventArgs args)
 {
     _autoSuggestBox.ItemsSource = _fruitNames.Where(p => p.StartsWith(_autoSuggestBox.Text, StringComparison.OrdinalIgnoreCase)).ToArray();
 }
 private void _autoSuggestBox_QuerySubmitted(XamlIslands.AutoSuggestBox sender, XamlIslands.AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     _autoSuggestBox.Text = args.ChosenSuggestion != null?args.ChosenSuggestion.ToString() : sender.Text;
 }
 private void _autoSuggestBox_SuggestionChosen(XamlIslands.AutoSuggestBox sender, XamlIslands.AutoSuggestBoxSuggestionChosenEventArgs args)
 {
     _autoSuggestBox.Text = "AutoSuggestBox";
 }