コード例 #1
0
 private void asb_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     // We only want to get results when it was a user typing,
     // otherwise we assume the value got filled in by TextMemberPath
     // or the handler for SuggestionChosen
     if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
     {
         var matchingContacts = ContactSampleDataSource.GetMatchingContacts(sender.Text);
         sender.ItemsSource = matchingContacts.ToList();
     }
 }
コード例 #2
0
        private void asb_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
        {
            if (args.ChosenSuggestion != null)
            {
                // User selected an item, take an action on it here
                SelectContact((Contact)args.ChosenSuggestion);
            }
            else
            {
                // Do a fuzzy search on the query text

                var matchingContacts = ContactSampleDataSource.GetMatchingContacts(args.QueryText);

                // Choose the first match, or clear the selection if there are no matches.
                SelectContact(matchingContacts.FirstOrDefault());
            }
        }
コード例 #3
0
 public SearchPage()
 {
     this.InitializeComponent();
     var task = ContactSampleDataSource.CreateContactSampleDataAsync();
 }