Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window drag and caption buttons do not work when custom title bar is applied #8418

Closed
ojh050118 opened this issue Apr 15, 2023 · 5 comments
Closed
Assignees
Labels
area-TitleBar Issues related to custom window title bars. bug Something isn't working team-Markup Issue for the Markup team

Comments

@ojh050118
Copy link

Describe the bug

I applied a custom title bar, but the dragging and caption buttons do not work. Occurs with package versions 1.2.230313.1 and 1.3.230331000.

Steps to reproduce the bug

xaml:

<Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="32"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Grid x:Name="AppTitleBar" Grid.Row="0">
            <Image x:Name="TitleBarIcon" Source="/Images/finder.png"
                   HorizontalAlignment="Left"
                   Width="16" Height="16"
                   Margin="8,0,0,0"/>
            <TextBlock x:Name="TitleTextBlock"
                Text="{x:Bind Title}"
                Style="{StaticResource CaptionTextBlockStyle}"
                VerticalAlignment="Center"
                Margin="28,0,0,0"/>
        </Grid>
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Spacing="10" Grid.Row="1">
            <Button x:Name="myButton" Click="myButton_Click">Click Me</Button>
            <TextBox Name="TextBox" PlaceholderText="Text me" MinWidth="200"></TextBox>
        </StackPanel>
    </Grid>

CSharp:

public MainWindow()
{
    InitializeComponent();

    SystemBackdrop = new MicaBackdrop();
    Title = TitleTextBlock.Text = "Remote Audio";
    ExtendsContentIntoTitleBar = true;
    SetTitleBar(AppTitleBar);
}

Expected behavior

Window dragging and caption buttons all work.

Screenshots

custom title bar

NuGet package version

Windows App SDK 1.3 Preview 1: 1.3.230228005-preview1

Packaging type

Unpackaged

Windows version

Windows 11 version 22H2 (22621, 2022 Update)

IDE

Visual Studio 2022

Additional context

No response

@ojh050118
Copy link
Author

ojh050118 commented Apr 16, 2023

I found one issue that seems to be related to this.
Resizing the window by dragging the border of the window didn't work. The shape of the mouse did not change to a "Vertical Scaling" shape.

custom title bar resize not work

Current code: Here

@bpulliam bpulliam transferred this issue from microsoft/WindowsAppSDK Apr 20, 2023
@bpulliam bpulliam added bug Something isn't working team-Markup Issue for the Markup team area-TitleBar Issues related to custom window title bars. labels Apr 20, 2023
@ojh050118
Copy link
Author

This issue was resolved by recreating the project with the "Blank App, Packaged" project template instead of "Blank App, Package with Windows Application Packaging Project".
I'll keep this thread open though.

@rocksdanister
Copy link

rocksdanister commented Apr 26, 2023

I have the same issue on my application running on visual studio:
https://github.com/rocksdanister/lively

Not sure when this started happening. Microsoft store version with winappsdk updated separately don't show this problem.
Switching to WinAppSDK method from WinUI3 for customizing titlebar fixed the issue for me in visual studio.

@pratikone
Copy link
Contributor

pratikone commented May 4, 2023

Thanks for posting this. We are currently in process of improving this experience. Meanwhile, I can suggest some workaround if possible. @ojh050118 does it still occur with latest release of WinAppSDK (1.3.1) ?

@pratikone
Copy link
Contributor

It has been fixed and now works fine.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-TitleBar Issues related to custom window title bars. bug Something isn't working team-Markup Issue for the Markup team
Projects
None yet
Development

No branches or pull requests

4 participants