I am binding TextBox.Text to int property:
<TextBox Text="{Binding Lines, UpdateSourceTrigger=PropertyChanged}" />
private int _lines = 10;
public int Lines
{
get { return _lines; }
set { _lines = value; }
}
everything works as expected with this simple code, there is even validation for the TextBox. There is however exception System.FormatException thrown in the Output log. My question is:
Is there elegant way to get rid of the exception without reimplementing almost everything myself?
By everything I mean validators, convertors, etc. simply ton of code that does not do anything but call Int32.TryParse instead of Int32.Parse. Not that exception thrown and handled by wpf would be a big problem, but full log makes finding actual problems much more difficult.