ghost1372 / HandyControls

Contains some simple and commonly used WPF controls based on HandyControl
https://ghost1372.github.io/
MIT License
1.1k stars 104 forks source link

NonClientAreaContent can not drag window #156

Closed CodingOctocat closed 2 years ago

CodingOctocat commented 2 years ago

Describe the bug

NonClientAreaContent can not drag window.

Steps to reproduce the bug

  1. Create a simple hc:Window
  2. Add hc:Window.NonClientAreaContent (content is Menu)
  3. Try drag the title bar (NonClientAreaContent) to move window,can not do it.

Expected behavior

No response

Screenshots

No response

NuGet package version

HandyControls (Custom version) 3.4.0

IDE

Visual Studio 2022

Framework type

.Net 6.0

Windows version

Windows 11 (22000)

Additional context

No response

CodingOctocat commented 2 years ago

Temporary Solutions: set NonClientAreaContent background {x:null}

ghost1372 commented 2 years ago

mybe you are doing it wrong way... Animation2

    <hc:Window.NonClientAreaContent>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <StackPanel Height="29">
                <Menu HorizontalAlignment="Left">
                    <MenuItem Header="Header1">
                        <MenuItem Header="Header1"/>
                        <MenuItem Header="Header2"/>
                    </MenuItem>
                    <MenuItem Header="Header2">
                        <MenuItem Header="Header1"/>
                        <MenuItem Header="Header2"/>
                    </MenuItem>
                </Menu>
            </StackPanel>
            <Button HorizontalAlignment="Right" Grid.Column="1" Name="ButtonConfig" Style="{StaticResource ButtonIcon}" Foreground="{DynamicResource PrimaryTextBrush}" hc:IconElement.Geometry="{StaticResource ConfigGeometry}"/>

        </Grid>
    </hc:Window.NonClientAreaContent>
CodingOctocat commented 2 years ago

The reason for the problem is that I did not use Grid, but directly used hc:SimpleStackPanel.