■ ResourceDictionary 엘리먼트의 Source 속성을 사용해 특정 윈도우즈 테마를 설정하는 방법을 보여준다.
▶ MainApplication.xaml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
<Application x:Class="TestProject.MainApplication" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" StartupUri="MainWindow.xaml"> <Application.Resources> <!--ResourceDictionary Source="/PresentationFramework.Classic, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL;component/themes/classic.xaml" /--> <!--ResourceDictionary Source="/PresentationFramework.Aero, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL;component/themes/aero.normalcolor.xaml" /--> <!--ResourceDictionary Source="/PresentationFramework.Luna, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL;component/themes/luna.metallic.xaml" /--> <!--ResourceDictionary Source="/PresentationFramework.Luna, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL;component/themes/luna.homestead.xaml" /--> <ResourceDictionary Source="/PresentationFramework.Royale, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL;component/themes/royale.normalcolor.xaml" /> </Application.Resources> </Application> |
▶ MainWindow.xaml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
<Window x:Class="TestProject.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="800" Height="600" Title="ResourceDictionary 엘리먼트 : Source 속성을 사용해 특정 윈도우즈 테마 설정하기" FontFamily="나눔고딕코딩" FontSize="16"> <Grid> <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> <Button Width="100" Height="30" Content="Test" /> <StackPanel HorizontalAlignment="Center" Margin="0 10 0 0" Orientation="Horizontal"> <RadioButton Content="예" /> <RadioButton Margin="10 0 0 0" Content="아니오" /> </StackPanel> <ListBox Margin="0 10 0 0" Width="200" Height="100"> <TextBlock>서울</TextBlock> <TextBlock>인천</TextBlock> <TextBlock>수원</TextBlock> <TextBlock>대전</TextBlock> <TextBlock>대구</TextBlock> <TextBlock>울산</TextBlock> <TextBlock>광주</TextBlock> <TextBlock>부산</TextBlock> </ListBox> </StackPanel> </Grid> </Window> |
※ PresentationFramework.Aero 어셈블리를 참조한다.