简体   繁体   中英

How can I change Menu's Text color?

我想更改菜单的文本颜色,但不更改MenuItem。

在Windows窗体应用程序中,在窗体的代码隐藏中,在InitializeComponent()之后的构造函数中,设置菜单的color属性,如下所示:

 MyMenu.ForeColor = Color.White;

You should be able if its Visual c# you should be able to right click the widget and adjust the foreground property. Foreground usually sets the text color in Visual .net widgets like Labels, buttons, textboxes, so I think it'll probably be there for menus.

In Xaml:

    <Menu Foreground="Red">
        <MenuItem Header="_File"></MenuItem>
    </Menu>

Didn't see the menu item but not menu... The File will be blue Edit will be red.. You datatemplate to set your style depending on the menu item

  <Menu Foreground="Red">
        <MenuItem Foreground="Blue" Header="_File"></MenuItem>
        <MenuItem Header="_Edit"></MenuItem>
    </Menu>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM