private void btnDownloadFile_Click(object sender, RoutedEventArgs e) { var dialog = new DownloadFileWindow(_mainViewModel); dialog.Owner = Application.Current.MainWindow; // We must also set the owner for this to work. dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner; dialog.ShowDialog(); }