When you give an element a name in XAML, either via the Name property or the x:Name attribute, what you are really doing is supplying a field name for the class into which the XAML is converted. By default, for whatever reason, those fields are given the “internal” access modifier. This means that any type within the assembly that contains that class is able to access those elements. If you appreciate the idea of encapsulation, this is clearly not a good thing!
You can use a little-known attribute called x:FieldModifier to remedy the problem. By setting x:FieldModifier to “private” the field which references that element will be a private member of the class to which the XAML belongs. I highly recommend doing this whenever possible, since it promotes a properly designed API for your classes that have a XAML partial.
For example, consider the following XAML:
If you look in the generated file for the Window that contains this XAML, you’ll find the following two fields:
As you can see, the x:FieldModifier determines which access modifier is applied to the fields that have a name in XAML. The modifiers do not impact the ability to bind against the fields using an ElementName binding. Since there is no downside to doing this, there’s no reason not to do it.