Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/16.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
Windows WP7删除黑色边框_Windows_Windows Phone 7_Button_Border - Fatal编程技术网

Windows WP7删除黑色边框

Windows WP7删除黑色边框,windows,windows-phone-7,button,border,Windows,Windows Phone 7,Button,Border,我一直在尝试和寻找这个退出了很长一段时间了 Windows在按钮组件周围添加了黑色(或透明)边框。原因是按钮的触摸区域稍大,因此更容易点击按钮 在我的应用程序中,我确实需要删除该区域。我试了很多,但似乎不可能。我也在Expression Blend中尝试过,但运气不好 <Style x:Key="ButtonStyleCalendar" TargetType="Button"> <Setter Property="Background" Value="{

我一直在尝试和寻找这个退出了很长一段时间了

Windows在按钮组件周围添加了黑色(或透明)边框。原因是按钮的触摸区域稍大,因此更容易点击按钮

在我的应用程序中,我确实需要删除该区域。我试了很多,但似乎不可能。我也在Expression Blend中尝试过,但运气不好

    <Style x:Key="ButtonStyleCalendar" TargetType="Button">
        <Setter Property="Background" Value="{StaticResource PhoneAccentBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeSmall}"/>
        <Setter Property="Padding" Value="0"/>
        <Setter Property="Margin" Value="0" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
    </Style>

这就是我应用于按钮的样式。我认为应该是边距或填充,但不是这样

有人对此有答案吗?我搜索了一下,但没有人想出解决办法


提前谢谢

您需要覆盖按钮的
ControlTemplate
,并删除
Margin=“{StaticResource PhoneTouchTargetOverhang}”
。以下是生成的样式:

<Style x:Key="ButtonStyleCalendar" TargetType="Button">
    <Setter Property="Background" Value="Transparent"/>
    <Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/>
    <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
    <Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/>
    <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilySemiBold}"/>
    <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMediumLarge}"/>
    <Setter Property="Padding" Value="10,3,10,5"/>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="Button">
                <Grid Background="Transparent">
                    <Border x:Name="ButtonBackground" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="0" >
                        <ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
                    </Border>
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

@Unknown请回答这个问题。将帮助奥利弗以及其他偶然发现这个问题的人。