Click here to Skip to main content
11,712,503 members (75,344 online)
Click here to Skip to main content
Add your own
alternative version

Visual Studio 2012 Metro Styles for WPF

, 9 Dec 2012 CPOL 207.7K 45.1K 202
Black Metro Styles for Button, ListBox, Menu, ScrollBar, TabControl, TextBox, ComboBox, DataGrid and GroupBox
demo.zip
demo
MahApps.Metro.dll
Selen.Wpf.Core.dll
Selen.Wpf.Core.pdb
Selen.Wpf.DemoApplication.exe
Selen.Wpf.DemoApplication.pdb
Selen.Wpf.GenericAppTree.Contracts.dll
Selen.Wpf.GenericAppTree.Contracts.pdb
Selen.Wpf.GenericAppTree.dll
Selen.Wpf.GenericAppTree.pdb
Selen.Wpf.SystemStyles.dll
Selen.Wpf.SystemStyles.pdb
System.Windows.Interactivity.dll
source.zip
source
lib
MahApps.Metro.dll
System.Windows.Interactivity.dll
Selen.Wpf.Core
Properties
Settings.settings
Selen.Wpf.Core.csproj.user
Selen.Wpf.Key.snk
Selen.Wpf.DemoApplication
Images
SplashScreen.png
standard.png
Properties
Settings.settings
Selen.Wpf.GenericAppTree
Selen.Wpf.GenericAppTree.Contracts
Properties
Selen.Wpf.Key.snk
Properties
Selen.Wpf.Key.snk
Selen.Wpf.SystemStyles
Actions
Properties
Settings.settings
Selen.Wpf.Key.snk
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/Selen.Wpf.Core;component/Resources.xaml"/>
    </ResourceDictionary.MergedDictionaries>
    <Style x:Key="StandardDataGrid" TargetType="DataGrid">
        <Setter Property="SelectionUnit" Value="Cell"/>
        <Setter Property="GridLinesVisibility" Value="None"/>
        <Setter Property="HeadersVisibility" Value="Column"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="Background" Value="{StaticResource LightBackground}"/>
        <Setter Property="RowBackground" Value="{StaticResource LightBackground}"/>
        <Style.Resources>
            <Style x:Key="ColumnHeaderGripperStyle" TargetType="{x:Type Thumb}">
                <Setter Property="Width" Value="8"/>
                <Setter Property="Background" Value="Transparent"/>
                <Setter Property="Cursor" Value="SizeWE"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Thumb}">
                            <Border Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}"/>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style TargetType="{x:Type DataGridColumnHeader}">
                <Setter Property="SnapsToDevicePixels" Value="True"/>
                <Setter Property="MinWidth" Value="120"/>
                <Setter Property="MinHeight" Value="28"/>
                <Setter Property="Cursor" Value="Hand"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type DataGridColumnHeader}">
                            <Grid>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>
                                    <Border x:Name="BackgroundBorder" Grid.ColumnSpan="2" Background="{StaticResource BackgroundSelected}"/>
                                    <TextBlock Foreground="{StaticResource Foreground}" FontSize="14" FontWeight="SemiBold">
                                        <ContentPresenter Margin="6,3,6,3" VerticalAlignment="Center"/>
                                    </TextBlock>
                                    <Path x:Name="SortArrow" Visibility="Collapsed" Data="M0,0 L1,0 0.5,1 z" Stretch="Fill" 
                                      Grid.Column="1" Width="8" Height="6" Fill="{StaticResource Foreground}" Margin="0,0,8,0" 
                                      VerticalAlignment="Center" RenderTransformOrigin="0.5,0.4" />
                                </Grid>
                                <Thumb x:Name="PART_LeftHeaderGripper" HorizontalAlignment="Left" Style="{StaticResource ColumnHeaderGripperStyle}"/>
                                <Thumb x:Name="PART_RightHeaderGripper" HorizontalAlignment="Right" Style="{StaticResource ColumnHeaderGripperStyle}"/>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="SortDirection" Value="{x:Null}">
                                    <Setter TargetName="BackgroundBorder" Property="Background" Value="{StaticResource BackgroundNormal}"/>
                                </Trigger>
                                <MultiTrigger>
                                    <MultiTrigger.Conditions>
                                        <Condition Property="IsMouseOver" Value="true" />
                                        <Condition Property="SortDirection" Value="{x:Null}" />
                                    </MultiTrigger.Conditions>
                                    <Setter TargetName="BackgroundBorder" Property="Background" Value="{StaticResource BackgroundHighlighted}"/>
                                </MultiTrigger>
                                <Trigger Property="SortDirection" Value="Ascending">
                                    <Setter TargetName="SortArrow" Property="Visibility" Value="Visible"/>
                                    <Setter TargetName="SortArrow" Property="RenderTransform">
                                        <Setter.Value>
                                            <RotateTransform Angle="180"/>
                                        </Setter.Value>
                                    </Setter>
                                </Trigger>
                                <Trigger Property="SortDirection" Value="Descending">
                                    <Setter TargetName="SortArrow" Property="Visibility" Value="Visible"/>
                                </Trigger>
                                <Trigger Property="DisplayIndex" Value="0">
                                    <Setter Property="Visibility" Value="Collapsed" TargetName="PART_LeftHeaderGripper"></Setter>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style TargetType="{x:Type DataGridCell}">
                <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                <Setter Property="Background" Value="Transparent" />
                <Setter Property="MinHeight" Value="28" />
                <Setter Property="Foreground" Value="{StaticResource Foreground}"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type DataGridCell}">
                            <Border Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                                <ContentPresenter Margin="6,3,6,3" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                            </Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Background" Value="{StaticResource BackgroundHighlighted}"/>
                                </Trigger>
                                <Trigger Property="IsSelected" Value="True">
                                    <Setter Property="Background" Value="{StaticResource BackgroundSelected}"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </Style.Resources>
    </Style>
</ResourceDictionary>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Winfried Lötzsch
Student
Germany Germany
I´m a student and hobby programmer (mostly C#) from Germany.
For those German guys, who might be looking for a translated version of my stuff, I´m running a blog.

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150819.1 | Last Updated 9 Dec 2012
Article Copyright 2012 by Winfried Lötzsch
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid