Hello!

How to change text color in MenuItem WPF? Setting the Foreground property to the desired color does not give a result

<Menu Background="LightSlateGray" Foreground="White"> <MenuItem Header="{Resx Menu_File}"> <MenuItem Header="{Resx Menu_File_Exit}" Command="{Binding CmdExit}"/> </MenuItem> </Menu> 

enter image description here

  • If you are given the correct answer, then mark it as correct. - Dmitry Chistik

2 answers 2

 <Menu Background="LightSlateGray" Foreground="White"> <MenuItem Header="{Resx Menu_File}" Foreground="Red"> <MenuItem Header="{Resx Menu_File_Exit}" Command="{Binding CmdExit}" Foreground="Blue"/> </MenuItem> </Menu> 
  • Thanks for the answer! I noticed that if the parent MenuItem Foreground does not change, and in the child change, then in the child the color does not change. It is necessary to set Foreground both in the parent MenuItem and in the child - Olejan
 <Menu> <MenuItem Header="File"> <MenuItem.Resources> <Style TargetType="MenuItem"> <Setter Property="Foreground" Value="Red"></Setter> </Style> </MenuItem.Resources> <MenuItem Header="Open"/> <MenuItem Header="Save"/> <MenuItem Header="Save as..."/> <MenuItem Header="Exit" /> </MenuItem> </Menu> 

enter image description here