When you hover over a button, the focus is lost when the cursor is in an empty space between the button border and the button text.

Hover Backlight (green)

enter image description here

Here is the cursor between the + and the button border:

enter image description here

<Button x:Name="button_asave_plus" Content="+" HorizontalAlignment="Left" Margin="262,0,0,0" VerticalAlignment="Top" Width="20" Style="{DynamicResource ButtonStyle}"/> 

Style:

 <Style x:Key="ButtonStyle" TargetType="{x:Type Button}"> <!--<Setter Property="Background" Value="#444444" />--> <Setter Property="SnapsToDevicePixels" Value="true"/> <Setter Property="OverridesDefaultStyle" Value="true"/> <Setter Property="Foreground" Value="#FFFFFF" /> <!--<Setter Property="Button.Background" Value="#00FF00" />--> <Setter Property="Background" Value="#00FF00" /> <Setter Property="BorderBrush" Value="#555555"/> <Setter Property="BorderThickness" Value="1,1,1,1"/> <!--<Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>--> <!--<Setter Property="MinHeight" Value="23"/> <Setter Property="MinWidth" Value="75"/>--> <Setter Property="Template" > <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border x:Name="Border" CornerRadius="0" BorderThickness="1" > <ContentPresenter Margin="2" HorizontalAlignment="Center" VerticalAlignment="Center" RecognizesAccessKey="True" /> </Border> <ControlTemplate.Triggers> <Trigger Property="IsKeyboardFocused" Value="true"> <Setter TargetName="Border" Property="BorderBrush" Value="#555555" /> <Setter Property="Foreground" Value="#90EE90" /> </Trigger> <Trigger Property="IsKeyboardFocused" Value="false"> <Setter TargetName="Border" Property="BorderBrush" Value="#555555" /> <Setter Property="Foreground" Value="#CCCCCC" /> </Trigger> <Trigger Property="IsDefaulted" Value="true"> <Setter TargetName="Border" Property="BorderBrush" Value="#555555" /> <Setter Property="Foreground" Value="#CCCCCC" /> </Trigger> <!--Цвет при наведении мыши --> <Trigger Property="IsMouseOver" Value="true"> <!--<Setter TargetName="Button.Static.Background" Property="Background" Value="#000F00" />--> <Setter TargetName="Border" Property="BorderBrush" Value="#90EE90" /> <Setter Property="Foreground" Value="#90EE90" /> <!--<Setter Property="BorderThickness" Value="1,1,1,1"/>--> </Trigger> <!--Цвет при нажатии мыши--> <!--<Trigger Property="IsPressed" Value="true"> --> <!--<Setter Property="Background" Value="#000000" />--> <!-- <Setter TargetName="Border" Property="BorderBrush" Value="#90EE90" /> <Setter Property="Foreground" Value="#90EE90" /> </Trigger>--> <!--<Trigger Property="IsEnabled" Value="false"> <Setter TargetName="Border" Property="BorderBrush" Value="#555555" /> </Trigger>--> <!--<Trigger Property="IsEnabled" Value="false"> <Setter TargetName="Border" Property="BorderBrush" Value="#555555" /> <Setter Property="Foreground" Value="#90EE90" /> </Trigger>--> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> 

    1 answer 1

    The MouseMove (and, accordingly, the IsMouseOver property) does not fire on elements with no background ( Brackground ), and by default the Border element does not have one (it is null ).

     ... <ControlTemplate TargetType="{x:Type Button}"> <!-- Привязываем фон Border к фону стиля --> <Border x:Name="Border" CornerRadius="0" BorderThickness="1" Background="{TemplateBinding Background}"> <ContentPresenter ...