The x:
part is a namespace alias. It tells the compiler where the property exists. In this case it's pointing to the default namespace for XAML.
The Name
property is part of System.Object
which is in that namespace.
When you include x:Name
to identify a property called Name
in XAML what you're explicitly saying is that you're referring to the Name
property of the underlying System.Object
. As all objects inherit from this it's accessible to all classes.
Why might any of this matter?
If you overrode the Name property in a class then specifying the namespace will allow you to be explicit about which version of Name
you're referring to.
Side note: you will save yourself a lot of pain by never overriding Name
.
Does it matter which you use?
No. As long as Name
is never overridden and you need to refer to the specific version of it.
It's probably in your interest to be consistent in whether you use it or not. Most people do (as does VS when it creates controls for you) so it's probably easiest to keep them there.