728x90
반응형
728x170
1. ResourceMerger.exe 파일은 대상 솔루션 폴더 아래의 Tool 폴더에 복사한다.
728x90
2. 대상 프로젝트에서 스타일 파일과 폴더는 아래와 같이 구성되어 있다.
TestProject (프로젝트)
STYLE (폴더)
Button.xaml
CheckBox.xaml
Styles.xaml
300x250
3. 스타일 파일은 아래와 같이 구성되어 있다.
▶ Button.xaml
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="ButtonStyleKey" TargetType="{x:Type Button}">
...
</Style>
...
</ResourceDictionary>
▶ CheckBox.xaml
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="CheckBoxStyleKey" TargetType="{x:Type CheckBox}">
...
</Style>
...
</ResourceDictionary>
▶ Styles.xaml
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/STYLE/Button.xaml" />
<ResourceDictionary Source="/STYLE/CheckBox.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
4. 비주얼 스튜디오를 실행한다.
5. 작업 대상 프로젝트를 로드한다.
6. 솔루션 탐색기에서 해당 프로젝트에서 마우스 오른쪽 버튼을 클릭한다.
7. 컨텍스트 메뉴에서 [속성] 메뉴를 클릭한다.
8. [빌드 이벤트] 텝의 [빌드 이벤트 명령줄 대화 상자] 항목에 아래와 같이 입력한다.
"$(SolutionDir)\Tool\ResourceMerger.exe" "$(ProjectDir)\" "$(ProjectName)" "STYLE\Styles.xaml" "STYLE\FullStyles.xaml"
9. 해당 프로젝트의 파일을 아래와 같이 수정한다.
[변경 전]
<Page Include="STYLE\Button.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="STYLE\CheckBox.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="STYLE\Styles.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
[변경 후]
<Page Include="Shell\Styles\Button.xaml"
Condition="'$(DesignTime)'=='true' AND '$(BuildingInsideVisualStudio)'!='true' AND '$(BuildingInsideExpressionBlend)'!='true'">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Shell\Styles\CheckBox.xaml"
Condition="'$(DesignTime)'=='true' AND '$(BuildingInsideVisualStudio)'!='true' AND '$(BuildingInsideExpressionBlend)'!='true'">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<None Include="STYLE\Styles.xaml">
<SubType>Designer</SubType>
</None>
<Page Include="STYLE\FullStyles.xaml">
<DependentUpon>Styles.xaml</DependentUpon>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
728x90
반응형
그리드형(광고전용)
'C# > WPF' 카테고리의 다른 글
[C#/WPF] MultiSelector 클래스 : 선택/이동/크기 변경 가능한 캔버스 사용하기 (0) | 2021.02.13 |
---|---|
[C#/WPF] Canvas 클래스 : 자식 엘리먼트 드래그하기 (0) | 2021.02.13 |
[C#/WPF] ListBox 클래스 : 확장 가능한 리스트 박스 사용하기 (0) | 2021.02.12 |
[C#/WPF] 누겟 설치 : System.Windows.Interactivity.WPF (0) | 2021.02.12 |
[C#/WPF] 디자인 타임에서 리소스 딕셔너리 로드하기 (0) | 2021.02.12 |
[C#/WPF] 리소스 병합하기 (0) | 2021.02.12 |
[C#/WPF] 애니메이션 메시지 컨트롤 사용하기 (0) | 2021.02.11 |
[C#/WPF] 3D 애니메이션 시계 사용하기 (0) | 2021.02.11 |
[C#/WPF] SVG 파일을 XAML로 변환하기 (0) | 2021.02.10 |
[C#/WPF] 이미지 물방울 애니메이션(Drip Animation) 사용하기 (0) | 2021.02.09 |
댓글을 달아 주세요