본문 바로가기
C#/C# WPF

Style 사용

by doublerabbits 2022. 9. 17.

A : Style 이 있는 프로젝트

B : A에 있는 Style 을 사용할 프로젝트

 

  • A 에 리소스 사전 추가

 

  • ButtonDictionary.xaml 추가된 상태

 

 

  • B 의 App.xaml 에서 리소스 파일을 연결한다.
<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="ButtonDictionary.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>

 

 

  • B 의 xaml 파일에 Style 을 적용한다.
<Grid>
    <Button Style="{DynamicResource RB_White}" Content="Style"/>
</Grid>

 

'C# > C# WPF' 카테고리의 다른 글

이벤트 라우팅(Event Routing)  (0) 2022.09.30
UserControl WindowStyle  (0) 2022.09.27
PrismMVVMLibrary  (0) 2022.09.12
Button 비활성화 상태에서 클릭 처리  (0) 2022.08.20
Progress with Async/Await  (0) 2022.08.15