New to Telerik UI for WinFormsStart a free 30-day trial

How to Add Custom ContextMenu for RadTextBox

Updated on Aug 27, 2026

Environment

Product VersionProductAuthor
2022.1.222RadTextBox for WinFormsDesislava Yordanova

Description

By default, RadTextBox offers the following context menu after right-clicking the controls:

custom-contextmenu-for-radtextbox 001

This is actually the context menu for the hosted TextBox that Microsoft offers.

This article demonstrates a sample approach how to eliminate the default menu and assign your custom one.

Solution

In order to remove the default context menu, it is necessary to set the RadTextBox.TextBoxElement.TextBoxItem.HostedControl.ContextMenuStrip property to a new instance of ContextMenuStrip:

C#
   
this.radTextBox1.TextBoxElement.TextBoxItem.HostedControl.ContextMenuStrip = new ContextMenuStrip();

However, if you want to achieve your custom items, it is necesary to create your own ContextMenuStrip

custom-contextmenu-for-radtextbox 002

C#

public RadForm1()
{
    InitializeComponent();

    ContextMenuStrip menu = new ContextMenuStrip();
    ToolStripMenuItem copy = new ToolStripMenuItem("Copy", Properties.Resources.copy); 
    copy.Click += copy_Click;
    menu.Items.Add(copy);
    ToolStripMenuItem cut = new ToolStripMenuItem("Cut", Properties.Resources.cut);
    cut.Click += cut_Click;
    menu.Items.Add(cut);
    ToolStripMenuItem paste = new ToolStripMenuItem("Paste", Properties.Resources.paste); 
    paste.Click += paste_Click;
    menu.Items.Add(paste);
    this.radTextBox1.TextBoxElement.TextBoxItem.HostedControl.ContextMenuStrip = menu;
}

private void paste_Click(object sender, EventArgs e)
{
    //TODO paste
}

private void cut_Click(object sender, EventArgs e)
{
    //TODO cut
}

private void copy_Click(object sender, EventArgs e)
{
    //TODO copy
}
In this article
EnvironmentDescriptionSolution
Not finding the help you need?
Contact Support