UIElement position relative to window

In WPF, I want to get the angular location TabControlin my code, so I can set the location of ToolWindow accordingly when shown.

How to 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
+3
source share
1 answer
Point pt = tabControl.TranslatePoint(new Point(0, 0), windowInstance);
+7
source

Source: https://habr.com/ru/post/1724843/


All Articles