在 WPF中,我想在我的代码中获取TabControl的角落位置,因此我可以在显示时相应地设置ToolWindow的位置. 我如何获得给定UIElement的位置? buildingInfoWindow = new BuildingInfoWindow(); // BuildingWindow :
我如何获得给定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
Point pt = tabControl.TranslatePoint(new Point(0, 0), windowInstance);