4thSpace
4thSpace

Reputation: 44310

Does naming objects in XAML impact anything?

Does assigning the attribute "Name" have any impact on objects in XAML? All of the objects I want to provide a Name value for have currently have no Name value.

Upvotes: 1

Views: 56

Answers (1)

Dan Bryant
Dan Bryant

Reputation: 27495

It will set the Name property on the class. If the XAML is associated with code-behind, the XAML compiler will also expose the named elements to the code-behind (assuming that Name maps to x:Name, which is true for most WPF controls you would represent with XAML.) You can also use x:Name explicitly if you have a class that doesn't support a Name property.

Upvotes: 3

Related Questions