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

RadDatePicker and RadDateTimePicker ToolTip display Error Message

2 Answers 316 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
Thiru
Top achievements
Rank 1
Thiru asked on 11 Nov 2014, 01:48 PM
Hi Techies,

I do not have any run time issue but when i load the screen, i am getting the Below error message in Custom Validation part.

System.Windows.Data Error: 17 : Cannot get 'Item[]' value (type 'ValidationError') from '(Validation.Errors)' (type 'ReadOnlyObservableCollection`1'). BindingExpression:Path=(0)[0].ErrorContent; DataItem='RadDatePicker' (Name='EventStartDateTimePicker'); target element is 'RadDatePicker' (Name='EventStartDateTimePicker'); target property is 'ToolTip' (type 'Object') ArgumentOutOfRangeException:'System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.

I have to resolve this issue. Why this above error is displaying? Below i have given the Xaml Part. This is what i am using

<tk:RadDatePicker Grid.Row="3" Grid.Column="0" TabIndex="2" Padding="3,2,0,0" 
Width="85" Height="25" DateTimeWatermarkContent=" " FontSize="11.5" 
x:Name="EventEndDateTimePicker" FontFamily="MyriadPro-Regular" 
IsTooltipEnabled="False" SelectedValue="{Binding RelativeSource={RelativeSource 
FindAncestor, AncestorType={x:Type UserControl}}, 
Path=DataContext.ViewData.EventDetail.EndDate,UpdateSourceTrigger=PropertyChanged
Mode=TwoWay,NotifyOnSourceUpdated=True,ValidatesOnDataErrors=True}" 
self:RadDatePickerHelper.IsFreeTextAllowed="True" 
self:RadDatePickerHelper.ShortDateFormat="MM/dd/yyyy" 
lib:Event.Binding="SelectionChanged.[DateChangeValidation]" 
compass:RadDateTimePickerHelper.EnableCustomFeatures="True" 
compass:RadDateTimePickerHelper.EnableIsCurrentDateRequiredOnDoubleClick="False" 
AllowDrop="False"><BR><tk:RadDatePicker.Style><BR><Style 
TargetType="{x:Type tk:RadDatePicker}" BasedOn="{StaticResource 
DatePickerStyle}"><BR><Style.Triggers><BR><Trigger 
Property="Validation.HasError" Value="True"><BR><Setter Property="ToolTip" 
Value="{Binding RelativeSource={RelativeSource Self}, 
Path=(Validation.Errors)[0].ErrorContent}" 
/><BR></Trigger><BR></Style.Triggers><BR></Style><BR></tk:RadDatePicker.Style><BR></tk:RadDatePicker><BR><BR>

Please help me to get ride of this binding error on loading the screen.

regards
Thiruppathi V

2 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 12 Nov 2014, 08:53 AM
Hello Thiru,

The error indicates some issue with the validation of the DatePicker value, however, without debugging the VIewModel where the validation logic is implemented, it is not possible for us to tell the exact reason. That's why I'd ask you to try to isolate the problem in a simple project and send it to us, so we to be able to test and debug it locally.

Thanks you for your cooperation.

Regards,
Yana
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Thiru
Top achievements
Rank 1
answered on 12 Nov 2014, 10:45 AM
Hi Yana's,

Thanks for your reply.

I have fixed this issue. I have used the binding like below.

<Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors).CurrentItem.ErrorContent}" />

Earlier, we have bound the Tooltip value like below.


<Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors).[0].ErrorContent}" />


Regards
Thiruppathi V
Tags
DatePicker
Asked by
Thiru
Top achievements
Rank 1
Answers by
Yana
Telerik team
Thiru
Top achievements
Rank 1
Share this question
or