Resource를 위한 별도의 Assembly를 만든다면 URI는 절대경로를 사용해라.

런타임에 다른 Application에서 사용되므로, 상대경로로 정의된 파일을 찾지 못한다.


Resource assembly는 다음처럼 만들어라.
  1. 클래스라이브러리 프로젝트라면 assemblyinfo.cs 에 어트리뷰트를 추가하고
    [assembly: ThemeInfo(
        ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
        //(used if a resource is not found in the page, 
        // or application resource dictionaries)
        ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
        //(used if a resource is not found in the page, 
        // app, or any theme specific resource dictionaries)
    )]
  2. 용도별로 따로 Resource Dictionary를 만들어서,
  3. /Themes/generic.xaml 에서 파일을 절대경로로 포함시켜서 머지하고,
  4. 더미클래스를 하나 정의하고,
  5. 다른 어셈블리에서 참조될 수 있도록, ComponentResourceKey를 이용해 키를 부여한다.
  6. DynamicResource 를 이용해 필요한 리소스를 참조해서 이용한다.

댓글

이 블로그의 인기 게시물

Oracle NLS_DATE_FORMAT 변경

Stop console process using Ctrl+C.

Alternative to IValueConvert, QuickConverter