I\'m making a Wpf Application. I want to put validations on integer and character textboxes.
How can I achieve it?
You can throw an Exception when values are out of range and use ValidationRules like this:
More information can be found here: http://www.codeproject.com/KB/WPF/wpfvalidation.aspx
Update: In code behind you can do something like:
private int _Number;
public string Number
{
get { return _Number.ToString(); }
set
{
if (!Int32.TryParse(value, out _Number))
{
throw new ApplicationException("Invalid integer number");
}
}
}