첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170

ResourceMerger.zip
0.00MB

 

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
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요