UIElement Position relativ zum Fenster
Frage
In WPF, ich mag die Ecklage eines TabControl
in meinem Code bekommen, so kann ich ein Toolwindow Standort entsprechend eingestellt, wenn gezeigt.
Wie kann ich den Standort eines bestimmten 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
Lösung
Point pt = tabControl.TranslatePoint(new Point(0, 0), windowInstance);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow