Closed Issue Binding an int Value To TextBox

Apr 9, 2013 at 8:02 AM
Hello. You closed the issue "Binding an int Value To TextBox" with the comment: "Cannot fix"

But what to do in such case. Do you know any workaround?
Apr 9, 2013 at 8:14 AM
It's a non-catel issue. The issue is that the converter of .NET cannot convert the value "" to an integer and will not pass it to the view model. The only way around this is to bind to string and do the conversion yourself in the VM.
Apr 9, 2013 at 8:32 AM
It's a non-catel issue.
Thats correct.
The only way around this is to bind to string and do the conversion yourself in the VM.
In such case it would be nice to map from viewmodel to model with different type. From "int" in model to "string" in viewmodel
Apr 9, 2013 at 8:51 AM
Hm. I am a litlle bit confused

I set the 3 Propertys

NotifyOnValidationError = true;
ValidatesOnDataErrors = true;
ValidatesOnExceptions = true;

Now I get an error in the InfoBar. "Inputstring was not in a correct format"

The only problem is that SaveViewModel still returns true.
Apr 11, 2013 at 7:22 AM
Yep. Again this is because it's the binding system throwing the exception before it reaches the view model. Therefore Catel cannot intercept it and handle it correctly for you.