#endif
}
+#if __MOBILE__
+ public static UIColor FromPatternImageFromBundle(string bgImage)
+ {
+ var image = UIImage.FromBundle(bgImage);
+ if (image == null)
+ return UIColor.White;
+
+ return UIColor.FromPatternImage(image);
+ }
+#endif
+
public static Color ToColor(this UIColor color)
{
nfloat red;
string bgImage = ((Page)Element).BackgroundImage;
if (!string.IsNullOrEmpty(bgImage))
{
- View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromBundle(bgImage));
+ View.BackgroundColor = ColorExtensions.FromPatternImageFromBundle(bgImage);
return;
}
Color bgColor = Element.BackgroundColor;
string bgImage = ((Page)Element).BackgroundImage;
if (!string.IsNullOrEmpty(bgImage))
{
- View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromBundle(bgImage) ?? throw new Exception($"Image: File '{bgImage}' not found in app bundle"));
+ View.BackgroundColor = ColorExtensions.FromPatternImageFromBundle(bgImage);
return;
}
Color bgColor = Element.BackgroundColor;
void UpdateBackground()
{
if (!string.IsNullOrEmpty(((Page)Element).BackgroundImage))
- View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromBundle(((Page)Element).BackgroundImage));
+ View.BackgroundColor = ColorExtensions.FromPatternImageFromBundle(((Page)Element).BackgroundImage);
else if (Element.BackgroundColor == Color.Default)
View.BackgroundColor = UIColor.White;
else
void UpdateBackground()
{
if (!string.IsNullOrEmpty(((Page)Element).BackgroundImage))
- View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromBundle(((Page)Element).BackgroundImage));
+ View.BackgroundColor = ColorExtensions.FromPatternImageFromBundle(((Page)Element).BackgroundImage);
else if (Element.BackgroundColor == Color.Default)
View.BackgroundColor = UIColor.White;
else