Skip to content

ProgressDialog close causes loss of focus on child control #2532

@dxdx347

Description

@dxdx347

What steps will reproduce this issue?

In my app, I'm loading a DocumentViewer for previewing and printing. Because loading can take up to a few seconds, I would like to display a ProgressDialog. The logic is this: display ProgressDialog, create and display DocumentViewer, close ProgressDialog.

The problem is that when closing the dialog, the focus returns to the MainWindow, instead of remaining to the DocumentViewer window. I think it's because the dialog CloseAsync(). I've tried calling Focus(), Activate(), Show(), setting TopMost = true, setting the owner of the child window, but, although the window is initially displayed in front of the parent, the focus still returns to the parent. The only way to I restored the focus to the child was by doing a programmatic click inside the child window, in ProgressDialogController.Closed event, but the disadvantage is that there is an ugly transition (child initially appears in front, then parent, then child again).

Can CloseAsync() be avoided? Or how to close MahApps ProgressDialog without losing focus on child control?

Expected outcome

The ProgressDialog should be closed without losing focus from the child window.

Environment

  • MahApps.Metro v1.3.0.157
  • Windows 10
  • Visual Studio 2015
  • .NET Framework 4.6.1

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions