WPF平按钮 [英] wpf flat button
本文介绍了WPF平按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使在WPF按钮扁平风格?
我试过支持算法FMP属性,但它不工作。
How to make a button flat style in wpf? I've tried BasedOn property but it does not work.
推荐答案
只是为了让你开始:
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Page.Resources>
<Style x:Key="Flat">
<Setter Property="Control.Background" Value="{x:Null}" />
<Setter Property="Control.BorderBrush" Value="{x:Null}" />
<Style.Triggers>
<Trigger Property="Control.IsMouseOver" Value="True">
<Setter Property="Control.Background" Value="{x:Null}" />
<Setter Property="Control.BorderBrush" Value="{x:Null}" />
<Setter Property="Control.FontWeight" Value="Bold" />
</Trigger>
<Trigger Property="Control.IsFocused" Value="True">
<Setter Property="Control.FontWeight" Value="Bold" />
</Trigger>
</Style.Triggers>
</Style>
</Page.Resources>
<StackPanel>
<Button Style="{StaticResource Flat}">Hello</Button>
</StackPanel>
</Page>
然后你有一个米伦其他的方式来做到这一点,甚至改变了控件模板
来完成重新定义按钮
这篇关于WPF平按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文