public class OnlyTextValidationRule : ValidationRule
{
public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
{
bool noNumbers = Regex.Matches("^([^0-9]*)$",value.ToString()).Count > 0;
return new ValidationResult(noNumbers, "Value contains numbers");
}
}
<Window.Resources>
<local:OnlyTextValidationRule x:Key="NoNumberValidate"/>
</Window.Resources>
<TextBox Text={Binding Value, ValidationRules={StaticResource NoNumberValidate}}/>