Reputation: 26952
I have a textbox with a validator that permits only integer values. How do I check if text in my textbox represents a correct integer value without checking the text itself?
I am using Prism MVVM so I would like to hear some solution like "bind a validator property to your viewmodel/model code", but a generic WPF solution is also fine.
The problem is that I can't get the incorrect value in my model / viewmodel. If the value is incorrect, then the underlying binded property doesn't get set.
Upvotes: 0
Views: 1271
Reputation: 34369
You could use IDataErrorInfo, or Data Annotations. The Data Annotations Extensions project contains an Integer
attribute.
Upvotes: 1