Completed
Last Updated: 13 Mar 2024 08:49 by ADMIN
Release 2024.1.312
Luca
Created on: 18 Jan 2024 07:42
Category: DateTimePicker
Type: Bug Report
0
RadDateTimePicker: With FreeFormDateTime provider when using CUT (CTRL+X) shortcut exception is thrown
Hi support,

while using the RadDateTimePicker control with FreeFormDateTime mask provider we encountered an unexpected behaviour.

While typing within the TextBox, we pressed CTRL+X to cut the inserted text to the clipboard. By doing so, a System.NullReferenceException was thrown.
1 comment
ADMIN
Nadya | Tech Support Engineer
Posted on: 18 Jan 2024 08:47

Hello, Luca,

You can use the following workaround:

 public RadForm1()
 {
     InitializeComponent();

     radDateTimePicker1.DateTimePickerElement.TextBoxElement.MaskType = MaskType.FreeFormDateTime;

     this.radDateTimePicker1.DateTimePickerElement.TextBoxElement.Provider = new CustomMaskDateTimeProvider(this.radDateTimePicker1.DateTimePickerElement.TextBoxElement.Mask, this.radDateTimePicker1.Culture, this.radDateTimePicker1.DateTimePickerElement.TextBoxElement);

 }
public class CustomMaskDateTimeProvider : MaskDateTimeProvider
{
    public CustomMaskDateTimeProvider(string mask, CultureInfo culture, RadMaskedEditBoxElement owner) : base(mask, culture, owner)
    {
    }

    public override void ResetCurrentPartValue(object sender, KeyEventArgs e)
    {
        if (this.List == null)
        {
            return;
        }
        base.ResetCurrentPartValue(sender, e);
    }
}

Regards,
Nadya | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.