Skip to content

Conversation

@Rijno
Copy link

@Rijno Rijno commented Jul 9, 2025

WPF's TabControl aggressively captures keybindings, even if the focus is on inner elements within an AvalonDock DocumentPane.

This was an issue that popped up when I added a code editor as a Document within AvalonDock. Where I noticed the Home and End keys, were not captured by the code editor, but instead switched between the first and last TabControl items.

This can be bypassed by overriding the OnKeyDown event on an element that uses the TabControl and not calling the base.OnKeyDown function of the base TabControl.
This is well explained in this blogpost.

I could not find a way to do this without editing AvalonDock, as it must be set on one of the elements that are derived from TabControl.

I've added a property to ignore these key bindings (IgnoreTabControlKeyBindings), which is disabled by default, so not to affect any AvalonDock users. Personally, I wouldn't mind if this is always ignored, as I've never realized TabControl had these keybindings anyway, and I find its usefulness minimal at best.

It would be fantastic if this could be merged with the AvalonDock with any changes you deem necessary to fit into this codebase.
Thank you.

Example:
TabControl

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

Successfully merging this pull request may close these issues.

1 participant