Resource를 위한 별도의 Assembly를 만든다면 URI는 절대경로를 사용해라.
런타임에 다른 Application에서 사용되므로, 상대경로로 정의된 파일을 찾지 못한다.
Resource assembly는 다음처럼 만들어라.
Resource assembly는 다음처럼 만들어라.
- 클래스라이브러리 프로젝트라면 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) )]
- 용도별로 따로 Resource Dictionary를 만들어서,
- /Themes/generic.xaml 에서 파일을 절대경로로 포함시켜서 머지하고,
- 더미클래스를 하나 정의하고,
- 다른 어셈블리에서 참조될 수 있도록, ComponentResourceKey를 이용해 키를 부여한다.
- DynamicResource 를 이용해 필요한 리소스를 참조해서 이용한다.
댓글
댓글 쓰기