The RadDateTimeEditor does not obey MaxDate and MinDate property when the value is changed by keyboard input.
Work around:
public class MyRadDateTimeEditor : RadDateTimeEditor
{
public MyRadDateTimeEditor()
{
RadDateTimeEditorElement element = this.EditorElement as RadDateTimeEditorElement;
element.CurrentBehavior.TextBoxElement.ValueChanged += this.OnValueChanged;
}
private void OnValueChanged(object sender, System.EventArgs e)
{
RadMaskedEditBoxElement maskBox = sender as RadMaskedEditBoxElement;
RadDateTimeEditorElement element = this.EditorElement as RadDateTimeEditorElement;
DateTime result;
if (maskBox.Value != null && DateTime.TryParse(maskBox.Value.ToString(), out result) && DateTime.Compare(result, element.MaxDate) > 0)
{
this.Value = element.MaxDate;
maskBox.Value = element.MaxDate;
return;
}
}
}