Completed
Last Updated: 04 Jan 2017 15:02 by ADMIN
ADMIN
Dess | Tech Support Engineer, Sr.
Created on: 06 Dec 2016 09:16
Category: Editors
Type: Bug Report
1
FIX. RadDateTimePicker - days after MaxDate are not grayed out when MinDate=Maxdate
To reproduce:

            this.radDateTimePicker1.MinDate = DateTime.Now;
            this.radDateTimePicker1.MaxDate = DateTime.Now;

Please refer to the attached screenshots. Although the user is not allowed to change the selection, the future dates are not grayed out as the dates before the MinDate.

Workaround:

public RadForm1()
{
    InitializeComponent();

    this.radDateTimePicker1.MinDate = DateTime.Now;
    this.radDateTimePicker1.MaxDate = DateTime.Now;

    RadDateTimePickerCalendar calendarBehavior = this.radDateTimePicker1.DateTimePickerElement.GetCurrentBehavior() as RadDateTimePickerCalendar;
    calendarBehavior.Calendar.ElementRender += Calendar_ElementRender; 
}

private void Calendar_ElementRender(object sender, RenderElementEventArgs e)
{
    if (e.Day.Date > this.radDateTimePicker1.MaxDate.Date || e.Day.Date < this.radDateTimePicker1.MinDate.Date)
    {
        e.Element.Enabled = false;
    }
    else
    {
        e.Element.Enabled = true;
    }
}
Attached Files:
0 comments