Th69 erstmal danke..
Dein Vorschlag funktioniert fast..
Die Validation Rule verhindert einen korrupten Wert in der gebundenen Eigenschaftsmethode, erstmal gut, aber die "
e.CanExecute = true" bleibt
true.
- Wie kann ich explizit einen korrupten Wert über XAML ins ViewModel Feld binden, um mit dem Command zu arbeiten?
Irgendwie widerspricht sich das? Gibt es noch eine andere Möglichkeit zu meiner ursprünglichen Frage?
- Die ValidationRule erwartet als zweites Argument CultureInfo hier übergebe ich null -> Für was wird diese benötigt?
C#-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11:
| private void OpenCanExecute(object sender, CanExecuteRoutedEventArgs e) { if (AdressValidationRule.Validate(Adress, null).IsValid) { e.CanExecute = true; } else { e.CanExecute = false; } } |
Moderiert von Th69: C#-Tags hinzugefügt