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
|
Hello, I'm using the nifty built-in date editor. The drop-down and display behavior all work well ... however, once I select a date, I get the default 'red-box' outline indicating the date field is invalid ... I'm ok with the red box ... I just don't know why the validation routines think my date is invalid. What am I doing wrong? Also, any further explanation you can provide about how i might add my own vb.net based business validation logic would be greatly appreciated ... Regards, Douglas |
|
|
To be more specific ... I'm trying to add a validation rule to check the value of the selected date ... as I want to make sure the selected date is always 'in the future' ... In the MSDN documentation, it illustrates how to add validation rules ... like so: <TextBox Name="StartDateEntryForm" Grid.Row="3" Grid.Column="1" I've created a similar validation class (called EffectiveDateRule) ... and I would like to attach it to the date editor in the properties grid ... just not sure how to get that done .... |
|
|
Uh ... did I mention I'm new to WPF? ;-) ... Ok, after brushing up on my literacy skills, I actually read your statement in the help file: "Built-in editors support source-based validation using exceptions or IDataErrorInfo." So, I simply added some error catching code into my setter on the EffectiveDate property of my view model object. I throw an exception if the date fails ... which works ... Actually, it works a bit too well as the validation fires when I select an 'old' date (a date before today) ... and I get an instant red box .... then, when I select a date in the future the red box remains ... even though the date is valid ... So, my last task on this little validation journey is to figure out how to remove the red box ... If you've gotten this far, bless you. Regards, Douglas |
|
|
Ok, journey complete ... just had a bug in my validation routine. Red box now disappears! So, before you write me off as a complete idiot - or even if you do, please remember back, perhaps way back, to when you were first learning WPF ... Thanks for your patience ... Regards, Douglas |
|
|
Believe me, we understand the learning curve! Glad it's working for you now. |
|