This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I have a value that is quantized. It must always be a multiple of 15. The Change property allows me to step by the right amount with the buttons but I do not see a clean way to enforce this when the user types in numbers. |
|
|
What UI do you want for this? Obviously this constraint can't be applied as the user types, because the user has to type, say, "3" on the way to "30," so I assume you want something to happen when the box loses focus -- is that right? What do you want to happen -- error indicator, binding source not updated, reset to nearest multiple of 15, set focus back to box, etc.? Your best bet may be to put the constraint in your data object's property setter, then use the WPF binding validation infrastructure to report and handle the validation failure that occurs when the setter throws. See in particular the Binding.ValidatesOnExceptions and Binding.NotifyOnValidationError properties, and the Validation.Error attached event. |
|