次のコードを使いたい
Point point1 = pwImages.ElementAt(0).TransformToAncestor(Application.Current.MainWindow).Transform(new Point(0, 0));
ただし、mainWindowはapp.xamlによって呼び出されるウィンドウであるため、Application.Current.MainWindowはこのコードを呼び出すウィンドウに設定されていません。Application.Current.MainWindow以外にここで使用できる代替手段はありますか、またはApplication.Current.MainWindowを現在のウィンドウにリセットできますか?