How ma make a button flat style in wpf? I've tried BasedOn property but it does not work.
Nice overview to have it handy.
Eduardo Molteni
2010-01-14 13:28:54
+4
A:
Just to get you started:
<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>
Then you have one millon other ways to do it, even changing the ControlTemplate
to complete redefine the Button
Eduardo Molteni
2010-01-14 13:27:03