//Async method to get the data from web service. async void btnFindButton_Click(object sender, RoutedEventArgs e) { try { string searchString = (findTextBox.Text).ToString(); busyIndicator.IsBusy = true; client = new SearchServiceClient(); //everything after this line is made to wait until the execution is finished. //while it waits, the application control is handed over to the calling method. //That way, the UI is kept responsive. var result = await client.SearchItemsAsync(searchString); client.Close(); grdData.ItemsSource = result; busyIndicator.IsBusy = false; } catch (Exception ex) { busyIndicator.IsBusy = false; //do not show error for deliberately aborted requests. if (!ex.Message.Contains("The request was aborted: The request was canceled.")) { MessageBox.Show("Unexpected error: " + ex.Message, "Async Await Demo", MessageBoxButton.OK, MessageBoxImage.Error); } } this.UpdateLayout(); }