Public Class DlgCalendario

  Private Sub Calendar_SelectedDatesChanged(sender As System.Object, e As System.Windows.Controls.SelectionChangedEventArgs)
    ' Verificar los elementos nuevos añadidos
    For Each fechaSeleccionada As DateTime In e.AddedItems
      If (fechaSeleccionada.DayOfWeek = DayOfWeek.Saturday) OrElse
         (fechaSeleccionada.DayOfWeek = DayOfWeek.Sunday) Then
        etError.Text = "Los fines de semana no se pueden seleccionar."
        ' Borrar la fecha no válida
        DirectCast(sender, Calendar).SelectedDates.Remove(fechaSeleccionada)
      End If
    Next
  End Sub

  Private Sub DatePicker_DateValidationError(sender As System.Object, e As System.Windows.Controls.DatePickerDateValidationErrorEventArgs)
    etError.Text = "'" & Convert.ToString(e.Text) &
      "' no es un valor válido porque " &
      Convert.ToString(e.Exception.Message)
  End Sub
End Class
