What is the correct way to retrieve a window\'s position in WPF?
Here\'s some attempts I made. First attempt, the obvious
Point GetPosition(Window wi
You can use reflection if you don't want to rely on Winforms or PI
private double GetWindowLeft(Window window)
{
if (window.WindowState == WindowState.Maximized)
{
var leftField = typeof(Window).GetField("_actualLeft", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
return (double)leftField.GetValue(window);
}
else
return window.Left;
}