Completed
Last Updated: 21 Jan 2020 12:52 by ADMIN
Release R1 2020 SP1 (LIB 2020_1_127)
Ricardo
Created on: 01 Apr 2019 11:48
Category: UI for WinForms
Type: Bug Report
1
RadMaskedEditBox: The context menu cannot be localized

To reproduce:

 radMaskedEditBox1.MaskedEditBoxElement.ContextMenuEnabled = true;

Workaround:

public RadForm1()
{
    InitializeComponent();
    radMaskedEditBox1.MaskType = Telerik.WinControls.UI.MaskType.Standard;
    radMaskedEditBox1.Mask = "9999999999";
    radMaskedEditBox1.MaskedEditBoxElement.ContextMenuEnabled = true;
    radMaskedEditBox1.MaskedEditBoxElement.ContextMenu = BuildContextMenu();
}
private RadContextMenu BuildContextMenu()
{
    var contextMenu = new RadContextMenu();


    if (contextMenu == null)
    {
        contextMenu = new RadContextMenu();
    }

    if (contextMenu.Items.Count == 0)
    {
        RadMenuItem menuItem = new Telerik.WinControls.UI.RadMenuItem("Cut");
        menuItem.Name = "Cut";
        contextMenu.Items.Add(menuItem);
        menuItem.Click += new System.EventHandler(this.ContextMenuMenuItem_Click);

        menuItem = new Telerik.WinControls.UI.RadMenuItem("Test");
        menuItem.Name = "Copy";
        contextMenu.Items.Add(menuItem);
        menuItem.Click += new System.EventHandler(this.ContextMenuMenuItem_Click);

        menuItem = new Telerik.WinControls.UI.RadMenuItem("Paste");
        menuItem.Name = "Paste";
        contextMenu.Items.Add(menuItem);
        menuItem.Click += new System.EventHandler(this.ContextMenuMenuItem_Click);

        menuItem = new Telerik.WinControls.UI.RadMenuItem("Delete");
        menuItem.Name = "Delete";
        contextMenu.Items.Add(menuItem);
        menuItem.Click += new System.EventHandler(this.ContextMenuMenuItem_Click);

        menuItem = new Telerik.WinControls.UI.RadMenuItem("Select All");
        menuItem.Name = "Select All";
        contextMenu.Items.Add(menuItem);
        menuItem.Click += new System.EventHandler(this.ContextMenuMenuItem_Click);
    }
    return contextMenu;
}
void ContextMenuMenuItem_Click(object sender, EventArgs e)
{
    switch (((Telerik.WinControls.UI.RadMenuItem)(sender)).Name.ToUpper())
    {
        case "UNDO":
            //this.radMaskedEditBox1.MaskedEditBoxElement.TextBoxItem.;
            break;
        case "CUT":
            this.radMaskedEditBox1.MaskedEditBoxElement.TextBoxItem.Cut();
            break;
        case "COPY":
            this.radMaskedEditBox1.MaskedEditBoxElement.TextBoxItem.Copy();
            break;
        case "PASTE":
            this.radMaskedEditBox1.MaskedEditBoxElement.TextBoxItem.Paste();
            if (!this.radMaskedEditBox1.MaskedEditBoxElement.Provider.Validate(this.Text))
            {
                this.radMaskedEditBox1.MaskedEditBoxElement.TextBoxItem.TextBoxControl.Undo();
            }

            break;
        case "DELETE":
            this.radMaskedEditBox1.MaskedEditBoxElement.TextBoxItem.Clear();
            break;
        case "SELECT ALL":
            this.radMaskedEditBox1.MaskedEditBoxElement.TextBoxItem.SelectAll();
            break;
        default:
            break;
    }
}


1 comment
ADMIN
Dimitar
Posted on: 21 Jan 2020 12:52

Hello,

In Telerik UI for WinForms R1 2020 SP1 and LIB 2020_1_127 (scheduled for  27 of January) we will introduce a RadMaskedEditBoxLocalizationProvider for the purpose of localizing RadMaskedEditBox.

The localization provider will offer the following RadMaskedEditBoxStringIds:

- CutMenuItem
- CopyMenuItem
- PasteMenuItem
- DeleteMenuItem
- SelectAllMenuItem

Regards,
Dimitar
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.