Contacts.SearchCompleted Event
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Occurs when a search for contacts completes.
Assembly: Microsoft.Phone (in Microsoft.Phone.dll)
XMLNS for XAML: Not mapped to an xmlns.
To associate this event with a method that will handle the event, create a delegate and add an instance of the delegate to the event. The event handler is called whenever this event occurs, unless you remove the delegate.
For more information about handling events, see Consuming Events.
The following example assumes that you have a Windows Phone application that has a page with a button named SearchContacts. The code assumes that you have a databound list box named ContactResultsData. For the full example, including the XAML, see How to access contact data for Windows Phone 8.
Imports Microsoft.Phone.UserData Partial Public Class ContactsPage Inherits PhoneApplicationPage Public Sub New() InitializeComponent() End Sub Private Sub SearchContacts_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) ContactResultsData.DataContext = Nothing Dim cons As Contacts = New Contacts() AddHandler cons.SearchCompleted, AddressOf Contacts_SearchCompleted cons.SearchAsync("A", FilterKind.DisplayName, "Contacts Test #1") End Sub Private Sub Contacts_SearchCompleted(sender As Object, e As ContactsSearchEventArgs) Try 'Bind the results to the list box that displays them in the UI. ContactResultsData.DataContext = e.Results Catch ex As System.Exception 'That's okay, no results. End Try End Sub End Class