When we hover over the MenuItem with a mouse, a focus rectangle is drawn on it, how to change its background color and frame color, pattern? I did not find anything about it in the MenuItem template

    1 answer 1

    What you mean is not the focus; the focus can (and usually always) be on another menu item or on another control. You also need a highlighted (highlighted) menu item, respectively, in the element template, see the trigger

    <Trigger Property="IsHighlighted" Value="True"> 

    It is it that works when you hover over a menu item, in particular, the color of the frame changes here:

     <Setter Property="Fill" TargetName="Bg"> <Setter.Value> <LinearGradientBrush EndPoint="0,1" StartPoint="0,0"> <GradientStop Color="#34C5EBFF" Offset="0"/> <GradientStop Color="#3481D8FF" Offset="1"/> </LinearGradientBrush> </Setter.Value> </Setter> 

    If in the gradient you replace the first color with Red and the second with Green, you get this:

    enter image description here

    • I would also add that what the vehicle needs is not a focus. - VladD