This documentation is archived and is not being maintained.

NameScope Class

Implements base support for the INameScope methods that store or retrieve name-object mappings into a particular namescope, and adds attached property support to make it simpler to get or set identifier namescope information dynamically at the element level..

Namespace:  System.Windows
Assembly:  PresentationFramework (in PresentationFramework.dll)

public class NameScope implements INameScope
<NameScope .../>

This class implements built-in namespace support and also supports creation of scopes for name resolutions that are created by processes that occur outside of normal XAML loading of elements. For instance, NameScope assists in creation of initial namescopes based on parsing XAML, such as when instantiating styles and templates.

For most scenarios, the FindName methods exposed on FrameworkElement and FrameworkContentElement are more appropriate methods to call to search for elements by name. The Name properties exposed by FrameworkElement and FrameworkContentElement are more appropriate properties to use to set the initial name as markup attributes.

The various methods of NameScope are used by base elements and other classes that maintain XAML namescopes in order to support RegisterName and FindName. You generally use the API in the NameScope class only if you are replacing or augmenting the base element behavior for how they process XAML namescopes for root elements of a XAML page, and as part of templates (which use a separate XAML namescope from the rest of the page).

Other similar methods exist on specialized namescopes. For details, see WPF XAML Namescopes.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0