I'm trying to learn more about WPF. I ran through an online tutorial that created a button and then created a template to be applied to additional buttons. The problem is this template is in the Window.xaml and I can only access the template from within that application. How do I make the template more globablly available? I'm thinking of some way to reference the xaml like you can reference an assembly from a different project or solution.
+1
A:
You can use "resource dictionaries" which you reference in your App.xaml like this (Expression Blend does it automatically):
<Application.Resources>
<!-- Resources scoped at the Application level should be defined here. -->
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ResourceDictionary1.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
How to reference a resource from another assembly, use pack URI syntax. This link covers it as well.
Sergey Aldoukhov
2009-05-17 18:10:56