内容控制排列/测量子面板
MyControl : ContentControl
<前> <代码> | 内容属性 ________|______________ | | | 网格画布 WrapPanel 等.. |_______|_________| | 拖动移动儿童
因此,可以更轻松地更改面板类型,维护缩放、平移、拖动子级逻辑,并在父级内容控件中实现。
安排/测量覆盖问题,拖动鼠标定位已成为地狱。 似乎所有位置都被抵消:
e.GetPosition(this.Content as Panel).X
使拖动的子项向左侧移动一个巨大的偏移量。
和
翻译(点,UIElement)
似乎对任何调用组合都没有效果:
this.Content.Translate(Point,Children);
或
Child.Content.Translate(Point,this.Content);
都没有尝试:
偏移量(x,y)
TranslateTransform 或 HitTest 之前和之后的
。类似场景的一个很好的例子: http://www.codeproject.com/KB/WPF/zoomandpancontrol.aspx
如何修复 HitTesting/DragMove 中的拖动偏移? 我到底可以在排列/测量覆盖中修复什么,以拥有一个工作的 TranslateTransform 而没有 UnTranslable 偏移? 谢谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最后我有一些时间继续我的项目,最后,谷歌搜索,我发现了一些有趣且非常有用的 WPF 坐标系统回复:
http://www.xtremevbtalk.com/showthread.php?t=322142
就是这样,我自己回复的。
如果我有时间发表一篇关于它的文章,我会很高兴。
感谢所有人的兴趣。
如果有人愿意回复我会很高兴。
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.
最后我找到了一个起点:
http://forums.silverlight.net/t/20520.aspx< /a>
我猜我的内容(面板)的布局显然受到其容器的影响:
在此链接中,有与我正在搜索的回复类似的内容,但它没有清楚地解释 ContentControl 中的子面板如何由其父 ContentControl 精确修改:它将如何安排其子面板?到目前为止,我可以确保内容控件内的面板不会像其原始(非嵌套)行为那样排列/测量其子级。
我应该在 ContentControl 中精确修改什么,以获得具有“画布排列和画布测量”的画布?我是否需要修改其 ContentPresenter?如果是,如何修改?
经过更深入的谷歌搜索或有人在我之前解决之后的新闻!
谢谢!
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!