I have a Silverlight UserControl that uses a ContentPropertyAttribute to display the Children property of one of the child panels. This allows me to add child controls to a panel on my page:
<local:MyUserControl>
<TextBox Name="tbTest" />
</local:MyUserControl>
This works, except for the 'tbTest' field of the page present but not initialized. Upon closer inspection, the InitializeComponent method tries to find a TextBox (with FindName), but cannot do this (returns null).
After some investigation, I found that name problems are a problem, UserControl has its own name, so children cannot be located with the FindName page, but they can using the UserControl FindName method.
How can I change my UserControl so that the child controls are localized by the InitializeComponent method? Standard panels (StackPanel, Grid, etc.) seem to have no problems with this, so there should be a solution?
thank
source
share