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

Make GeneratedIconSource.Size DPI aware #182

Open
1 of 5 tasks
PikeUK opened this issue Dec 3, 2024 · 1 comment
Open
1 of 5 tasks

Make GeneratedIconSource.Size DPI aware #182

PikeUK opened this issue Dec 3, 2024 · 1 comment

Comments

@PikeUK
Copy link

PikeUK commented Dec 3, 2024

What would you like to be added:

GeneratedIconSource.Size currently needs to be set to different values at different Windows scaling levels. I'd like it to be DPI agnostic.

Why is this needed:

Currently if you set GeneratedIconSource.Size to 16 this works fine at 100% scaling in Windows 11, but causes the icon text to not generate at 200% scaling. If you set the size to 32 then the text generates fine at 200% scaling but is tiny at 100% scaling. It would be nice if this property was DPI-aware so it could just be set to 16 and would work at any scaling.

For which Platform:

  • All
  • WPF
  • WinUI
  • Uno
  • Core

Anything else we need to know?

I did a quick fix in my app by removing Size from the XAML and adding the following to the code:

this.TrayIcon.Size = (int)Math.Round(16 * VisualTreeHelper.GetDpi(this).PixelsPerDip);

@PikeUK
Copy link
Author

PikeUK commented Dec 3, 2024

Forgot to mention, I think GeneratedIconSource.TextMargin might also not be DPI aware I didn't investigate that too much. GeneratedIconSource.FontSize on the other hand does automatically scale with Windows DPI scaling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant