private void QuerySubmitted(Windows.UI.Xaml.Controls.AutoSuggestBox sender, Windows.UI.Xaml.Controls.AutoSuggestBoxQuerySubmittedEventArgs args)
        {
            // Navigate to search page
            App.NavigateTo(typeof(SearchView), SearchBox.Text);

            // Hide the popup
            Hide();
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AutoSuggestBox"/> class
        /// </summary>
        public AutoSuggestBox()
        {
#if !NETSTANDARD2_0
            NativeAutoSuggestBox = new NativeAutoSuggestBox(
#if __ANDROID__
                Android.App.Application.Context
#endif
                );
            NativeAutoSuggestBox.SuggestionChosen += (s, e) => { SuggestionChosen?.Invoke(this, new AutoSuggestBoxSuggestionChosenEventArgs(e.SelectedItem)); };
            NativeAutoSuggestBox.TextChanged      += (s, e) => {
                suppressTextChangedEvent = true;
                Text = NativeAutoSuggestBox.Text;
                suppressTextChangedEvent = false;
                TextChanged?.Invoke(this, new AutoSuggestBoxTextChangedEventArgs((AutoSuggestionBoxTextChangeReason)e.Reason));
            };
            NativeAutoSuggestBox.QuerySubmitted += (s, e) => QuerySubmitted?.Invoke(this, new AutoSuggestBoxQuerySubmittedEventArgs(e.QueryText, e.ChosenSuggestion));
#else
            throw new PlatformNotSupportedException();
#endif
        }
示例#3
0
 private void AutoSuggestBox_QuerySubmitted(Windows.UI.Xaml.Controls.AutoSuggestBox sender, Windows.UI.Xaml.Controls.AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     sender.ItemsSource = string.IsNullOrWhiteSpace(args.QueryText) ? null : suggestions;
 }
示例#4
0
 private void Control_QuerySubmitted(Windows.UI.Xaml.Controls.AutoSuggestBox sender, Windows.UI.Xaml.Controls.AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     InputPane.GetForCurrentView().TryHide();
 }
示例#5
0
 private void Search_QuerySubmitted(Windows.UI.Xaml.Controls.AutoSuggestBox sender, Windows.UI.Xaml.Controls.AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     ViewModel.SearchTerm = args.QueryText;
     ViewModel.SearchClick();
 }
示例#6
0
        public void MakeFocus()
        {
#if __ANDROID__
            NativeAutoSuggestBox.MakeRequestFocus();
#endif
        }