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

[Windows] No application icon in the titlebar #23572

Closed
MartyIX opened this issue Jul 12, 2024 · 4 comments
Closed

[Windows] No application icon in the titlebar #23572

MartyIX opened this issue Jul 12, 2024 · 4 comments
Labels
platform/windows 🪟 t/bug Something isn't working

Comments

@MartyIX
Copy link
Contributor

MartyIX commented Jul 12, 2024

Description

I created a new MAUI project and ran on Windows. I cannot see any application icon in my titlebar.

Steps to Reproduce

  1. https://github.com/MartyIX/MauiAppIcon202407
  2. Run on Windows
  3. You should see and there is no application icon on the left:
    image

Link to public reproduction project repository

No response

Version with bug

8.0.70 SR7

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

No response

Did you find any workaround?

No.

Relevant log output

No response

@MartyIX MartyIX added t/bug Something isn't working platform/windows 🪟 labels Jul 12, 2024
Copy link
Contributor

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 and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

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

@MartyIX
Copy link
Contributor Author

MartyIX commented Jul 12, 2024

Ok, the bot is helpful. I found this comment #20265 (comment) and I can fix it using:

<maui:MauiWinUIApplication
    x:Class="MauiAppIcon202407.WinUI.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:maui="using:Microsoft.Maui"
    xmlns:local="using:MauiAppIcon202407.WinUI">
    
    <!-- <AddThis> -->
    <maui:MauiWinUIApplication.Resources>
        <DataTemplate x:Key="MauiAppTitleBarTemplate">
            <Border Canvas.ZIndex="1" VerticalAlignment="Stretch" Margin="0,0,0,0">
                <StackPanel Orientation="Horizontal" Margin="12, 0, 0, 0" x:Name="RootStackPanel">
                    <Image x:Name="AppFontIcon" HorizontalAlignment="Left" VerticalAlignment="Center" Source="appiconLogo.png" Visibility="Visible" Width="16" Height="16"/>
                    <TextBlock x:Name="AppTitle" VerticalAlignment="Center" Margin="{Binding WindowTitleMargin}" Text="{Binding WindowTitle}" 
                               Foreground="{Binding WindowTitleForeground}" Style="{StaticResource CaptionTextBlockStyle}" />
                </StackPanel>
            </Border>
        </DataTemplate>
    </maui:MauiWinUIApplication.Resources>
    <!-- </AddThis> -->

</maui:MauiWinUIApplication>

@MartyIX
Copy link
Contributor Author

MartyIX commented Jul 12, 2024

The second workaround is to change:

-<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
+<MauiImage Include="Resources\AppIcon\square44x44logo.png" />

@MartyIX
Copy link
Contributor Author

MartyIX commented Jul 12, 2024

Duplicate of #6908

@MartyIX MartyIX marked this as a duplicate of #6908 Jul 12, 2024
@MartyIX MartyIX closed this as completed Jul 12, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Aug 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform/windows 🪟 t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant