Partial Public Class SilverlightAutoCompleteBox
  Inherits UserControl
  Private listaPersonas As New List(Of CPersona)()

  Public Sub New()
    InitializeComponent()
    acbProvincias.ItemsSource = New [String]() {"Álava (Araba)", "Albacete", "Alicante", "Almería", "Asturias", "Ávila", _
     "Badajoz", "Barcelona", "Burgos", "Cantabria", "Castellón", "Ciudad Real", _
     "Cuenca", "Cáceres", "Cádiz", "Córdoba", "Gerona (Girona)", "Granada", _
     "Guadalajara", "Guipúzcoa (Gipuzkoa)", "Huelva", "Huesca", "Islas Baleares (Illes Balears)", "Jaén", _
     "La Coruña (A Coruña)", "La Rioja", "Las Palmas", "León", "Lugo", "Lérida (Lleida)", _
     "Madrid", "Murcia", "Málaga", "Navarra", "Orense (Ourense)", "Palencia", _
     "Pontevedra", "Salamanca", "Santa Cruz de Tenerife", "Segovia", "Sevilla", "Soria", _
     "Tarragona", "Teruel", "Toledo", "Valencia", "Valladolid", "Vizcaya (Bizkaia)", _
     "Zamora", "Zaragoza"}
    'listaPersonas.Add(New CPersona("dd/MM/yy", "a_nombre1", "a_apellidos", "111222333"))
    'listaPersonas.Add(New CPersona("dd/MM/yy", "b_nombre1", "b_apellidos", "211222333"))
    'listaPersonas.Add(New CPersona("dd/MM/yy", "c_nombre1", "c_apellidos", "311222333"))
    'listaPersonas.Add(New CPersona("dd/MM/yy", "a_nombre2", "a_apellidos", "411222333"))
    'listaPersonas.Add(New CPersona("dd/MM/yy", "a_nombre3", "a_apellidos", "686222333"))
    'listaPersonas.Add(New CPersona("dd/MM/yy", "b_nombre2", "b_apellidos", "686222333"))
    'acbProvincias.ItemsSource = listaPersonas
    'acbProvincias.ItemFilter = AddressOf Filtro
  End Sub

  Public Function Filtro(texto As String, objeto As Object) As Boolean
    Return TryCast(objeto, CPersona).Telefono.StartsWith("686")
  End Function

  Private Sub acbProvincias_GotFocus(sender As Object, e As RoutedEventArgs)
    popUpProvincias.IsOpen = True
  End Sub

  Private Sub popUpProvincias_MouseLeftButtonDown(sender As Object, e As MouseButtonEventArgs)
    popUpProvincias.IsOpen = False
  End Sub
End Class
