Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/315.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# WPF按钮移除";模糊“;从按钮_C#_Wpf_Xaml - Fatal编程技术网

C# WPF按钮移除";模糊“;从按钮

C# WPF按钮移除";模糊“;从按钮,c#,wpf,xaml,C#,Wpf,Xaml,嗨,我正在尝试个性化的按钮在我的wpf 原因当用户将鼠标悬停在按钮上时,会显示“默认样式” 如下图所示: 因为我不想在鼠标放在按钮上时显示deful blue和border元素,所以我为我的按钮创建了这个样式 <Style x:Key="Simple" TargetType="Button"> <Setter Property="Template"> <Setter.Value> <ControlTem

嗨,我正在尝试个性化的按钮在我的wpf 原因当用户将鼠标悬停在按钮上时,会显示“默认样式” 如下图所示:

因为我不想在鼠标放在按钮上时显示deful blue和border元素,所以我为我的按钮创建了这个样式

<Style x:Key="Simple" TargetType="Button">

    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="Button">
                <Border SnapsToDevicePixels="True" CornerRadius="3" Background="{TemplateBinding Background}" BorderBrush="#399bff" BorderThickness="0">
                    <Border.Effect>
                        <DropShadowEffect ShadowDepth="0" BlurRadius="0"></DropShadowEffect>
                    </Border.Effect>

                    <Grid SnapsToDevicePixels="True">

                        <Path SnapsToDevicePixels="True" Width="9" Height="16.5" Stretch="Fill"  HorizontalAlignment="Left" Margin="16.5,0,0,0"  Opacity="0">

                        </Path>
                        <Path SnapsToDevicePixels="True" x:Name="PathIcon" Width="8" Height="15"  Stretch="Fill"  HorizontalAlignment="Left" Margin="17,0,0,0">

                        </Path>

                        <ContentPresenter SnapsToDevicePixels="True" Content="{TemplateBinding Content}" ></ContentPresenter>
                    </Grid>
                </Border>
                <ControlTemplate.Triggers>
                    <Trigger Property="IsMouseOver" Value="True">
                        <Setter Property="Background" Value="Transparent"></Setter>
                        <Setter Property="BorderBrush" Value="Transparent"></Setter>
                        <Setter Property="Opacity" Value="0.8"></Setter>
                        <Setter Property="SnapsToDevicePixels" Value="True"></Setter>
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

但它在我的按钮中创建了某种模糊或边框,正如您在 图中的NF-e按钮(左蓝色)

应与CT-e按钮(右橙色按钮)相同

我的XAML风格有什么问题

编辑

按钮是XAML代码

<Border  HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10 10 5 5" BorderThickness="0" Width="150" Height="150" Background="#992086bf" CornerRadius="10">
        <Button Style="{StaticResource Simple}" Click="GoToNFeEntrada" Background="Transparent" BorderBrush="Transparent">
            <Grid Width="150" Height="150">
                <fa:ImageAwesome Icon="File" Width="50" Foreground="White" VerticalAlignment="Top" Margin="0 30 0 0"></fa:ImageAwesome>
                <Label VerticalAlignment="Bottom" Margin="10 0 0 5" FontSize="15" Foreground="White">NF-e</Label>
            </Grid>
        </Button>
    </Border>

核因子e

解决方案是删除此行

<Border.Effect>
     <DropShadowEffect ShadowDepth="0" BlurRadius="0"></DropShadowEffect>
</Border.Effect>


这是在内容中创建了一些边框

不,我刚从样式中删除了它,它一直显示灰色的东西你能显示按钮的内容绑定吗?一切看起来都很好,很容易被发现,因为按钮的设置与其他按钮不同。编辑:是的,我以为你在触发鼠标,直到我看到你的第一张图片也有同样的问题。@TyCobb我用按钮代码更新了答案,但我猜这是与样式有关的原因,在我使用它之前,是确定的,其余的按钮也使用标签吗?我看不出有什么疯狂的。所有的按钮不是都有相同的效果吗?是的,但我只应用了一个按钮,现在我将把样式应用到另一个。我的印象是所有的按钮都在使用这种样式…不,我是在显示按钮有“默认”样式,我写了一个代码来修改它,但是它用这种边界效果覆盖了内容