Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
749 views
in Technique[技术] by (71.8m points)

wpf - In c# XAML, How can I remove the hover-over/mouse-over effect on a menuitem image?

I have a menu using a "hamburger" image. Right now, when the user hovers the mouse over the image, the image is highlighted in an ugly kind of way. See the image that hopefully is linked.

What I would like is to change the opacity of the image on mouseover. Is there a way to do this?

I have used an image with a "Click" event and used a ControlTemplate and Trigger to assign a different image on hover. I don't see that I can change a "menu" image the same way.

I truly appreciate any help you folks can give me! This is my first c# project, and I'm learning so much through this site!

My XAML code for the menu is below:

<Menu Grid.Column="1" Grid.Row="0" HorizontalAlignment="Right" VerticalAlignment="Top" 
  Background="#FFC2DAF2">
    <MenuItem>
       <MenuItem.Header>
          <Image Width="20" Height="20" Source="FlatHamburger.png">
          </Image>
       </MenuItem.Header>
    <MenuItem x:Name="About" Header="About" Click="AboutButton_Click"/>
    <MenuItem x:Name="Setup" Header="Setup" Click="SetupButton_Click"/>
    <MenuItem x:Name="AdminTools" Header="Admin" Click="adminMenuItem_Click" Visibility="Visible"/>
    </MenuItem>
</Menu>

Current Mouseover effect

question from:https://stackoverflow.com/questions/65599320/in-c-sharp-xaml-how-can-i-remove-the-hover-over-mouse-over-effect-on-a-menuitem

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...