san*_*084 20 wpf border button
我试图摆脱按钮边框,只显示文本,但是即使我将borderThickness设置为0并将borderbrush设置为透明,也会显示文本周围的细线. 替代文字http://i45.tinypic.com/scywye.png
我的保存按钮的xaml代码:
<Button Content="save" Name="btnSaveEditedText"
Background="Transparent"
Foreground="White"
FontFamily="Tw Cen MT Condensed"
FontSize="30"
Margin="-280,0,0,10"
Width="60"
BorderBrush="Transparent"
BorderThickness="0"/>
Run Code Online (Sandbox Code Playgroud)
无论如何我可以摆脱按钮边框?
bit*_*onk 47
您需要覆盖Button的ControlTemplate:
<Button Content="save" Name="btnSaveEditedText"
Background="Transparent"
Foreground="White"
FontFamily="Tw Cen MT Condensed"
FontSize="30"
Margin="-280,0,0,10"
Width="60"
BorderBrush="Transparent"
BorderThickness="0">
<Button.Template>
<ControlTemplate TargetType="Button">
<ContentPresenter Content="{TemplateBinding Content}"/>
</ControlTemplate>
</Button.Template>
</Button>
Run Code Online (Sandbox Code Playgroud)
小智 11
我最近发现对此最有用的方法是让按钮使用工具栏的样式.这只会在鼠标悬停时显示按钮边框时使用图像或文本.
<Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
Content="save"
Name="btnSaveEditedText"
Background="Transparent"
Foreground="White"
FontFamily="Tw Cen MT Condensed"
FontSize="30"
Margin="-280,0,0,10"
Width="60"
BorderBrush="Transparent"
BorderThickness="0" />
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
27033 次 |
最近记录: |