Skip to content

Commit 8d98184

Browse files
author
KB Bot
committed
Added new kb article add-vertical-separator-radmenu-winforms
1 parent f6bbed7 commit 8d98184

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
title: Adding a Vertical Separator to RadMenuItem in RadMenu for WinForms
3+
description: Learn how to insert a vertical separator between menu items in RadMenu for WinForms applications.
4+
type: how-to
5+
page_title: How to Insert a Vertical Separator in RadMenu for WinForms
6+
slug: add-vertical-separator-radmenu-winforms
7+
tags: menus,radmenu, winforms, separator, menuitem, vertical
8+
res_type: kb
9+
ticketid: 1668864
10+
---
11+
12+
## Environment
13+
14+
|Product Version|Product|Author|
15+
|----|----|----|
16+
|2024.4.1113|RadListView for WinForms|[Dinko Krastev](https://www.telerik.com/blogs/author/dinko-krastev)|
17+
18+
## Description
19+
20+
In the following example, we will demonstrate how you can add a vertical separator in the RadMenu control.
21+
22+
## Solution
23+
24+
To add a vertical separator to a RadMenu, use the `RadMenuSeparatorItem` class. You can customize the separator's orientation. The following code snippet demonstrates how to insert a vertical separator item between RadMenuItems upon form load. Ensure to adjust the index in the `Items.Insert` method according to where you want to place the separator in your menu.
25+
26+
````C#
27+
private void Form1_Load(object sender, EventArgs e)
28+
{
29+
var menuSeparatorItem = new Telerik.WinControls.UI.RadMenuSeparatorItem();
30+
31+
menuSeparatorItem.Name = "myPanel_Menu_Sep1";
32+
menuSeparatorItem.SeparatorOrientation = Telerik.WinControls.SepOrientation.Vertical;
33+
menuSeparatorItem.BackColor = Color.Red;
34+
menuSeparatorItem.ShouldPaint = true;
35+
menuSeparatorItem.TextVisibility = Telerik.WinControls.ElementVisibility.Visible;
36+
radMenu1.Items.Insert(1, menuSeparatorItem);
37+
}
38+
````
39+
40+
This approach allows you to dynamically add a vertical separator to your RadMenu, enhancing the menu's visual structure and organization.
41+
42+
## See Also
43+
44+
- [RadMenu Overview](https://docs.telerik.com/devtools/winforms/controls/menu/radmenu/overview)
45+
- [RadMenuSeparatorItem Class](https://docs.telerik.com/devtools/winforms/api/telerik.wincontrols.ui.radmenuseparatoritem)

0 commit comments

Comments
 (0)