From d9697158c3d216a7ca696713410ed642b347327f Mon Sep 17 00:00:00 2001 From: dongsug-song <35130733+dongsug-song@users.noreply.github.com> Date: Wed, 7 Nov 2018 14:15:56 +0900 Subject: [PATCH 1/1] [NUI] Fix to make null assigning to ResourceUrl possible (#537) --- .../src/public/BaseComponents/ImageView.cs | 23 ++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs index 22f4e12..1a4829d 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs @@ -31,25 +31,28 @@ namespace Tizen.NUI.BaseComponents { /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty ResourceUrlProperty = BindableProperty.Create("ResourceUrl", typeof(string), typeof(ImageView), string.Empty, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty ResourceUrlProperty = BindableProperty.Create(nameof(ImageView.ResourceUrl), typeof(string), typeof(ImageView), string.Empty, propertyChanged: (bindable, oldValue, newValue) => { var imageView = (ImageView)bindable; - if (newValue != null) + imageView._url = (string)newValue; + + if (imageView._url != null) { - string url = (string)newValue; - if (imageView.IsCreateByXaml && url.Contains("*Resource*")) + if (imageView.IsCreateByXaml && imageView._url.Contains("*Resource*")) { string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource; - url = url.Replace("*Resource*", resource); + imageView._url = imageView._url.Replace("*Resource*", resource); } - imageView._url = url; - imageView.UpdateImage(); } + imageView.UpdateImage(); }, defaultValueCreator:(bindable) => { var imageView = (ImageView)bindable; - Tizen.NUI.Object.GetProperty(imageView.swigCPtr, ImageView.Property.IMAGE).Get(out imageView._url); + if(imageView._url != null) + { + Tizen.NUI.Object.GetProperty(imageView.swigCPtr, ImageView.Property.IMAGE).Get(out imageView._url); + } return imageView._url; }); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. @@ -729,6 +732,10 @@ namespace Tizen.NUI.BaseComponents SetProperty(ImageView.Property.IMAGE, new PropertyValue(_url)); } } + else + { + SetProperty(ImageView.Property.IMAGE, new PropertyValue("")); + } } private Rectangle _border = null; -- 2.7.4