Is there a standard WPF stylesheet for a "Microsoft" look?
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?
In my case / example 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 Propert开发者_如何学运维y="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.
You could find 7 WPF Themes by Microsoft on WPF Toolkit page.
精彩评论