#96 – Common XAML Namespace Attributes
October 16, 2010 Leave a comment
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.