-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Bug] Font Icon Disappears when Minimizing Window in UWP #8293
Comments
@djrpascu I've been minimizing and restoring this window for several minutes now, and the icon is still there. I think we might be missing some details. Do you have multiple monitors? |
@hartez hmm... i have a laptop on a dock and 2 monitors (24"), so 3 screens all together. Not sure about desktop/tablet mode. I just try it from within VS under "Local Machine", Debug, x86. I also try running the version that gets installed on my machine after debugging. Let me know if there is any further detail I can provide. I'm going to have a co-worker try it on his machine as well. |
I ask about the multiple monitors because we've had a couple of UWP bugs in the past that only show up when running on a secondary monitor. |
I wonder if you're encountering this problem: #7505 |
@hartez thanks, I took my laptop off the dock and tried with just that single monitor and was still able to reproduce the issue.. still waiting on co-worker results.. send me the build, glad to test it out.. thanks much! |
just wanted to follow-up on this... i'm still seeing the issue.. tried switching to UWP version 1903 build 18362, but still same.. my co-worker doesn't experience it on his machine.. can get difference in build specs if needed.. |
Same behaviour here... In my case it's happening after around 10 mins. |
I can constantly able to reproduce it by minimizing an application and activate another application. Any update or workaround for this issue will be helpful. |
I am not experiencing the issue but some of my colleagues are. It happens when the app is minimised for them. A machine where it was failing was running at 1920x1080 @ 125% DPI scale on Windows 1909 OS Build 18363.900. My machine when I tried switching to those display settings (Windows 1903 OS Build 18632.900) did not have the issue. |
It seems that the fix was merged here: #10161, Analyzing the fix, It seems that it only applies to Toolbar Items and ImageRenderers. So if you use a button with ImageSource, this seems to be not covered by the fix. I'm still experiencing this on my buttons with fonticonsource. |
I agree with @rueldognidon regarding PR 10161. Same fix needs to be applied to other controls. Button, ImageButton and Image all still have this problem. My notes: Tested with:
I tested with new approach of using ExportFont and including font in main project but still had same problems as old way (old way = including font in UWP project and mapping it through a static resource). New test repo with this new approach is here for reference: Not sure if this has every worked in any version for UWP. For iOS it works fine. Consistently happens for me if I minimize the window for 5 seconds and then restore it. Video demo here: Note the same problem happens if I start the app and then go to the Windows Lock screen and then sign in again. Once images disappear I can't get them back without restarting the app. I did my testing on a laptop without any external monitors connected. 1920 x 1080 resolution. 125% scale. Testing in Desktop mode. Happens for these controls: Button, ImageButton, Image |
Confirmed this is still reproduceable in 5.0.0.1487-pre1 as well. |
I can also confirm that this bug is in XF 4.8 SR 1. This is strange because we have discussed it in #8783 and it seemed to disappear suddenly in XF 4.8 on my computer. But now it is back. I had to reinstall Windows on that computer some time ago so I am not sure if the return of the bug was caused by some changes between 4.8 and 4.8 SR 1, or if it is caused by the OS reinstall. |
We are also encountering this issue when minimising/maximising our UWP application. As others have pointed out, the application needs to be restarted before you can see the icons again. This is a major issue for us!! |
Issue persist on UWP and noticed that it is only happening with Image Button, with Label it is working fine.
|
…mes again the image source should be reupdated as uwp replaces images with transparent images onResume
…ng Window in UWP When the uwp app suspends and resumes again the image source should be reupdated as uwp replaces images with transparent images onResume
This commit will fix ImageButton control 👍 But this problem also happens for Button and Image controls. Can the same fix be applied to them as well please. |
This fix is already applied to the imagerenderer. See pull request #10161 |
The problem still persists for ImageButton. Also the latest Xamarin.Forms 5.0 SR 5 contains this bug. The app does not have to be minimized. The FontIcon can disappear also when the app is opened in the foreground for a longer time without user interaction. |
How can we resolve this, it's such basic problem going on for 2 years, we can't have apps with despairing buttons |
@holecekp @vladimirsakic Unfortunately, I'm still seeing the issue too still in XF 5.0.0.2012. I tried the fixes proposed by @MichielDG as well, but icons still disappeared. I ended up creating png files for all my icons. I have a feeling, most all of these issues are getting put on back burner for .NET MAUI, hopefully we won't run into issues like these then? |
@djrpascu Thanks a lot, replacing icons with pngs would also work for me, that solution didn't cross my mind. |
xamarin#8606 This resolves issue above although I think for UWP it may be better to just use a TextBlock. Renderers affected by xamarin#8293 and xamarin#14323 can check the type of ImageSource and if FontImageSource can render a TextBlock. I say may as I have not throughly tested my idea but it appears to work for a ButtonRenderer with a slight adjustment of existing code. I will add code to mentioned issues shortly. ``` internal static class FontImageSourceExtensions { public static TextBlock ToTextBlock(this FontImageSource fontImageSource) { var fontFamily = fontImageSource.FontFamily; var iconColor = fontImageSource.Color != Color.Default ? fontImageSource.Color : Color.White; var textBlock = new TextBlock() { Text = fontImageSource.Glyph, Foreground = iconColor.ToBrush() }; var font = Font.OfSize(fontFamily, fontImageSource.Size); textBlock.ApplyFont(font); return textBlock; } } ```
After trying the following. Creating a StreamImageSource that drew icons with skia.
Create implementation to provide the typeface - e.g
Advantages Creating a FontImageSourceHandler and drawing to BitmapImage using similar code to existing ( with the alignment correction ) Creating a custom renderer, checking the ImageSource type and if FontImageSource then create a TextBlock instead ! I can paste the code in here if anyone wants to go down that route as it is a pain matching the existing code due to internals. I only did ButtonRenderer as it occurred to me that it may be possible to do with an effect. The effect below is for Button and ImageButton. For an image you cannot hack in this manner and I instead I just use a Label ( which does not suffer from the alignment issue.) The code just converts the FontImageSource to a TextBlock and replaces the Image that is created by the renderer.
The behaviour is a little bit different for ImageButton. For
and of course after minimizing |
You can add your Button or ImageButton inside this to have the effect applied
Although I think that this may be better
Usage
with |
The issue still occurs for Image also. How can we resolve this ? |
@SujaVenkatesan I am going to provide an alternative pull request that uses the FontIcon. |
Hello, i still happening with ImageButton and a new Xamarin project created 2 months ago. |
Also still happening with Button. Can this please be fixed??? |
Description
In a XF UWP app, the font icon seems to disappear after minimizing the window a few times. Seems to disappear after minimizing and opening the window 4 times for me. But I've observed it to be inconsistent at times, sometimes after minimizing 2 times, others more than 10 times.
Steps to Reproduce
Expected Behavior
Icon remains in view.
Actual Behavior
Icon disappears.
Basic Information
Screenshots
Reproduction Link
XFFontIconBug Repo
The text was updated successfully, but these errors were encountered: