[NUI] add ImageUrl property on DefaultGridItem.
authorEverLEEst(SangHyeon Lee) <sh10233.lee@samsung.com>
Thu, 15 Dec 2022 11:38:44 +0000 (20:38 +0900)
committerSeoyeon2Kim <34738918+Seoyeon2Kim@users.noreply.github.com>
Tue, 20 Dec 2022 06:43:24 +0000 (15:43 +0900)
src/Tizen.NUI.Components/Controls/RecyclerView/Item/DefaultGridItem.cs
src/Tizen.NUI.Components/Controls/RecyclerView/Item/DefaultGridItemBindableProperty.cs

index 499f1e9..843cdb5 100755 (executable)
@@ -164,23 +164,32 @@ namespace Tizen.NUI.Components
             }
         }
 
-        /* open when ImageView using Uri not string
-                /// <summary>
-                /// Image image's resource url in DefaultGridItem.
-                /// </summary>
-                [EditorBrowsable(EditorBrowsableState.Never)]
-                public string ImageUrl
-                {
-                    get
-                    {
-                        return Image.ResourceUrl;
-                    }
-                    set
-                    {
-                        Image.ResourceUrl = value;
-                    }
-                }
-        */
+        /// <summary>
+        /// Image image's resource url in DefaultGridItem.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public string ImageUrl
+        {
+            get => GetValue(ImageUrlProperty) as string;
+            set
+            {
+                SetValue(ImageUrlProperty, value);
+                NotifyPropertyChanged();
+            }
+        }
+
+        internal string InternalImageUrl
+        {
+            get
+            {
+                return Image.ResourceUrl;
+            }
+            set
+            {
+                Image.ResourceUrl = value;
+            }
+        }
+
 
         /// <summary>
         /// DefaultGridItem's text part.
index 4a62d0f..443e2e0 100755 (executable)
@@ -42,6 +42,25 @@ namespace Tizen.NUI.Components
             return instance.InternalText;
         });
 
+
+        /// <summary>
+        /// ImageUrlProperty
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static readonly BindableProperty ImageUrlProperty = BindableProperty.Create(nameof(ImageUrl), typeof(string), typeof(DefaultGridItem), default(string), propertyChanged: (bindable, oldValue, newValue) =>
+        {
+            var instance = (DefaultGridItem)bindable;
+            if (newValue != null)
+            {
+                instance.InternalImageUrl = newValue as string;
+            }
+        },
+        defaultValueCreator: (bindable) =>
+        {
+            var instance = (DefaultGridItem)bindable;
+            return instance.InternalImageUrl;
+        });
+
         /// <summary>
         /// LabelOrientationTypeProperty
         /// </summary>