How can I validate one Textbox so that it only contains ASCII characters?
<TextBox Name="PbnameText" Visibility="Collapsed" IsReadOnly="False" Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
I tried to add a ValidationRule, but it needs always to implement Min and Max properties
public class NameRule : ValidationRule
{
public int Min { get; set; }
public int Max { get; set; }
public override ValidationResult Validate(object value, CultureInfo cultureInfo)
{
if (true)
return new ValidationResult(false, $"Illegal characters or {e.Message}");
else
return ValidationResult.ValidResult;
}
}