Skip to content

Conversation

@Difegue
Copy link
Contributor

@Difegue Difegue commented Jul 7, 2025

Customizing titlebar behavior has proven difficult ever since WPFUI switched to using a Hwnd Hook to process WM_xxx messages.
Notably, customizing the drag regions requires either XAML hacks or additional hooks on top of the base WPFUI one.

This change allows client apps to use and override HwndSourceHook if desired, to either add additional functionality or block the base one.

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?

HwndSourceHook cannot be interacted with in any way when using the Titlebar control

Issue Number: N/A

What is the new behavior?

  • An additional WndProcInvoked event has been added that can be subscribed to from the Titlebar
  • This event is called with HwndProcEventArgs containing the hwnd and the hook when the titlebar receives a WM_xxxx message
  • Client apps can use e.Handled to bypass WPFUI's handling of said messages

Other information

@Difegue Difegue requested a review from pomianowski as a code owner July 7, 2025 09:38
@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 Jul 7, 2025
@pomianowski pomianowski changed the title Added event to forward Titlebar HwndProc to avoid adding additional hooks and timing issues feat(controls): Added event to forward TitleBar HwndProc to avoid adding additional hooks and timing issues Nov 7, 2025
@pomianowski pomianowski changed the title feat(controls): Added event to forward TitleBar HwndProc to avoid adding additional hooks and timing issues feat(windows): Added event to forward TitleBar HwndProc to avoid adding additional hooks and timing issues Nov 7, 2025
@pomianowski pomianowski merged commit 8545389 into lepoco:main Nov 7, 2025
2 checks passed
@Difegue Difegue deleted the hwnd-extension-titlebar branch November 7, 2025 20:37
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.

3 participants