wpfui icon indicating copy to clipboard operation
wpfui copied to clipboard

Titlebar doesn't allow interaction with other elements

Open RaoHammas opened this issue 1 year ago • 2 comments

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

RaoHammas avatar Sep 01 '24 18:09 RaoHammas

 <ui:TitleBar>
     <ui:TitleBar.Header>
         <ui:Button Content="Click Me"/>
     </ui:TitleBar.Header>
 </ui:TitleBar>

Moy838840554 avatar Sep 02 '24 10:09 Moy838840554

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

RaoHammas avatar Sep 02 '24 11:09 RaoHammas