I wrote a Controllight-based Silverlight user control. I have two DependencyProperties called Top and Bottom that contain child controls for a specific layout display. Then I use the ControlTemplate to arrange these two controls in the grid, putting them in row 0 and the other in 1 row. The problem is that I cannot figure out how to get each child of the Parent property to point to my user control. When I check each control at runtime, the Parent property of each is null.
This is a simple example, but I think you can see the general problem. I have a few more complex controls that all share this issue. I know that there is some kind of magic that I am missing. If a child device is set for the ContentControl Content property, it somehow sets the parent for itself.
Edit: A little more information
In WPF, you can use functions such as AddVisualChild (), RemoveVisualChild (), AddLogicalChild (), RemoveLogicChild () to manage parent / child relationships, but these functions are not available in Silverlight.
source share