How to remove Glow of Button on Mouse hover in WPF

▼魔方 西西 提交于 2019-11-30 07:09:52

It's defined in Button's ControlTemplate. You should create your own.

for example like this.

<Style x:Key="MyButtonStyle" TargetType="Button">
  <Setter Property="Template">
     <Setter.Value>
        <ControlTemplate TargetType="Button">
           <Grid Background="{TemplateBinding Background}">
              <ContentPresenter HorizontalAlignment="Center"
                        VerticalAlignment="Center"/>
           </Grid>
        </ControlTemplate>
     </Setter.Value>
  </Setter>
</Style>

Then you can apply this style to your Button. and set Background to that image of yours.

<Button Style="{StaticResource MyButtonStyle}" Grid.Column="3" Name="Play" BorderBrush="Transparent"
        Focusable="False" Width="45" Height="45" Click="Play_Click"
        VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,6,10,6">
        <Button.Background >
            <ImageBrush ImageSource="images/play.png"  />
        </Button.Background>
</Button>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!