How do I limit the number of characters shown when the text is too long?
For the text "Very Long Text Very Very Long" to take the form "Very Long Text ..."
OR text "VeryLongTextVeryVeryLong" to take the form "VeryLongTextV..."
1 Answer, 1 is accepted
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 20 Jan 2021, 06:02 AM
Hello, Serg,
Generally, you can limit the size of the context menu by setting the DropDown.MaximumSize property. It is necessary to restrict the menu item as well.
RadContextMenu menu = new RadContextMenu();
publicForm1()
{
InitializeComponent();
RadLabelElement lbl = new RadLabelElement();
lbl.Text = "Very Long Text Very Very Long";
lbl.TextWrap = false;
RadMenuItem item = new RadMenuItem();
item.Children.Add(lbl);
menu.Items.Add(item);
item.MaxSize = lbl.MaxSize = new System.Drawing.Size(70,0);
menu.DropDown.MaximumSize = new Size(100, 0);
}
privatevoidradButton1_Click(object sender, EventArgs e)
{
menu.Show(MousePosition);
}
I hope this information helps. If you need any further assistance please don't hesitate to contact me.
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.