Public Class DlgListaDesplegable

  Private Sub DlgListaDesplegable_Loaded(sender As System.Object, e As System.Windows.RoutedEventArgs)
    'Dim elemento As String() = New String() {
    '  "uno", "dos", "tres", "cuatro", "cinco", "seis", _
    '  "siete", "ocho", "nueve", "diez", "once", "doce", _
    '  "trece", "catorce"}
    'Me.ldLista1.ItemsSource = elemento
  End Sub

  Private Sub btAceptar_Click(sender As System.Object, e As System.Windows.RoutedEventArgs)
    If ldLista1.SelectedIndex < 0 Then Return
    Dim elementoSeleccionado As Object
    elementoSeleccionado = ldLista1.SelectedItem
    MessageBox.Show(elementoSeleccionado.ToString())
  End Sub

  Private Sub btAñadir_Click(sender As System.Object, e As System.Windows.RoutedEventArgs)
    ' Añadir el elemento introducido en la
    ' caja de texto ctAñadir
    If ctAñadir.Text.Length <> 0 Then
      ldLista1.Items.Add(ctAñadir.Text)
    End If
  End Sub

  Private Sub btBorrar_Click(sender As System.Object, e As System.Windows.RoutedEventArgs)
    If ldLista1.SelectedIndex < 0 Then Return
    ldLista1.Items.RemoveAt(ldLista1.SelectedIndex)
  End Sub
End Class
