0

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...

michael
  • 14,844
  • 28
  • 89
  • 177

1 Answers1

0

I don't really understand your question. It might look for something, that is actualy not logical in the way how WPF layouts and manages its controls and properties.

It might be possible with Attached Property and some databinding.

You might also look how Measure and Arrange(another) layout works in WPF, beccause thats how parent positions its children.

Euphoric
  • 12,645
  • 1
  • 30
  • 44