From 605db3cc0f5cc2ecfea6806e008600b51863851a Mon Sep 17 00:00:00 2001 From: bluepilledgreat <97983689+bluepilledgreat@users.noreply.github.com> Date: Sat, 19 Oct 2024 21:36:48 +0100 Subject: [PATCH] dont create a bitmapimage for gifs --- .../Bootstrapper/CustomDialog.Creator.cs | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/Bloxstrap/UI/Elements/Bootstrapper/CustomDialog.Creator.cs b/Bloxstrap/UI/Elements/Bootstrapper/CustomDialog.Creator.cs index 96f65dd..dd6a729 100644 --- a/Bloxstrap/UI/Elements/Bootstrapper/CustomDialog.Creator.cs +++ b/Bloxstrap/UI/Elements/Bootstrapper/CustomDialog.Creator.cs @@ -523,21 +523,25 @@ namespace Bloxstrap.UI.Elements.Bootstrapper if (result == null) throw new Exception("Image Source uri is null"); - BitmapImage bitmapImage; - try - { - bitmapImage = new BitmapImage(result); - } - catch (Exception ex) - { - throw new Exception($"Image Failed to create BitmapImage: {ex.Message}", ex); - } - bool isAnimated = ParseXmlAttribute(xmlElement, "IsAnimated", false); if (!isAnimated) + { + BitmapImage bitmapImage; + try + { + bitmapImage = new BitmapImage(result); + } + catch (Exception ex) + { + throw new Exception($"Image Failed to create BitmapImage: {ex.Message}", ex); + } + image.Source = bitmapImage; - else // we create the bitmapimage to check if the gif is valid + } + else + { XamlAnimatedGif.AnimationBehavior.SetSourceUri(image, result); + } } ApplyTransformations_UIElement(image, xmlElement);