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
1125
UltraCalendarCombo bound to String
posted

Hi

We use the CSLA framework which has a very clever SmartDate class that allows users to type 't' for today, '-' for yesterday, to type the date in almost any format they can imagine and also allows the developer to set whether an empty smartdate should be considered infinitely in the past or the future for date comparison purposes.

The smart date is presented to the UI as a string property rather than as a date or smart date (e.g. get/set DateEnteredSmartDate as string).

This means that the UltraCalendarCombo is trying to bind a date to a string which, when CLR debugging is switched on, causes exceptions if the string is blank (although these don't cause a crash).

Is there anyway to stop the calendarcombo throwing these errors if it is bound to a string? 

Ideally we would like just the drop down calendar part of the control with the text area behaving like a standard text box (i.e. without the mask and with the ability to enter any string text) - is there anyway to achieve that with the UCC or with another Infragistics control?

 

  • 69832
    Verified Answer
    Offline posted

    What you could do is roll your own date picker using the UltraMonthViewMulti control (this is actually what is displayed in the UltraCalendarCombo's dropdown) and an UltraTextEditor with a DropDownEditorButton. UltraTextEditor exposes a ButtonsRight collection, to which you can add an Infragistics.Win.UltraWinEditors.DropDownEditorButton. At this point it will look something like a ComboBox. You then assign an UltraMonthViewMulti instance to the DropDownEditorButton's Control property. At this point you will see the calendar appear when you click the dropdown button. DropDownEditorButton exposes a BeforeDropDown event and an AfterCloseUp event; you would need to handle these to synchronize the value in the UltraTextEditor with that of the UltraMonthViewMulti.CalendarInfo.ActiveDay. In this scenario the parsing is your responsibility so you would have to handle the translation of the string tokens for today, yesterday, etc.