Titlebar doesn't allow interaction with other elements
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
Hi,
I'm facing an issue with the Titlebar. If an element is placed withing the area of the titlebar then none of the events of that element trigger. E.g. if we place a button within the Titlebar area, none of the events of button will trigger (hover, click etc). I've tried pretty much everything even ZIndex but it just doesn't work.
<ui:FluentWindow
x:Class="Test_Wpf_Ui.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Test_Wpf_Ui"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pages="clr-namespace:Test_Wpf_Ui.Pages"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
Title="MainWindow"
Width="800"
Height="450"
ExtendsContentIntoTitleBar="True"
mc:Ignorable="d">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid
Grid.Row="0"
VerticalAlignment="Top"
Background="Black">
<ui:TitleBar
Title="NTP Iraq"
Width="{Binding ElementName=Canv, Path=ActualWidth}"
Canvas.ZIndex="-100"
DockPanel.Dock="Top"
FlowDirection="LeftToRight"
ForceShutdown="False"
Icon="../../icon.ico"
ShowHelp="False"
ShowMaximize="True"
ShowMinimize="True" />
<Button
Margin="0,0,200,0"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Background="DodgerBlue"
Canvas.ZIndex="2"
Click="ButtonBase_OnClick"
Content="aaaaa"
PreviewMouseLeftButtonUp="UIElement_OnPreviewMouseLeftButtonUp" />
</Grid>
<Border
Grid.Row="1"
Height="20"
Background="Aquamarine" />
</Grid>
</ui:FluentWindow>
To Reproduce
Simply create a fluent window, add a Titlebar and a button that shows on top of the titlebar. you will notice button acts like if it is disabled. It won't react to hover events or click events.
Expected behavior
Any other element placed in the area of titlebar should react to its events.
Screenshots
No response
OS version
Win 11 latest.
.NET version
Net 8 and Net 6
WPF-UI NuGet version
Latest and Pre-Release
Additional context
No response
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 with the FluentWindow and TitleBar used in the supplied XAML, and reproduce the issue on Windows with the reported .NET 6 or .NET 8 versions. Trace how the titlebar area handles mouse input while the overlaid Button is present; done means controls placed there receive hover and click events. No repository file or test entry point is named in the report.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100