2012-10-06 9 views

답변

1

TargetType Window 에 대한 전역 스타일을 만들 수 있으며 환경 설정을 설정할 수 있습니다.

자원 :

<Application.Resources> 
    <Style TargetType="Window" x:Key="WindowStyle"> 
     <Setter Property="FontFamily" Value="{Binding FontFamilyPrefernce}" />      
    </Style>   
</Application.Resources> 

보기 :

<Window Style="{StaticResource WindowStyle}"> 
     <Grid> 
      <TextBox /> 
     </Grid> 
</Window> 

뷰 모델 :이 도움이

public SomeViewModel() 
    { 
     FontFamilyPrefernce = new FontFamily("Algerian"); 
    } 

    private FontFamily fontFamilyPrefernce; 
    public FontFamily FontFamilyPrefernce 
    { 
     get {return fontFamilyPrefernce ;} 
     set 
     { 
      fontFamilyPrefernce = value; 
      OnPropertyChanged("FontFamilyPrefernce"); 
     } 
    } 

희망 ..