开发者

Convert Viewport point to container reference point in WPF

开发者 https://www.devze.com 2023-04-02 13:51 出处:网络
I have plotted controls on ViewPort at specified locations.And the ViewPort is placed on Canvas. On click on the plotted control, I want to get the coordinate point with reference to the ViewPort cont

I have plotted controls on ViewPort at specified locations. And the ViewPort is placed on Canvas. On click on the plotted control, I want to get the coordinate point with reference to the ViewPort container(Canvas). I get the point coordinate where the control place开发者_如何转开发d on ViewPot, but I want it with reference to the container.

Please suggest your ideas for converting the ViewPort Point to normal screen point.

Thanks in advance.


At last I got:

var currentPosition = Mouse.GetPosition(container);

This will return current click point with reference to ViewPort.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号