---
title: "wpf button如何去掉鼠标悬停效果"
author: "xdwangiflytek"
date: "2014-06-04T19:01:09Z"
tags: ["Button", "WPF", "样式"]
categories: ["编程语言"]
slug: "wpf-button"
draft: false
lastmod: "2014-06-04T19:01:09Z"
id: 2075998
url: "https://xdwangiflytek.iteye.com/blog/2075998"
---

如题，代码如下：

 

```
    <Style x:Key="NoMouseOverButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Padding" Value="1"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Border x:Name="Chrome" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
                        <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
```