How do I alter the default style of a button without WPF reverting from Aero to Classic?

Posted by DanM on Stack Overflow See other posts from Stack Overflow or by DanM
Published on 2010-05-25T02:45:08Z Indexed on 2010/05/25 2:51 UTC
Read the original article Hit count: 245

Filed under:
|
|

I've added PresentationFramework.Aero to my App.xaml merged dictionaries, as in...

<Application
    x:Class="TestApp.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary
                    Source="/PresentationFramework.Aero;component/themes/Aero.NormalColor.xaml" />
                <ResourceDictionary
                     Source="pack://application:,,,/WPFToolkit;component/Themes/Aero.NormalColor.xaml" />
                <ResourceDictionary
                    Source="ButtonResourceDictionary.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>

I'm trying to modify the default look of buttons just slightly. I put this style in my ButtonResourceDictionary:

<Style TargetType="Button">
    <Setter Property="Padding" Value="3" />
    <Setter Property="FontWeight" Value="Bold" />
</Style>

All buttons now have the correct padding and bold text, but they look "Classic", not "Aero". How do I fix this style so my buttons all look Aero but also have these minor changes? I would prefer not to have to set the Style property for every button.

© Stack Overflow or respective owner

Related posts about wpf

Related posts about xaml