WPF有一个
Separator控件,只是为了这个目的,它也会分离你的菜单项,当出现在工具栏上。从MSDN文档:
原文链接:https://www.f2er.com/vb/256176.htmlA Separator control draws a line,
horizontal or vertical,between items
in controls,such as ListBox,Menu,
and ToolBar. Separator controls do not
react to any keyboard,mouse,mouse
wheel,or tablet input and cannot be
enabled or selected.
在代码中:
using System.Windows.Controls; // Menu myMenu = new Menu(); myMenu.Items.Add(new Separator());