3

In WPF, I want to get the corner location of a TabControl in my code, so I can set a ToolWindow's location accordingly when shown.

How do I get the location of a given UIElement?

buildingInfoWindow = new BuildingInfoWindow(); // BuildingWindow : System.Windows.Window
buildingInfoWindow.Owner = this;

//buildingInfoWindow.Left = ?; // relative X coordinate of my TabControl
//buildingInfoWindow.Top = ?; // relative Y coordinate of my TabControl
Dave Clemmer
  • 3,741
  • 12
  • 49
  • 72
Claus Jørgensen
  • 25,882
  • 9
  • 87
  • 150

1 Answers1

7
Point pt = tabControl.TranslatePoint(new Point(0, 0), windowInstance);
Jobi Joy
  • 49,102
  • 20
  • 108
  • 119