Instead of Application.Current.MainWindow used DynamoView.