I have a textbox that is bound to an Integer property. when the user enters something in the textbox that can’t be converted to an integer (eg. name) an exception will be thrown and the original property value won’t change. i want to catch the exception so that i can disable a command that is connected to that property ? how can i do that in general and if possible from the view model where the property is defined ?
Share
Consider calling the command from the view model instead of from the view.
This will allow you to handle the user typing things that cannot be parsed to an integer,
and you will only fire the command when what the user typed is an integer.
(I didn’t test this code, but I think it might be helpful.)