-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Properly restore focus when TabControl.SelectedIndex is set via DialogHost #3104
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
Conversation
|
After giving it some thought here would be my proposal.
Thoughts? |
I think this sound like a very good approach. I very much like the idea that the responsibility for picking the correct element to focus is removed from the Having the additional option to completely disable the restore behavior also seems like a good idea to me. We'll just default the property to I have added the properties discussed and UI tests to test the scenarios. What remains is agreeing on the names of the properties, and applying the attached property on other controls suffering from the same issue (e.g. |
ff98cad to
648ca20
Compare
|
This is great. I think there is a bit of a disjoint on the names of the properties. (FocusRestore vs RestoreFocus). I think |
I agree, I'll change it. |
|
Hi Nicolai and Kevin, thank you for working on this, you guys are awesome! @nicolaihenriksen Thanks for testing and explaining the focus problem! |
Fixes #3094
As per the discussion thread below, this PR adds
DialogHost.RestoreFocusElementandDialogHost.IsRestoreFocusDisabledattached/dependency properties.The former is currently used for the
TabItemstyle (also the one for the "rail item") to ensure focus is returned to the parentTabControlrather than theTabItemitself.The latter is used to completely disable the restore focus feature in case that is relevant.
Added 4 UI tests to verify the behavior.