Setting the FlatStyle Button in WPF

I just found out how styles and control patterns in WPF can affect the appearance of buttons,

I am trying to install Button FlatStyle, in the resources that I saw, I can not find anything that tells me how I can do this, in Windows Forms this is set via FlatStyle = Flat.

How to do it in WPF?

+56
c # controls styles wpf
Mar 30 '09 at 14:10
source share
2 answers

The ToolBar class defines a Style that makes Button flat. An example of its use:

 <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"/> 

WPF allows you to fully customize the controls to look the way you want, so it does not have a specific FlatStyle property in the Button control.

+134
Mar 30 '09 at 14:14
source share

Add the following resources to your Window / page resources:

 <Style BasedOn="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" TargetType="Button"></Style> 

It will apply a flat style to all buttons in the styles area.

+23
05 Oct '12 at 10:19
source share



All Articles