Ich habe folgendes Problem. Mit einer ValidationRule prüfe ich die Eingabe einer Textbox.
public class PreisValidationRule : ValidationRule { public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo) { decimal val;
if (decimal.TryParse(value.ToString(), out val)) { if (val < 0) { return new ValidationResult(false, "Preis darf nicht negativ sein"); } return ValidationResult.ValidResult; } return new ValidationResult(false, "Keine Zahl eingegeben"); } }
Mein Ziel ist es jetzt das ich die Fehlermeldungen, die die PreisValidationRule zurückgibt an einen TextBlock binde. Ich weiß aber nicht wie ich das machen kann.
Wie kann ich die Fehlermeldungen direkt an einen Textblock binden?