开发者

wpf VisualTreeHelper.HitTest

开发者 https://www.devze.com 2023-01-22 00:27 出处:网络
开发者_JS百科I have a canvas and within it I have many Thumbs.. when I make a hit test on the canvas so as to find the thumbs near my mouse I get the wrong

开发者_JS百科I have a canvas and within it I have many Thumbs.. when I make a hit test on the canvas so as to find the thumbs near my mouse I get the wrong expected result which I get the border of the thumb not the thumb itself..

Please I want the solution!!


    
class HotPoint:Thumb, IDraggable
    {
    ...
    }
    IDraggable hotpoint = VisualTreeHelper.GetParent(result.VisualHit) as IDraggable;

Where IDraggable is an Interface I inherit from with the thumb. I remembered that every hotpoint has a custom control template so when I do hit tests the search will be on the primitive types, so when I get the parent of that object it will solve my request.

0

精彩评论

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