Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

#8293 - uwp - imagebutton - Font Icon Disappears when Minimizing Wind… #13971

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Xamarin.Forms.Platform.UAP/ImageButtonRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class ImageButtonRenderer : ViewRenderer<ImageButton, FormsButton>, IImag
public ImageButtonRenderer() : base()
{
ImageElementManager.Init(this);
Windows.UI.Xaml.Application.Current.Resuming += OnResumingAsync;
}

protected override void Dispose(bool disposing)
Expand All @@ -40,6 +41,7 @@ protected override void Dispose(bool disposing)
{
_image.ImageOpened -= OnImageOpened;
_image.ImageFailed -= OnImageFailed;
Windows.UI.Xaml.Application.Current.Resuming -= OnResumingAsync;
}
}

Expand Down Expand Up @@ -149,6 +151,18 @@ protected async Task UpdateSource()
await ImageElementManager.UpdateSource(this).ConfigureAwait(false);
}

async void OnResumingAsync(object sender, object e)
{
try
{
await ImageElementManager.UpdateSource(this);
}
catch (Exception exception)
{
Log.Warning("Update image source after app resume",
$"ImageSource failed to update after app resume: {exception.Message}");
}
}

void OnImageOpened(object sender, RoutedEventArgs routedEventArgs)
{
Expand Down