Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make WPF button look less flat

I've got 2 buttons on my form, and they both look very, very flat.

Flat Buttons

I can't seem to find a way to make them look more like:

Not Flat Button

The XAML for my buttons is:

<Button x:Name="bttnDailyReport" HorizontalAlignment="Left" Margin="618,27,0,0" VerticalAlignment="Top" Width="121" Height="93" FontFamily="Microsoft Sans Serif" FontSize="20" FontWeight="Bold" Grid.Column="1" BorderBrush="Black">
    <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center"><Run Text="  Generate"/><LineBreak/><Run Text="Daily Report"/></TextBlock>
</Button>
<Button x:Name="bttnCancel" HorizontalAlignment="Left" Margin="618,126,0,0" VerticalAlignment="Top" Width="121" Height="93" FontFamily="Microsoft Sans Serif" FontSize="20" FontWeight="Bold" Click="BttnCancelClick">
    <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center"><Run Text="Exit"/></TextBlock>
</Button>

Now, my question is, is it possible to make the buttons appear like the button in WinForms, or am I stuck with flat buttons?

like image 481
PiousVenom Avatar asked Dec 19 '12 17:12

PiousVenom


2 Answers

Seems, somewhere in your resources, flat button style is used as default style for button.

Check Styling and Templating. Either you need to override the style in your button, or give key to the default style, and apply wherever needed.

How to override a global style (that doesn't have an x:Key), or alternatively apply a named style to all type-targeted controls?

like image 57
Tilak Avatar answered Nov 18 '22 18:11

Tilak


Just reference PresentationFramework.Aero.dll in your project and add this code to to the window's XAML:

<Window.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/PresentationFramework.Aero;component/themes/aero.normalcolor.xaml" />
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Window.Resources>
like image 43
Dmitry Arestov Avatar answered Nov 18 '22 18:11

Dmitry Arestov