Hello
I have control, which inherits from RadDateTimePicker. I use it across my whole application to ensure consistency.
Now I want to use it in RadGridView as an editor. I have tried to use some concepts from http://www.telerik.com/help/winforms/gridview-editors-using-custom-editors.html, but with no success.
How can I achieve the desired functionality?
I have control, which inherits from RadDateTimePicker. I use it across my whole application to ensure consistency.
public class RadMaskedDatePicker : RadDateTimePicker
{
public RadMaskedDatePicker()
{
InitializeComponent();
}
private void InitializeComponent()
{
this.Format = DateTimePickerFormat.Short;
InitializeFooter();
}
private void InitializeFooter()
{
RadDateTimePickerCalendar datePickerCalendarBehavior = this.DateTimePickerElement.GetCurrentBehavior() as RadDateTimePickerCalendar;
if (datePickerCalendarBehavior == null)
{
return;
}
RadCalendar calendar = datePickerCalendarBehavior.Calendar;
calendar.ShowFooter = true;
CalendarStatusElement calendarStatusElement = calendar.CalendarElement.CalendarStatusElement;
calendarStatusElement.RightToLeft = true;
calendarStatusElement.LabelElement.Visibility = ElementVisibility.Hidden;
calendarStatusElement.TodayButton.Text = Resources.strToday;
calendarStatusElement.TodayButton.Click += (sender, args) =>
{
calendar.SelectedDates.Clear();
this.Value = DateTime.Today;
datePickerCalendarBehavior.PopupControl.HideControl();
};
calendarStatusElement.ClearButton.Text = Resources.strClear;
calendarStatusElement.ClearButton.Click += (sender, args) =>
{
this.SetToNullValue();
datePickerCalendarBehavior.PopupControl.HideControl();
};
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public override DateTimePickerFormat Format
{
get { return base.Format; }
set { base.Format = value; }
}
}
Now I want to use it in RadGridView as an editor. I have tried to use some concepts from http://www.telerik.com/help/winforms/gridview-editors-using-custom-editors.html, but with no success.
How can I achieve the desired functionality?