This is a migrated thread and some comments may be shown as answers.

Validation

3 Answers 119 Views
DateTimePicker
This is a migrated thread and some comments may be shown as answers.
Paul Ridden
Top achievements
Rank 1
Veteran
Paul Ridden asked on 04 Aug 2010, 12:03 PM
Hi

I have a date/time picker (XAML below). Problems:

1) When I type in 'hello' a tooltip appears with 'Error'. However I was expecting to see the red outline to the control and red tooltip as per other controls. ScheduleDate is a Nullable<DateTime>. Is this exected, and how can I get the normal error style?

2) I am using MVVM so because the value is invalid as a date/time my ViewModel is not updated and I dont know anything is wrong. I would like to know as they type but ParseDateTimeValue is only raised on lost focus. How can I respond to the the text changing?

<t:RadDateTimePicker Grid.Row="2" DateTimeWatermarkContent="" 
SelectedValue="{Binding ScheduleDate, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnExceptions=True}"
Height="22" Margin="0,10,16,2" HorizontalAlignment="Stretch" />

Thanks
Russell Mason

3 Answers, 1 is accepted

Sort by
0
Dani
Telerik team
answered on 06 Aug 2010, 01:11 PM
Hello Paul Ridden,

Thank you for submitting your concerns.

The display of the tooltip that you see is intended. This is not the regular Validation tooltip (which indeed is red with red foreground), but a Suggestion tooltip

By default, text input is enabled for RadDateTimePicker, because you have the option to enter for instance "3 September" and the tooltip will update its value to suggest 9/3/2010.

Additionally, the ParseDateTimeValue is raised on lost focus because text should be parsed after one has finished entering input and this is intended default behavior.
We understand that such a behavior is not the optimal for your scenario and we will strive to improve the control validation in our upcoming releases (by the way, RadDateTimePicker is a new control from our Q2 Release). 

What you could do for now is to create an attached behavior which sets the SelectedValue of RadDateTimePicker to null on some condition and as a result throw an exception whenever SelectedValue is null so that you will be able to see the Validation tooltip.

Please, get back to us with any further questions.

Sincerely yours,
Dani
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Terry Foster
Top achievements
Rank 1
answered on 14 Aug 2010, 07:09 PM
I, too, fully expect and need the control validation to behave similarly to when a TextBox bound to a number field (red outline, "Input is not in the correct format" error tip, and 'BindingValidationError' event raised).

Thanks,
Terry
0
Dani
Telerik team
answered on 18 Aug 2010, 08:23 AM
Hello Terry Foster, Paul Ridden,

Since this issue has been requested a lot and we consider it significant to the proper functioning of the control, the feature is now implemented.

As described in my previous post, SelectedValue of RadDateTimePicker will be set to null whenever invalid/dummy text has been entered. Consequently, you can use this behavior to throw an exception in that case and take advantage of the validation.

The fix will be available in the next Latest Internal Build.


Sincerely yours,
Dani
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
DateTimePicker
Asked by
Paul Ridden
Top achievements
Rank 1
Veteran
Answers by
Dani
Telerik team
Terry Foster
Top achievements
Rank 1
Share this question
or