gpt4 book ai didi

windows - WP7 去除黑边

转载 作者:可可西里 更新时间:2023-11-01 11:35:05 29 4
gpt4 key购买 nike

我一直在尝试并寻找这个已经退出很长时间了。

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

在我的应用程序中,我确实需要删除该区域。我尝试了很多,但似乎这是不可能的。我也在 E​​xpression 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>

这是我应用到按钮的样式。我认为应该是边距或填充,但事实并非如此。

有人对此有答案吗?我搜索了 stackoverflow,但没有人提出解决方案。

提前致谢!

最佳答案

您需要覆盖 Button 的 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>

关于windows - WP7 去除黑边,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13422577/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com