0

I wanted to remove Background Change on hover of my menuItems. For Buttons this works great:

 <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Border Background="{TemplateBinding Background}">
                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>

But for MenuItem I tried mostly everything but These two are kinda Close to what I want to have.

Here everything works except if I click it nothing happens:

<Grid Background="{TemplateBinding Background}">
                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Content="{TemplateBinding Header}"/>                              
                        </Grid>

Or number 2, whit this the hover Color and the Header dont work but the click works:

<Grid Background="{TemplateBinding Background}">
                            <MenuItem HorizontalAlignment="Center" VerticalAlignment="Center" Header="{TemplateBinding Header}"/>
                        </Grid>

The same happens if I replace Grid with Border.

What is wrong here?

Nico.E
  • 82
  • 11
  • Possible duplicate of [Change Background color of MenuItem on MouseOver](https://stackoverflow.com/questions/34888636/change-background-color-of-menuitem-on-mouseover) – dymanoid Jun 07 '18 at 15:49
  • yeah it is, but the answere doesnt work for me. The Background changes on hover but the Header text and the command doesnt work :/ – Nico.E Jun 08 '18 at 07:03

0 Answers0