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

Unable to use Segoe MDL2 Assets as Icon source #157

Open
Euclidite opened this issue May 29, 2024 · 0 comments
Open

Unable to use Segoe MDL2 Assets as Icon source #157

Euclidite opened this issue May 29, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Euclidite
Copy link

Describe the bug

I've been trying different variations of this for a few days now, but I can't seem to get it working. What I'm trying to do is use one of the icons from Segoe MDL2 Assets as the tray icon, however, it ends up rendering wrong / cut off.

Here's what I'm seeing:
image

Here's the option I originally tried:

this.trayIcon = new TaskbarIcon
{
    IconSource = new GeneratedIconSource
    {
        Foreground = new SolidColorBrush(Microsoft.UI.Colors.White),
        Text = "\uE83F",
        FontFamily = new Microsoft.UI.Xaml.Media.FontFamily("Segoe MDL2 Assets"),
        FontSize = 64
    }
};

this.trayIcon.ForceCreate();

When that didn't work I tried:

var icon = SystemDrawingIconGenerator.Generate(
    Brushes.Transparent,
    Brushes.White,
    text: "\uE83F",
    font: new Font("Segoe MDL2 Assets", 64)
);

this.trayIcon = new TaskbarIcon
{
    Icon = Icon.FromHandle(icon.GetHicon())
};

this.trayIcon.ForceCreate();

When I save icon to disk to see if it renders properly, it does
image

Steps to reproduce the bug

No response

Expected behavior

No response

Screenshots

No response

NuGet package version

2.0.131 (Latest available)

Platform

WinUI

IDE

Visual Studio 2022

Windows Version

Windows 10

WindowsAppSDK Version

Other

WindowsAppSDK Type

Packaged

Manifest

Package.appxmanifest

Additional context

No response

@Euclidite Euclidite added the bug Something isn't working label May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant