To enable the non-restrictive mode of RadMaskedEditBox, the MaskType should be set to FreeFormDateTime:
C#radMaskedEditBox1.MaskType = MaskType.FreeFormDateTime;RadMaskedEditBox1.MaskType = MaskType.FreeFormDateTimeradMaskedEditBox1.Mask = "t";RadMaskedEditBox1.Mask = "t"radMaskedEditBox1.Mask = "d";RadMaskedEditBox1.Mask = "d"To enable the free form date time parsing in RadDateTimePicker, one needs to set the MaskType of the inner masked edit box:
C#this.radDateTimePicker1.DateTimePickerElement.TextBoxElement.MaskType = MaskType.FreeFormDateTime;Me.radDateTimePicker1.DateTimePickerElement.TextBoxElement.MaskType = MaskType.FreeFormDateTimeEnabling the free form of RadTimePicker uses the same approach as above:
C#radTimePicker1.TimePickerElement.MaskedEditBox.MaskType = MaskType.FreeFormDateTime;radTimePicker1.TimePickerElement.MaskedEditBox.MaskType = MaskType.FreeFormDateTime
Of course, all parse operations are validated according to the control’s minimum and maximum range.
Technical details: To learn more about the algorithm used for the implementation, please refer to this blog post. For more information about the supported feature, have a look here.this.radCalendar1.HeaderNavigationMode = HeaderNavigationMode.Zoom;Me.RadCalendar1.HeaderNavigationMode = HeaderNavigationMode.Zoomthis.radCalendar1.ZoomLevel = ZoomLevel.Months;Me.RadCalendar1.ZoomLevel = ZoomLevel.Monthsvoid radCalendar1_ZoomChanging(object sender, CalendarZoomChangingEventArgs e){ if (radCalendar1.ZoomLevel == ZoomLevel.Months) { e.Cancel = true; }}Private Sub radCalendar1_ZoomChanging(sender As Object, e As CalendarZoomChangingEventArgs) If radCalendar1.ZoomLevel = ZoomLevel.Months Then e.Cancel = True End IfEnd SubAs always, the ___ing event has its ___ed counterpart – ZoomChanged that informs you when the zoom level has been changed.
Of course, all these customizations apply to RadDateTimePicker as well, as the latter internally hosts RadCalendar:Another highly demanded feature is for the end user to be able to pick both date and time in RadDateTimePicker. With the latest bits, this is now possible. Enabling time picker in RadDateTimePicker is as easy as setting the following property:
this.radDateTimePicker1.DateTimePickerElement.ShowTimePicker = true;Me.RadDateTimePicker1.DateTimePickerElement.ShowTimePicker = TrueIn addition, you might want to customize the format the date in the control is displayed in order to accommodate time as well:
C#this.radDateTimePicker1.Format = DateTimePickerFormat.Custom;this.radDateTimePicker1.CustomFormat = "MMM - dd - yyyy hh:mm tt";Me.radDateTimePicker1.Format = DateTimePickerFormat.CustomMe.radDateTimePicker1.CustomFormat = "MMM - dd - yyyy hh:mm tt"radTimePicker1.MinValue = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 8, 0, 0);radTimePicker1.MaxValue = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 17, 0, 0);radTimePicker1.MinValue = New DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 8, 0, 0)radTimePicker1.MaxValue = New DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 17, 0, 0)This is it, folks. With all these new features at hand, entering date will feel like a breeze to the end-users.Happy coding!
Stefan Stefanov (MCPD) is a Senior Manager, Product Management and Product Marketing at Progress. He has been working with Telerik products since 2010, when he joined the company. Off work he enjoys traveling, hanging out with friends and reading various technology blogs. You can find Stefan on Twitter and LinkedIn.