Using Types from Other Namespaces

n order to use a class that isn’t defined in one of the WPF namespaces, you need to map the .NET namespace to an XML namespace. XAML has a special syntax for doing this, which looks like this:


Typically, you’ll place this namespace mapping in the root element of your XAML document, right after the attributes that declare the WPF and XAML namespaces. You’ll also fill in the three italicized bits with the appropriate information, as explained here:

  • Prefix is the XML prefix you want to use to indicate that namespace in your XAML markup. For example, the XAML language uses the x: prefix.
  • Namespace is the fully qualified .NET namespace name.
  • AssemblyName is the assembly where the type is declared, without the .dll extension. This assembly must be referenced in your project. If you want to use your project assembly, leave this out.

Comments are closed.

Create a website or blog at

Up ↑

%d bloggers like this: