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
65
Highlight/disable a specific date
posted

Is there any way I can highlight (apply a color) or disable selecting a specific date on the UltraDateTimeEditor ? Thanks.

  • 69832
    Offline posted

    No, you can't do either of those things with the UltraDateTimeEditor. You can, however, with UltraCalendarCombo (Infragistics.Win.UltraWinSchedule):

    UltraCalendarInfo calendarInfo = this.ultraCalendarCombo1.CalendarInfo;
    UltraCalendarLook calendarLook = this.ultraCalendarCombo1.CalendarLook;
    DateTime date = new DateTime( 2008, 7, 1 );

    //  Disable a day:
    Infragistics.Win.UltraWinSchedule.Day day = calendarInfo.GetDay( date, true );
    day.Enabled = true;

    //  Note that you can also disable a week, month, or year:
    day.Week.Enabled = false;
    day.Month.Enabled = false;
    day.Month.Year.Enabled = false;

    //  The MinDate/MaxDate properties define a contiguous range
    //  of enabled dates; dates outside that range are effectively
    //  disabled:
    calendarInfo.MinDate = new DateTime( 2000, 1, 1 );
    calendarInfo.MinDate = new DateTime( 2010, 12, 31 );

    //  Change the look of a day:
    DayLook dayLook = calendarLook.GetDayLook( date, true );
    dayLook.Appearance.BackColor = Color.Red;