Skip to content

ImageIconSource is ignored by TitleBar, TabViewItem, InfoBar and TeachingTip, so the icon is blank #25465

Done

Description

@MartinZikmund

Current behavior

ImageIconSource is silently ignored by every control that turns an IconSource into an IconElement through SharedHelpers.MakeIconElementFrom: TitleBar.IconSource, TabViewItem.IconSource, InfoBar.IconSource and TeachingTip.IconSource. No icon element is created, so the icon slot stays empty. There is no warning, and no error.

BitmapIconSource, FontIconSource, SymbolIconSource and PathIconSource work, so swapping the type is the only way to get an icon today.

Expected behavior

ImageIconSource produces an ImageIcon bound to its ImageSource (and Foreground), as in WinUI. WinUI's SharedHelpers::MakeIconElementFrom has an ImageIconSource branch, and it is placed before the BitmapIconSource one on purpose:

https://github.com/microsoft/microsoft-ui-xaml/blob/winui3/release/1.4.2/controls/dev/dll/SharedHelpers.cpp (SharedHelpers::MakeIconElementFrom, the try_as<winrt::ImageIconSource>() branch)

This is backed by reading the WinUI C++ source. I did not run a native WinUI repro.

How to reproduce it

  1. Create a Uno app with a TitleBar (or a TabViewItem, InfoBar, TeachingTip).
  2. Set an ImageIconSource as its icon:
<TitleBar Title="Hello">
    <TitleBar.IconSource>
        <ImageIconSource ImageSource="ms-appx:///Assets/StoreLogo.png" />
    </TitleBar.IconSource>
</TitleBar>
  1. Run the app. The icon slot is empty.
  2. Replace ImageIconSource with <BitmapIconSource ShowAsMonochrome="False" UriSource="ms-appx:///Assets/StoreLogo.png" />. The icon shows.

Runtime-test repro, run on Skia Desktop (net11.0-desktop, Win32) on current master. Before the fix, FindFirstDescendant<ImageIcon>() returns null:

var bitmap = new BitmapImage(new Uri("ms-appx:///Assets/StoreLogo.png"));
var sut = new TitleBar { Title = "My Title", IconSource = new ImageIconSource { ImageSource = bitmap } };
await UITestHelper.Load(sut);
sut.FindFirstDescendant<ImageIcon>().Should().NotBeNull(); // fails on master

Workaround

Use BitmapIconSource with ShowAsMonochrome="False".

Works on UWP/WinUI

WinUI (Windows App SDK). Source-backed: see the C++ reference above.

Environment

Uno Platform

NuGet package version

Current master (4393a8052de49dd04980b3f218ad8f56fa162aab). First seen on Uno.Sdk 7.0.0-dev.75.

Affected platforms

Skia Desktop (Win32) was verified at runtime. The code is shared C#, so I expect every target to be affected.

IDE

None

Relevant plugins

None

Anything else we need to know?

ImageIcon and ImageIconSource themselves are implemented. The gap is only the converter. Root cause: SharedHelpers.MakeIconElementFrom handles FontIconSource, SymbolIconSource, BitmapIconSource and PathIconSource, then returns null. The ImageIconSource branch from the WinUI source was left out of the port.

Suggested fix: add the branch before BitmapIconSource, mirroring WinUI:

else if (iconSource is ImageIconSource imageIconSource)
{
    ImageIcon imageIcon = new ImageIcon();
    if (imageIconSource.ImageSource != null) { imageIcon.Source = imageIconSource.ImageSource; }
    if (imageIconSource.Foreground != null) { imageIcon.Foreground = imageIconSource.Foreground; }
    return imageIcon;
}

With that change the runtime test above passes locally (the icon is 50x50 and the Image inside it uses the same BitmapImage).

Side note: using the type in XAML never gives an Uno0001 warning, because it is not a [NotImplemented] type. The generated stubs for it are under #if false.

Activity

  1. added
    kind/bug
    good first issue
    triage/untriaged
    project/media 📺
    platform/all
    difficulty/starter 🚀
    on Oct 14, 2026
  2. removed
    triage/untriaged
    on Oct 29, 2026
  3. added a commit that references this issue on Nov 25, 2026
    3ddf96a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    difficulty/starter 🚀good first issuekind/bugplatform/allproject/media 📺

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions