Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
295
xamDateTimeEditor Validation error
posted

We recentrly upgraded to Infragistics 2009.2 version of the WPF controls and noted that xamDateTimeEditor which was working fine with previous version started giving validation error.

Basically the mask was set as "dd/mm/yyyy hh:mm" and you could just select a date from the drop down and it will set the time to 00:00 automatically when you Tab out of it but now it pops up messagebox saying Value is in valid and the time part remain blank ( not set to 00:00 anymore).

Can someone please suggest a way so that the behaviour remain as it was and no messagebox is displayed.

Thank you

Parents
  • 54937
    Verified Answer
    Offline posted

    This is actually related to a bug fix/behavior change. Essentially the original template of the xamDateTimeEditor in 8.2 had the SelectedDate of the xamMonthCalendar in the template bound to the Value property of the xamDateTimeEditor. Since the dates of the xamMonthCalendar don't have time information (or more accurately have 00:00:00 - i.e. midnight), this meant that if you had a mask that included time portions when you would select a date from the dropdown it would overwrite the time information the user had in the edit portion with 00:00:00. We changed this back in March to instead bind the SelectedValue of the xamMonthCalendar to a new property on the xamDateTimeEditor named DateValue. When this property is set, we only update the date sections of the mask with the information from the new date value. This means that selecting a date does not set the time portion ever.

    If you want the previous behavior that would overwrite the time portion I can think of a couple of options:

    1) You could do a two way binding between the DateValue and Value. 

    <igEditors:XamDateTimeEditor Mask="dd/mm/yyyy hh:mm" 
      DateValue="{Binding Path=Value, Mode=TwoWay, 
          RelativeSource={RelativeSource Self}}"/>

    2) You could modify the template of the xamDateTimeEditor so that the SelectedValue is bound to the Value property instead of the DateValue. The default xaml is shipped with the product in the DefaultStyles directory and you can use that as the basis for your template. Note there are different templates for different themes so this may be difficult to manage.

    You may also want to submit a suggestion for adding an AutoFillTime property.

Reply Children
No Data