I want to use the following code
Point point1 = pwImages.ElementAt(0).TransformToAncestor(Application.Current.MainWindow).Transform(new Point(0, 0));
However, Application.Current.MainWindow is not set to the window that calls this code, since the mainWindow is the window called by app.xaml. Is there an alternative I can use here besides Application.Current.MainWindow or can I reset Application.Current.MainWindow to be my current window?