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

[Winui3] Upgrade to .net 8 and then the AppTitleBar can't be dragged #9418

Closed
Miaoyww opened this issue Mar 9, 2024 · 3 comments
Closed
Labels
area-TitleBar Issues related to custom window title bars. bug Something isn't working needs-triage Issue needs to be triaged by the area owners team-Markup Issue for the Markup team

Comments

@Miaoyww
Copy link

Miaoyww commented Mar 9, 2024

Describe the bug

While i upgraded my app to .net 8, i cant drag my Titlebar.
See code:

 <Border Name="TitleBar"
                    VerticalAlignment="Top"
                    BorderThickness="0,0,0,1"
                    BorderBrush="#F0F1F2"
                    Background="{StaticResource CustomAcrylicBrush}"
                    Height="54"
                    Margin="200,0,0,0">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <Grid Column="0" VerticalAlignment="Center" x:Name="AppTitleBar" Margin="20,0,0,0">
                        <Grid VerticalAlignment="Center">
                            <TextBlock x:Name="AppTitleBarText" TextWrapping="NoWrap"
                                       Style="{StaticResource CaptionTextBlockStyle}"
                                       FontSize="18"
                                       FontFamily="HarmonyOS Sans"
                                       FontWeight="Black"
                                       Foreground="#2d2d2d"
                                       Opacity="0.9" />
                        </Grid>
                    </Grid>
                    <Grid Column="1" Name="PageButtons" VerticalAlignment="Center" Margin="10,0,0,0">
                        <StackPanel Orientation="Horizontal" Width="150" HorizontalAlignment="Left">
                            <Button Name="Back" Height="35" Width="35" Margin="10,0,5,0" Padding="0"
                                    BorderThickness="0" Background="Transparent"
                                    Command="{x:Bind ViewModel.GoBackCommand}">
                                <FontIcon Glyph="&#xE973;" FontSize="24" />
                            </Button>
                        </StackPanel>
                    </Grid>
                    <StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Center"
                                VerticalAlignment="Center"
                                Height="30" Margin="-60,0,0,0">
                        <Button x:Uid="ShellMenu_Home" BorderThickness="0" Width="50" Height="25"
                                FontFamily="HarmonyOS Sans SC" HorizontalContentAlignment="Center"
                                VerticalContentAlignment="Center" Background="Transparent" FontSize="18"
                                FontWeight="Bold" Padding="0,0,0,0" Opacity="0.9"
                                Foreground="#2d2d2d"
                                Command="{x:Bind ViewModel.OpenMenuHomeCommand}" />
                        <Button x:Uid="ShellMenu_Explore" BorderThickness="0" Width="50" Height="25"
                                FontFamily="HarmonyOS Sans SC" HorizontalContentAlignment="Center"
                                VerticalContentAlignment="Center" Background="Transparent" FontSize="18"
                                FontWeight="Bold" Padding="0,0,0,0" Opacity="0.9"
                                Foreground="#2d2d2d"
                                Command="{x:Bind ViewModel.OpenMenuExploreCommand}" />
                        <Button x:Uid="ShellMenu_Own" BorderThickness="0" Width="50" Height="25"
                                FontFamily="HarmonyOS Sans SC" HorizontalContentAlignment="Center"
                                VerticalContentAlignment="Center" Background="Transparent" FontSize="18"
                                FontWeight="Bold" Padding="0,0,0,0" Opacity="0.9"
                                Foreground="#2d2d2d"
                                Command="{x:Bind ViewModel.OpenMenuPersonalCenterCommand}" />
                    </StackPanel>
                    <Grid Column="3" Name="UserController" VerticalAlignment="Center"
                          HorizontalAlignment="Right" Height="40">
                        <StackPanel Orientation="Horizontal">
                            <AutoSuggestBox Name="SearchBox" BorderThickness="1" CornerRadius="3"
                                            SuggestionChosen="{x:Bind ViewModel.SearchBox_Entered}"
                                            QuerySubmitted="{x:Bind ViewModel.SearchBox_Query}"
                                            QueryIcon="Find" Width="200" Height="34" />

                            <StackPanel Name="UserInfo" Orientation="Horizontal"
                                        VerticalAlignment="Center"
                                        HorizontalAlignment="Right"
                                        Width="200"
                                        Height="30"
                                        Margin="10,0,0,0">
                                <StackPanel Orientation="Horizontal" Margin="0,0,50,0">
                                    <Border Name="UserFace" Height="30" Width="30"
                                            Background="{x:Bind ViewModel.AccountStateModel.Face,Mode=OneWay}"
                                            Margin="0,0,5,0"
                                            CornerRadius="100" />
                                    <TextBlock Name="UserName"
                                               Text="{x:Bind ViewModel.AccountStateModel.Name, Mode=OneWay}"
                                               FontFamily="HarmonyOS Sans SC"
                                               FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Right" />
                                </StackPanel>

                                <AppBarButton Width="30" Height="45" VerticalAlignment="Center"
                                              HorizontalAlignment="Right"
                                              Margin="10,0,0,0" x:Name="ShellMenuBarSettingsButton"
                                              PointerEntered="ShellMenuBarSettingsButton_PointerEntered"
                                              PointerExited="ShellMenuBarSettingsButton_PointerExited"
                                              Command="{x:Bind ViewModel.OpenMenuSettingsCommand}">
                                    <AnimatedIcon Margin="0,0,0,3" x:Name="ShellMenuBarSettingsButtonIcon">
                                        <AnimatedIcon.Source>
                                            <animatedvisuals:AnimatedSettingsVisualSource />
                                        </AnimatedIcon.Source>
                                        <AnimatedIcon.FallbackIconSource>
                                            <FontIconSource FontFamily="{StaticResource SymbolThemeFontFamily}"
                                                            Glyph="&#xE713;" />
                                        </AnimatedIcon.FallbackIconSource>
                                    </AnimatedIcon>
                                </AppBarButton>

                            </StackPanel>
                        </StackPanel>
                    </Grid>
                </Grid>
            </Border>

