Skip to content

Conversation

@apachezy
Copy link
Contributor

Pull request type

Please check the type of change your PR introduces:

  • Update
  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes

What is the current behavior?

The current TitleBar already handles right‑click system menus via HwndSourceHook. However, the MouseRightButtonUp event is also subscribed and unconditionally pops up the system menu, resulting in:

  • Duplicate system‑menu handling in TitleBar; a system menu always appears on right‑click.

  • Right‑click menus of controls inside TrailingContent cannot be shown.

TitleBar-RightButton-Issue1 TitleBar-RightButton-Issue2

Issue Number: N/A

What is the new behavior?

  • The handler for the MouseRightButtonUp event has been temporarily commented out (code is preserved). It can be restored later if a WPF‑based system‑menu implementation is needed in the future.

  • After the change, both the system menu and control‑specific context menus now work correctly:

TitleBar-RightButton-Fixed1 TitleBar-RightButton-Fixed2

Other information

@github-actions github-actions bot added controls Changes to the appearance or logic of custom controls. PR Pull request dotnet release titlebar Titlebar updates labels Dec 16, 2025
@pomianowski pomianowski changed the title fix(controls): remove duplicate right‑click event handling in TitleBar fix(controls): Remove duplicate right‑click event handling in TitleBar Dec 16, 2025
@apachezy apachezy force-pushed the fix/titlebar-MouseRightButtonUp branch from bbf01cc to 4ed7c8d Compare December 29, 2025 09:34
@apachezy apachezy force-pushed the fix/titlebar-MouseRightButtonUp branch from 4ed7c8d to b0dcb58 Compare December 29, 2025 09:36
Copy link
Collaborator

@Nuklon Nuklon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can confirm this works OK.

@apachezy
Copy link
Contributor Author

apachezy commented Jan 8, 2026

The TitleBar has accumulated significant technical debt: excessive properties, workarounds that bypass WPF best practices, poor UX, and complex maintenance. A full refactor is needed for long-term viability. Closing this PR.

@apachezy apachezy closed this Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

controls Changes to the appearance or logic of custom controls. dotnet PR Pull request release titlebar Titlebar updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants