Public Class DlgListaSimple

  Private Sub DlgListaSimple_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.lsLista1.ItemsSource = elemento
  End Sub

  Private Sub btAceptar_Click(sender As System.Object, e As System.Windows.RoutedEventArgs)
    If lsLista1.SelectedIndex < 0 Then Return
    Dim s As String = ""
    For Each s1 As String In lsLista1.SelectedItems
      s = (s & s1) + Environment.NewLine
    Next
    MessageBox.Show(s)
  End Sub

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

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