Ejemplo n.º 1
0
        private async void TextBox_Loaded(object sender, RoutedEventArgs e)
        {
            StackPanel  panel       = sender as StackPanel;
            ProgressBar progressBar = panel.Children[0] as ProgressBar;

            AutoCompleteBox box = panel.Children[1] as AutoCompleteBox;

            box.Visibility = Visibility.Collapsed;
            await LoadItemsSourceTo(box, IsSource);

            box.Visibility         = Visibility.Visible;
            progressBar.Visibility = Visibility.Collapsed;

            box.Focus(FocusState.Pointer);
        }
Ejemplo n.º 2
0
 public static async Task LoadItemsSourceTo(AutoCompleteBox box, bool isSource)
 {
     box.PriorityComparer = new StopModelComparer();
     box.ItemsSource      = await boxItemSourceTask;
     box.DefaultItems     = isSource ? await defaultItemSourceSourcesTask : await defaultItemSourceTargetsTask;
 }