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

WPF TreeViewItem.Select() doesn't focus the parent when selected if the child has focus #22

Open
KirillOsenkov opened this issue Sep 27, 2021 · 0 comments

Comments

@KirillOsenkov
Copy link
Owner

The bug is here:
https://referencesource.microsoft.com/#PresentationFramework/src/Framework/System/Windows/Controls/TreeViewItem.cs,504

Suppose a TreeViewItem is selected while it's child is currently selected.

Then this condition:
https://github.com/dotnet/wpf/blob/1d8efc0f94d9fcaed13ffe72367dbf147a692da7/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/TreeViewItem.cs#L503-L507

evaluates to false, because the last IsKeyboardFocusWithin is true (since the child has focus), so the current item doesn't get focused.

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

No branches or pull requests

1 participant