WPFã§ã»ãã®ãã¹ã¯ããããã¼ããé©ç¨ããæ¹æ³
以ä¸ã®ï¼ã¤ã®blogãåèã«ããã¦ããã ãã¾ããã
http://notstatic.com/archives/56
WPF: Changing control style based on the system theme – Lester's XAML Blog
WPFã§ã¯ãLunaãRoyaleã¨ãã£ããã¤ã¯ãã½ããå
¬å¼ã®ãã¼ããç°¡åã«é©ç¨ãããæ¹æ³ãç¨æããã¦ãã¾ãã以ä¸ã«ãã®æ¹æ³ãç´¹ä»ãã¾ãã
åç
§è¨å®ã§ä¸è¨ã®ï¼ã¤ã®ã¢ã»ã³ããªã追å ãã¾ãã
- PresentationFramework.Aero.dll
- PresentationFramework.Classic.dll
- PresentationFramework.Luna.dll
- PresentationFramework.Royale.dll
XAMLã³ã¼ãã¯ä¸è¨ã®ããã«è¨è¿°ãã¾ãã
XAML
<Window x:Class="Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Theme" Height="300" Width="370"
>
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.4*"/>
<ColumnDefinition Width="0.3*"/>
<ColumnDefinition Width="0.3*"/>
</Grid.ColumnDefinitions>
<Grid.Resources>
<ResourceDictionary Source="/presentationframework.Aero;component/themes/aero.normalcolor.xaml" />
</Grid.Resources>
<Button Grid.Column="0" Margin="10">aero.normalcolor</Button>
<ProgressBar Grid.Column="1" Margin="10" Value="50"/>
<ScrollBar Grid.Column="2" Orientation="Horizontal"/>
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.4*"/>
<ColumnDefinition Width="0.3*"/>
<ColumnDefinition Width="0.3*"/>
</Grid.ColumnDefinitions>
<Grid.Resources>
<ResourceDictionary Source="/presentationframework.Luna;component/themes/luna.normalcolor.xaml" />
</Grid.Resources>
<Button Grid.Column="0" Margin="10">luna.normalcolor</Button>
<ProgressBar Grid.Column="1" Margin="10" Value="50"/>
<ScrollBar Grid.Column="2" Orientation="Horizontal"/>
</Grid>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.4*"/>
<ColumnDefinition Width="0.3*"/>
<ColumnDefinition Width="0.3*"/>
</Grid.ColumnDefinitions>
<Grid.Resources>
<ResourceDictionary Source="/presentationframework.Luna;component/themes/luna.homestead.xaml" />
</Grid.Resources>
<Button Grid.Column="0" Margin="10">luna.homestead</Button>
<ProgressBar Grid.Column="1" Margin="10" Value="50"/>
<ScrollBar Grid.Column="2" Orientation="Horizontal"/>
</Grid>
<Grid Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.4*"/>
<ColumnDefinition Width="0.3*"/>
<ColumnDefinition Width="0.3*"/>
</Grid.ColumnDefinitions>
<Grid.Resources>
<ResourceDictionary Source="/presentationframework.Luna;component/themes/luna.metallic.xaml" />
</Grid.Resources>
<Button Grid.Column="0" Margin="10">luna.metallic</Button>
<ProgressBar Grid.Column="1" Margin="10" Value="50"/>
<ScrollBar Grid.Column="2" Orientation="Horizontal"/>
</Grid>
<Grid Grid.Row="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.4*"/>
<ColumnDefinition Width="0.3*"/>
<ColumnDefinition Width="0.3*"/>
</Grid.ColumnDefinitions>
<Grid.Resources>
<ResourceDictionary Source="/presentationframework.Royale;component/themes/royale.normalcolor.xaml" />
</Grid.Resources>
<Button Grid.Column="0" Margin="10">royale.normalcolor</Button>
<ProgressBar Grid.Column="1" Margin="10" Value="50"/>
<ScrollBar Grid.Column="2" Orientation="Horizontal"/>
</Grid>
<Grid Grid.Row="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.4*"/>
<ColumnDefinition Width="0.3*"/>
<ColumnDefinition Width="0.3*"/>
</Grid.ColumnDefinitions>
<Grid.Resources>
<ResourceDictionary Source="/presentationframework.Classic;component/themes/classic.xaml" />
</Grid.Resources>
<Button Grid.Column="0" Margin="10">classic</Button>
<ProgressBar Grid.Column="1" Margin="10" Value="50"/>
<ScrollBar Grid.Column="2" Orientation="Horizontal"/>
</Grid>
</Grid>
</Window>
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Theme" Height="300" Width="370"
>
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.4*"/>
<ColumnDefinition Width="0.3*"/>
<ColumnDefinition Width="0.3*"/>
</Grid.ColumnDefinitions>
<Grid.Resources>
<ResourceDictionary Source="/presentationframework.Aero;component/themes/aero.normalcolor.xaml" />
</Grid.Resources>
<Button Grid.Column="0" Margin="10">aero.normalcolor</Button>
<ProgressBar Grid.Column="1" Margin="10" Value="50"/>
<ScrollBar Grid.Column="2" Orientation="Horizontal"/>
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.4*"/>
<ColumnDefinition Width="0.3*"/>
<ColumnDefinition Width="0.3*"/>
</Grid.ColumnDefinitions>
<Grid.Resources>
<ResourceDictionary Source="/presentationframework.Luna;component/themes/luna.normalcolor.xaml" />
</Grid.Resources>
<Button Grid.Column="0" Margin="10">luna.normalcolor</Button>
<ProgressBar Grid.Column="1" Margin="10" Value="50"/>
<ScrollBar Grid.Column="2" Orientation="Horizontal"/>
</Grid>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.4*"/>
<ColumnDefinition Width="0.3*"/>
<ColumnDefinition Width="0.3*"/>
</Grid.ColumnDefinitions>
<Grid.Resources>
<ResourceDictionary Source="/presentationframework.Luna;component/themes/luna.homestead.xaml" />
</Grid.Resources>
<Button Grid.Column="0" Margin="10">luna.homestead</Button>
<ProgressBar Grid.Column="1" Margin="10" Value="50"/>
<ScrollBar Grid.Column="2" Orientation="Horizontal"/>
</Grid>
<Grid Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.4*"/>
<ColumnDefinition Width="0.3*"/>
<ColumnDefinition Width="0.3*"/>
</Grid.ColumnDefinitions>
<Grid.Resources>
<ResourceDictionary Source="/presentationframework.Luna;component/themes/luna.metallic.xaml" />
</Grid.Resources>
<Button Grid.Column="0" Margin="10">luna.metallic</Button>
<ProgressBar Grid.Column="1" Margin="10" Value="50"/>
<ScrollBar Grid.Column="2" Orientation="Horizontal"/>
</Grid>
<Grid Grid.Row="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.4*"/>
<ColumnDefinition Width="0.3*"/>
<ColumnDefinition Width="0.3*"/>
</Grid.ColumnDefinitions>
<Grid.Resources>
<ResourceDictionary Source="/presentationframework.Royale;component/themes/royale.normalcolor.xaml" />
</Grid.Resources>
<Button Grid.Column="0" Margin="10">royale.normalcolor</Button>
<ProgressBar Grid.Column="1" Margin="10" Value="50"/>
<ScrollBar Grid.Column="2" Orientation="Horizontal"/>
</Grid>
<Grid Grid.Row="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.4*"/>
<ColumnDefinition Width="0.3*"/>
<ColumnDefinition Width="0.3*"/>
</Grid.ColumnDefinitions>
<Grid.Resources>
<ResourceDictionary Source="/presentationframework.Classic;component/themes/classic.xaml" />
</Grid.Resources>
<Button Grid.Column="0" Margin="10">classic</Button>
<ProgressBar Grid.Column="1" Margin="10" Value="50"/>
<ScrollBar Grid.Column="2" Orientation="Horizontal"/>
</Grid>
</Grid>
</Window>
å®è¡ããã¨ãä¸è¨ã®ããã«åãã¼ããé©ç¨ãããç¶æ ã®ãã¿ã³ãããã°ã¬ã¹ãã¼ãæç»ããã¾ãã