Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

NameScope.RegisterName Method (String, Object)


Registers a new name-object pair into the current XAML namescope.

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

public void RegisterName(
	string name,
	object scopedElement


Type: System.String

The name to use for mapping the given object.

Type: System.Object

The object to be mapped to the provided name.

Exception Condition

name or scopedElement was provided as null.


name was provided as empty string

- or -

name provided was rejected by the parser, because it contained characters that are invalid for a XAML name

- or -

name provided would result in a duplicate name registration.

.NET Framework
Available since 3.0
Return to top
© 2017 Microsoft