[NUI] Fix ThumbColor property to change its own color
authorSeoyeon Kim <seoyeon2.kim@samsung.com>
Tue, 10 May 2022 06:38:13 +0000 (15:38 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Fri, 27 May 2022 06:02:37 +0000 (15:02 +0900)
- Currently, when the user sets ThumbColor, the background color of
 thumb is changed.
- Fixed to change the thumb color itself, not the background color.

Signed-off-by: Seoyeon Kim <seoyeon2.kim@samsung.com>
src/Tizen.NUI.Components/Controls/Slider.cs

index 5c88e1b..d428b21 100755 (executable)
@@ -613,14 +613,40 @@ namespace Tizen.NUI.Components
         {
             get
             {
-                return thumbImage?.Color;
+                return thumbColor;
             }
             set
             {
                 if (null != thumbImage)
                 {
-                    thumbImage.BackgroundColor = value;
                     thumbColor = value;
+
+                    if (thumbImage.ResourceUrl != null)
+                    {
+                        thumbImage.ResourceUrl = null;
+                    }
+
+                    using (PropertyMap map = new PropertyMap())
+                    {
+                        // To remove CA2000 warning messages, use `using` statement.
+                        using (PropertyValue type = new PropertyValue((int)Visual.Type.Color))
+                        {
+                            map.Insert((int)Visual.Property.Type, type);
+                        }
+                        using (PropertyValue color = new PropertyValue(thumbColor))
+                        {
+                            map.Insert((int)ColorVisualProperty.MixColor, color);
+                        }
+                        using (PropertyValue radius = new PropertyValue(0.5f))
+                        {
+                            map.Insert((int)Visual.Property.CornerRadius, radius);
+                        }
+                        using (PropertyValue policyType = new PropertyValue((int)VisualTransformPolicyType.Relative))
+                        {
+                            map.Insert((int)Visual.Property.CornerRadiusPolicy, policyType);
+                        }
+                        thumbImage.Image = map;
+                    }
                 }
             }
         }