Reputation: 6423
I have an application. I want to show a ballon(UserControl) after I click a button on window. The ballon must appear under the button. How to set the position to ballon using the position on button
Upvotes: 3
Views: 13727
Reputation: 9265
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.
Upvotes: 7