Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • 2
    In Visual Studio 2010 the Name property is set (not x:Name) when you edit the XAML via the designer. It appears as if MS encourages the use of Name over x:Name so I guess that is the defacto standard. Commented Feb 27, 2013 at 9:15
  • 13
    I don't think the two are interchangeable in general. Naming user controls require x:Name because Name would not create a field to be recognized in code-behind. I still don't know why this happens, though. Commented Jul 13, 2013 at 8:40
  • 7
    They are not nor did I mean to imply they did. In WPF, if an element has a Name property it they mean the same thing. If the element doesn't have a Name property, you must use x:Name. Commented Jul 27, 2013 at 0:41
  • 2
    @Libor Today it absolutely makes not difference whether you use Name or x:Name for any type that derives from FrameworkElement (which includes most types you'd use in XAML including UserControl, a member will be generated correctly in any case). This is because FrameworkElement is decorated with [RuntimeNameProperty("Name")]. Commented Jun 14, 2020 at 7:34
  • "In the future, XAML will have more uses for x:Name" - Sad_trombone.wav - As of 2025, XAML remains firmly stuck in 2009. Commented Sep 15 at 5:15