🐛 TitleBar Buttons Have Hit Testing and Click Issues
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 9.6k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
When using Wpf.Ui.Controls.TitleBar on a Windows touchscreen device, the window control buttons do not respond reliably to touch input.
- Tapping the maximize/restore button may cause the window to restore and then immediately maximize again, or the tap may appear to have no effect.
- Tapping the close button often does not close the window. It may require multiple taps before the click is successfully triggered.
Mouse input works correctly on the same buttons.
Example usage:
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
<ui:TitleBar x:Name="TitleBar">
<ui:TitleBar.Icon>
<ui:ImageIcon Margin="0,-5,-5,0" Source="{Binding Source={StaticResource ApplicationIcon}}" />
</ui:TitleBar.Icon>
<ui:TitleBar.Header>
<StackPanel VerticalAlignment="Center">
<TextBlock x:Name="TitleTextBlock" Text="Untitled window title" />
</StackPanel>
</ui:TitleBar.Header>
</ui:TitleBar>
This issue is unrelated to the custom Header. Even with a minimal configuration such as:
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
<ui:TitleBar
Grid.Row="0"
Height="30"
ShowMaximize="False"
ShowMinimize="False" />
the close button still exhibits the same issue.
To Reproduce
As shown in the attachment
Expected behavior
A single touch tap on the maximize/restore or close button should behave the same as a single mouse click.
The TitleBar caption buttons should respond reliably to touch input without requiring repeated taps or unexpectedly toggling the window state.
Consistent with native window behavior, or with WPF in new projects
Screenshots
Close Button
https://github.com/user-attachments/assets/435c9bcf-8127-44bf-aaa2-bf208ba64254
Maximize Button
https://github.com/user-attachments/assets/ef7dddf7-9c5f-4a59-b0ba-db0c55a1ec2d
OS version
Windows 10
.NET version
.NET 8 / WPF
WPF-UI NuGet version
4.3.0
Additional context
Under the same environment, title bar buttons in applications such as web browsers, File Explorer, and Windows Settings do not exhibit this issue.
Based on the relevant source code, I suspect this may be related to the custom native window message hook handling in TitleBar.
There is also another long-standing issue on the PC side: occasionally, when hovering the mouse over the close button, its hover state keeps flickering continuously, and the button may become unclickable. Mouse clicks on the button may stop working until the state recovers. This issue has existed for some time and has not been resolved.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the touch and mouse behavior on Windows 10 with the WPF-UI TitleBar examples provided. Inspect the TitleBar source and its custom native window message hook handling, then compare caption-button hit testing and state changes. Done means one touch tap reliably closes or toggles the window exactly like one mouse click.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100