views:

33

answers:

1

I have a simple window.

<Window x:Class="WPFTest.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    SnapsToDevicePixels="True">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <GroupBox Header="My checkboxes">
          <StackPanel >
                <CheckBox>First</CheckBox>
                <CheckBox>Second</CheckBox>
                <CheckBox>Third</CheckBox>
            </StackPanel>
        </GroupBox>
        <StackPanel Grid.Row="1" Grid.ColumnSpan="2"
                    Orientation="Horizontal"
                    HorizontalAlignment="Right">
            <Button>OK</Button>
            <Button>Cancel</Button>
        </StackPanel>
    </Grid>
</Window>

This is how it looks:

I can think of the following styles group

<Window.Resources>
    <Style TargetType="CheckBox">
        <Setter Property="Margin" Value="0,8,0,0"/>
    </Style>
    <Style TargetType="Grid">
        <Setter Property="Margin" Value="8"/>
    </Style>
    <Style TargetType="StackPanel">
        <Setter Property="Margin" Value="0"/>
    </Style>
    <Style TargetType="GroupBox">
        <Setter Property="Padding" Value="8"/>
    </Style>
    <Style TargetType="Button">
        <Setter Property="Margin" Value="8,0,0,0"/>
        <Setter Property="Padding" Value="8"/>
        <Setter Property="MinWidth" Value="70"/>
    </Style>
</Window.Resources>

Together with this change of the first checkbox:

<CheckBox Margin="0">First</CheckBox>

It makes the window look this way:

It's not perfect, but it's much better than it was without styles applied.

So the question is, is there somewhere some polished stylesheet (and guidelines for its usage) that can be applied to any window to give it a proper "Microsoft" look?

+2  A: 

You could find 7 WPF Themes by Microsoft on WPF Toolkit page.

madgnome
Thank you, but it's not what I need. I need proper sizes and margins to all controls, and the themes on that page only change colors.
Mikhail Orlov