/// <summary>
        /// This event gets fired anytime the text in the TextBox gets updated.
        /// It is recommended to check the reason for the text changing by checking against args.Reason
        /// </summary>
        /// <param name="sender">The AutoSuggestBox whose text got changed.</param>
        /// <param name="args">The event arguments.</param>
        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();
            }
        }
        /// <summary>
        /// This event gets fired when:
        ///     * a user presses Enter while focus is in the TextBox
        ///     * a user clicks or tabs to and invokes the query button (defined using the QueryIcon API)
        ///     * a user presses selects (clicks/taps/presses Enter) a suggestion
        /// </summary>
        /// <param name="sender">The AutoSuggestBox that fired the event.</param>
        /// <param name="args">The args contain the QueryText, which is the text in the TextBox,
        /// and also ChosenSuggestion, which is only non-null when a user selects an item in the list.</param>
        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());
            }
        }
 public Scenario1()
 {
     this.InitializeComponent();
     var task = ContactSampleDataSource.CreateContactSampleDataAsync();
 }