views:

199

answers:

2

When I create a user control in WPF it would appear that all the children of this control are declared as internal? I've not been able to verify this, nor finding any resources discussing this matter at all.

I can access the controls in the same assembly, but not in a project referencing the assembly where the user control is located. Is there a way to override the default access modifier of child controls in XAML so I don't manually have to expose the controls via properties in the user control?

+5  A: 

Have you tried to set the x:FieldModifier attribute of your children controls to "public"?

Romain Verdier
Worked like a charm.
Qua
+1  A: 

However, just making them public, is no good idea - its really bad design.

You should expose their real data through properties of your UserControl. The best thing would be introducing an interface.

Another solution (more the "WPF-way") would be using the data-context as the only property which is accessed from outside: The controls could bind to the properties they need.

winSharp93