dont create a bitmapimage for gifs

This commit is contained in:
bluepilledgreat 2024-10-19 21:36:48 +01:00
parent 23d8bb1aaa
commit 605db3cc0f

View File

@ -523,6 +523,9 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
if (result == null)
throw new Exception("Image Source uri is null");
bool isAnimated = ParseXmlAttribute<bool>(xmlElement, "IsAnimated", false);
if (!isAnimated)
{
BitmapImage bitmapImage;
try
{
@ -533,12 +536,13 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
throw new Exception($"Image Failed to create BitmapImage: {ex.Message}", ex);
}
bool isAnimated = ParseXmlAttribute<bool>(xmlElement, "IsAnimated", false);
if (!isAnimated)
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);