#96 – Common XAML Namespace Attributes

The XAML namespace is referenced in all XAML files used in WPF.  This namespace provides some basic elements used when parsing XAML.

The XAML namespace uses the x: prefix by default in WPF XAML files.

Here are the most common directives from the XAML namespace that can be used as attributes in your XAML:

  • x:Class – Defines the name of the class in code-behind that provides implementation for the element.
  • x:Key – Uniquely identifies an element in a resource dictionary.  The value must be a unique string in the dictionary.
  • x:Name – Provides a unique name for the element so that it can be referenced from code-behind
  • x:Null – Sets a property value to null
  • x:Shared – Allows users of an element in a resource dictionary to avoid sharing the same instance of the resource
  • x:Static – Allows setting a property value to a static property, a constant, or an enumerated value.

See also


About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: