lepoco / wpfui

WPF UI provides the Fluent experience in your known and loved WPF framework. Intuitive design, themes, navigation and new immersive controls. All natively and effortlessly.
https://wpfui.lepo.co
MIT License
7.63k stars 743 forks source link

Titlebar doesn't allow interaction with other elements #1220

Open RaoHammas opened 2 months ago

RaoHammas commented 2 months ago

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

Moy838840554 commented 2 months ago
 <ui:TitleBar>
     <ui:TitleBar.Header>
         <ui:Button Content="Click Me"/>
     </ui:TitleBar.Header>
 </ui:TitleBar>
RaoHammas commented 2 months ago

@Moy838840554 Even this doesn't work. Same issue...