I have the following situation:
FooControl:
I need for this control to be able to place content in a specific area, so I used a Canvas control for it.
<Canvas>
<local:FooPanel x:Name="FooItemsPanel" Canvas.Top="0" Canvas.Left="0" Panel.ZIndex="0" IsItemsHost="True" />
<ContentPresenter x:Name="PART_FooContentHost" Canvas.Top="?" Canvas.Left="?" Panel.ZIndex="1" ContentSource="FooContent" />
</Canvas>
FooPanel:
Arranges all the children item in a specific order and designates an area (Rect
) for where the content should go.
But, here's the problem. FooPanel isn't really referenced from FooControl. How can I get the coordinates from the FooPanel into the FooControl? I figure it's some DependencyProperty trick, but I'm not sure how.
I turned the Rect into a DependencyProperty but I'm not really sure how I can get it from within my FooControl.cs (I'd rather avoid doing binding in the XAML because well, if the control style is overridden it would go away...