[NUI] Fix ViewStyle.BorderlineColorSelector to work
authorJaehyun Cho <jae_hyun.cho@samsung.com>
Thu, 15 Sep 2022 06:48:57 +0000 (15:48 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Wed, 21 Sep 2022 05:52:33 +0000 (14:52 +0900)
ViewStyle.BorderlineColorSelector did not work properly because
View.BorderlineColorSelector property was not added.

Like BackgroundColor, color selector typed BorderlineColor should be
used in ViewStyle only.
So View.BorderlineColorSelector is internally used only.

src/Tizen.NUI/src/public/BaseComponents/View.cs
src/Tizen.NUI/src/public/BaseComponents/ViewBindableProperty.cs

index a826ca6..34ccf01 100755 (executable)
@@ -689,6 +689,24 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
+        /// The color selector for the borderline of the View.
+        /// Like BackgroundColor, color selector typed BorderlineColor should be used in ViewStyle only.
+        /// So this API is internally used only.
+        /// </summary>
+        internal Selector<Color> BorderlineColorSelector
+        {
+            get
+            {
+                return (Selector<Color>)GetValue(BorderlineColorSelectorProperty);
+            }
+            set
+            {
+                SetValue(BorderlineColorSelectorProperty, value);
+                NotifyPropertyChanged();
+            }
+        }
+
+        /// <summary>
         /// The Relative offset for the borderline of the View.
         /// Recommended range : [-1.0f to 1.0f].
         /// If -1.0f, draw borderline inside of the View.
index dded0ea..494d9d6 100755 (executable)
@@ -2025,6 +2025,30 @@ namespace Tizen.NUI.BaseComponents
         );
 
         /// <summary>
+        /// BorderlineColorSelector Property
+        /// Like BackgroundColor, color selector typed BorderlineColor should be used in ViewStyle only.
+        /// So this API is internally used only.
+        /// </summary>
+        internal static readonly BindableProperty BorderlineColorSelectorProperty = BindableProperty.Create(nameof(BorderlineColorSelector), typeof(Selector<Color>), typeof(View), null,
+            propertyChanged: (bindable, oldValue, newValue) =>
+            {
+                var view = (View)bindable;
+
+                view.themeData?.selectorData?.BorderlineColor?.Reset(view);
+
+                Selector<Color> selector = newValue as Selector<Color>;
+                if (selector.HasAll()) view.SetBorderlineColor(selector.All);
+                else view.EnsureSelectorData().BorderlineColor = new TriggerableSelector<Color>(view, selector, view.SetBorderlineColor, true);
+            },
+            defaultValueCreator: (bindable) =>
+            {
+                var view = (View)bindable;
+                var selector = view.themeData?.selectorData?.BorderlineColor?.Get();
+                return (null != selector) ? selector : new Selector<Color>();
+            }
+        );
+
+        /// <summary>
         /// BorderlineOffset Property
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]