views:

41

answers:

2

Suppose I have a top-level ResourceDictionary element in a XAML file with no C# code-behind. How can I put this element in a specific namespace?

A: 

I'm not sure if you can -- but I've never seen this done.

What I have seen is putting ResourceDictionary XAML files in a directory structure in an assembly, and getting it via the Pack URI syntax.

Dr. WPF has an interesting post on getting ResourceDictionaries in code here.

micahtan
A: 

It is much simpler than I had thought:

<ResourceDictionary x:Class="SomeNamespace.SomeClassName"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt;
</ResourceDictionary>
emddudley