It works well on the .net 7,but doesnt work on .net 8.
You can see more details on my project: NonsPlayer

Steps to reproduce the bug

Above

Expected behavior

No response

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.5.0: 1.5.240227000

Windows version

Windows 11 (22H2): Build 22621

Additional context

Get replicated in windows 10.

@Miaoyww Miaoyww added the bug Something isn't working label Mar 9, 2024
Copy link

github-actions bot commented Mar 9, 2024

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you!

Open similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Mar 9, 2024
@bpulliam bpulliam added team-Markup Issue for the Markup team area-TitleBar Issues related to custom window title bars. and removed needs-triage Issue needs to be triaged by the area owners labels Mar 14, 2024
@pratikone
Copy link
Contributor

I see some of your projects have win10-x64 in there. like here https://github.com/Miaoyww/NonsPlayer/blob/master/NonsPlayer/NonsPlayer.csproj
.net 8 introduces a breaking change where it uses win-x64 instead of win10-x64 for target framework. You can read more about here : https://learn.microsoft.com/en-us/dotnet/core/compatibility/sdk/8.0/rid-graph

You can either make the changes or use
<UseRidGraph>true</UseRidGraph> to re-enable old behavior

@Miaoyww
Copy link
Author

Miaoyww commented Apr 13, 2024

I see some of your projects have win10-x64 in there. like here https://github.com/Miaoyww/NonsPlayer/blob/master/NonsPlayer/NonsPlayer.csproj .net 8 introduces a breaking change where it uses win-x64 instead of win10-x64 for target framework. You can read more about here : https://learn.microsoft.com/en-us/dotnet/core/compatibility/sdk/8.0/rid-graph

You can either make the changes or use <UseRidGraph>true</UseRidGraph> to re-enable old behavior

thanks a lot !!😍

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 needs-triage Issue needs to be triaged by the area owners team-Markup Issue for the Markup team
Projects
None yet
Development

No branches or pull requests

3 participants