private void createEventButton_Click(object sender, RoutedEventArgs e) { if (eventDate.SelectedDate != null) { model.NewEvent((DateTime)eventDate.SelectedDate); } else { MessageBox.Show("Indtast en gyldig dato!", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }