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

TitleBar doesn't respect AppWindow.TitleBar.IconShowOptions #9864

Open
brunosonnino opened this issue Jul 31, 2024 · 0 comments
Open

TitleBar doesn't respect AppWindow.TitleBar.IconShowOptions #9864

brunosonnino opened this issue Jul 31, 2024 · 0 comments
Labels
area-AppWindow bug Something isn't working team-CompInput Issue for IXP (Composition, Input) team

Comments

@brunosonnino
Copy link

brunosonnino commented Jul 31, 2024

Describe the bug

If you set AppWindow.TitleBar.IconShowOptions to HideIconAndSystemMenu, the icon and the system menu are not hidden

Steps to reproduce the bug

  • Create a Blank WinUI3 app
  • Upgrade the WindowsAppSdk Nuget package to 1.6 experimental 2
  • Change the project file to add
<WindowsSdkPackageVersion>10.0.19041.35-preview</WindowsSdkPackageVersion>
  • Add this code in MainWindow.xaml
<StackPanel Orientation="Horizontal">
    <TextBlock Text="Hide AppIcon:" VerticalAlignment="Center"
            Margin="10,0" />
    <ToggleSwitch Toggled="HideIcon_Switched" />
</StackPanel>

And this code to MainWindow.xaml.cs

private void HideIcon_Switched(object sender, RoutedEventArgs e)
{
    if (sender is ToggleSwitch toggleSwitch)
    {
        AppWindow.TitleBar.IconShowOptions = 
            toggleSwitch.IsOn ? IconShowOptions.HideIconAndSystemMenu : IconShowOptions.ShowIconAndSystemMenu;
    }
}

When you tun the code, changing the toggleswitch doesn't change the icon or the system menu

This project shows a sample of the bug: https://github.com/brunosonnino/TitleBarBugs/tree/main/2%20-%20TitleBarHeight

A workaround for this is to set the TitleBar IconSource property to null (but this still shows the system menu)

Expected behavior

The setting should be respected

Screenshots

image
Icon "Shown"
image
Icon "Hidden"

NuGet package version

WinUI 3 - Windows App SDK 1.6 Experimental 2: 1.6.240701003-experimental2

Windows version

Windows 11 (22H2): Build 22621

Additional context

No response

@brunosonnino brunosonnino added the bug Something isn't working label Jul 31, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Jul 31, 2024
@JesseCol JesseCol added area-AppWindow team-CompInput Issue for IXP (Composition, Input) team and removed needs-triage Issue needs to be triaged by the area owners labels Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-AppWindow bug Something isn't working team-CompInput Issue for IXP (Composition, Input) team
Projects
None yet
Development

No branches or pull requests

2 participants