var view = (View)bindable;
if (newValue != null)
{
- Tizen.NUI.Object.SetProperty(view.swigCPtr, View.Property.BACKGROUND, new Tizen.NUI.PropertyValue((string)newValue));
+ string url = (string)newValue;
+
+ if (Rectangle.IsNullOrZero(view.backgroundImageBorder))
+ {
+ Tizen.NUI.Object.SetProperty(view.swigCPtr, View.Property.BACKGROUND, new PropertyValue(url));
+ }
+ else
+ {
+ var visual = new NPatchVisual();
+ visual.URL = url;
+ visual.Border = view.backgroundImageBorder;
+ Tizen.NUI.Object.SetProperty(view.swigCPtr, View.Property.BACKGROUND, new PropertyValue(visual.OutputVisualMap));
+ }
+
view.BackgroundImageSynchronosLoading = view._backgroundImageSynchronosLoading;
}
},
Tizen.NUI.PropertyMap background = view.Background;
int visualType = 0;
background.Find(Visual.Property.Type)?.Get(out visualType);
- if (visualType == (int)Visual.Type.Image)
+ if ((visualType == (int)Visual.Type.Image) || (visualType == (int)Visual.Type.NPatch))
{
background.Find(ImageVisualProperty.URL)?.Get(out backgroundImage);
}
public static readonly BindableProperty BackgroundImageBorderProperty = BindableProperty.Create(nameof(BackgroundImageBorder), typeof(Rectangle), typeof(View), default(Rectangle), propertyChanged: (bindable, oldValue, newValue) =>
{
var view = (View)bindable;
- if (null != newValue)
+ string url = view.BackgroundImage;
+ view.backgroundImageBorder = (Rectangle)newValue;
+
+ if (string.IsNullOrEmpty(url))
+ {
+ return;
+ }
+
+ if (Rectangle.IsNullOrZero(view.backgroundImageBorder))
+ {
+ Tizen.NUI.Object.SetProperty(view.swigCPtr, View.Property.BACKGROUND, new PropertyValue(url));
+ }
+ else
{
- view.backgroundImageBorder = (Rectangle)newValue;
+ var visual = new NPatchVisual();
+ visual.URL = url;
+ visual.Border = view.backgroundImageBorder;
+ Tizen.NUI.Object.SetProperty(view.swigCPtr, View.Property.BACKGROUND, new PropertyValue(visual.OutputVisualMap));
}
},
defaultValueCreator: (bindable) =>
{
var view = (View)bindable;
- return view.backgroundImageBorder;
+ return view.backgroundImageBorder == null ? new Rectangle(view.OnBackgroundImageBorderChanged) : new Rectangle(view.OnBackgroundImageBorderChanged, view.backgroundImageBorder);
});
/// <summary>
/// BackgroundProperty
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
+ internal Rectangle(RectangleChangedCallback cb) : this()
+ {
+ }
+
internal Rectangle(RectangleChangedCallback cb, Rectangle other) : this(cb, other.x, other.y, other.width, other.height)
{
}
{
Interop.Rectangle.delete_Rectangle(swigCPtr);
}
+
+ /// <summary>
+ /// Determines whether the reference is null or the Rectangle has all 0 properties.
+ /// </summary>
+ internal static bool IsNullOrZero(Rectangle rectangle) => (rectangle == null || (rectangle.top == 0 && rectangle.right == 0 && rectangle.bottom == 0 && rectangle.left == 0));
}
}
\ No newline at end of file