How to get the position of a user control?
I have an application. I want to show a ballon(UserControl) after I click a button on window. Th开发者_如何学编程e ballon must appear under the button. How to set the position to ballon using the position on button
button is your button, root is your window and coordinates is the coordinates of button relative to root.
Point coordinates = button.TransformToAncestor(root).Transform(new Point(0, 0));
Take a loot at TransformToAncestor, it works for any visual.
精彩评论