2014-02-13 3 views
0

MetroWindow의 배경을 어떻게 변경합니까?MetroWindow (MahApp)의 배경 변경

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
       xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro" 
       xmlns:Behaviours="clr-namespace:MahApps.Metro.Behaviours" 
       xmlns:Converters="clr-namespace:MahApps.Metro.Converters" 
       xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"> 

<Style BasedOn="{StaticResource {x:Type Controls:MetroWindow}}" TargetType="Controls:MetroWindow"> 
    <Setter Property="Background" Value="LightGray" /> 
    <Setter Property="BorderBrush" Value="#FFB9B9B9" /> 
    <Setter Property="BorderThickness" Value="0,1,0,0" /> 
</Style> 

답변

1

<Style x:Key="CustomMetroWindowStyle" TargetType="{x:Type Controls:MetroWindow}"> 
    <Setter Property="Background" 
      Value="LightGray" /> 
    <Setter Property="BorderBrush" 
      Value="#FFB9B9B9" /> 
    <Setter Property="BorderThickness" 
      Value="0,1,0,0" /> 
</Style> 

및 사용을 열쇠로 스타일을 만드는 (당신의 App.xaml이나 리소스 사전에 스타일을 넣어 당신의 App.xaml에 넣고) 이게 맘에 든다.

<Controls:MetroWindow x:Class="MetroDemo.MainWindow" 
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
         Style="{DynamicResource CustomMetroWindowStyle}"> 
</Controls:MetroWindow>