ContentControl Arrange/Measure Child Panels

                            MyControl : ContentControl
                                    |
                              ContentProperty
                            ________|__________
                            |       |         |
                          Grid    Canvas  WrapPanel etc..
                            |_______|_________|
                                    |
                            Drag Moving Childs

So,it makes easier to change the type of Panel,mantaining Logics as Zoom,Pan,Drag Children,implemented in Parent ContentControl.

Arrange/Measure Override problems,Mouse positioning on drag has become an hell. Seems all positions are offsetted:

e.GetPosition(this.Content as Panel).X

makes Dragged Children moving with a huge offset on the left.

and

Translate(Point,UIElement)

seems having no effect in any combination of call:

this.Content.Translate(Point,Children);

or

Child.Content.Translate(Point,this.Content);

neither trying:

Offset(x,y)

before and after a TranslateTransform or an HitTest.

Great Example of Similar Scenario: http://www.codeproject.com/KB/WPF/zoomandpancontrol.aspx

How can I FIX Drag Offsets in HitTesting/DragMove? What exactely can I FIX in Arrange/Measure Override to have a working TranslateTransform without an UnTranslable offset? Thanks

Upvotes: 1

Views: 1175

Answers (2)

Finally I have some time to continue my Project,and finally,googling around,I found some interesting and really useful reply to the WPF coordinates system:

http://www.xtremevbtalk.com/showthread.php?t=322142

That's it.Replied by myself. If I'll have some time to publish an article about it,I will do happy. Thanks to all people for interest. If someone would like to reply I'll be happy.

Upvotes: 1

Finally I found a starting point:

http://forums.silverlight.net/t/20520.aspx

I guess Layout of my Content(Panel) is obviously influenced by its container: In this link there's something similar to the reply I was searching for,but it doesn't explain clearly How a Child Panel in a ContentControl is exactely modified by its Parent ContentControl:How will it arrange its children?Until now,I can ensure that a PANEL INSIDE a content control will NOT arrange/measure its children as in its original(not nested) behavior. What should I modify EXACTELY in ContentControl for having a Canvas with a "Canvas Arrange and Canvas Measure"?Do I need to modify its ContentPresenter?If Yes,how? News after a deeper googling or after someone will solve before me! Thanks!

Upvotes: 0

Related Questions