Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal - Dont focus flyout on close #2671

Merged
merged 2 commits into from
Sep 26, 2016

Conversation

ButchersBoy
Copy link
Contributor

Background

I have multiple windows, and i'm using flyouts to show an alert condition in the application. When the user dismisses the alert all flyouts are closed via my application code.

The problem

This line causes the last Window my where my code closes the flyout to receive focus , bringing that window to the front, interrupting the users activity:

// focus the Flyout itself to avoid nasty FocusVisual painting (it's visible until the Flyout is closed)        
flyout.Focus();

Remarks

I understand there is a specific comment here regarding this line to perform some visual trickery. However, it's not logically correct. I have experimented, removed the line, and I can't see any display issues in my application.

Maybe someone / @punker76 , with some background on this line can comment?

Another option would be to make the code a bit more specific; only run the focus if the current Window is active, something like:

if (Window.GetWindow(flyout) == Application.Windows.OfType<Window>().FirstOrDefault(w => w.IsActive))
    flyout.Focus();

@punker76
Copy link
Member

@ButchersBoy This hack was introduced with #1805 by this issue (found by manual testing)

2016-09-26_22h22_18

2016-09-26_22h22_44

But now, I can't also not reproduce this with the current source, so I think we can change this.

@punker76 punker76 added this to the 1.4.0 milestone Sep 26, 2016
@punker76 punker76 merged commit 073d731 into MahApps:develop Sep 26, 2016
@ButchersBoy
Copy link
Contributor Author

Cool! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants