[NUI] Fix style loading issue when extending control classes (#1550)
authorwoohyun <woo_hyun0705@naver.com>
Tue, 9 Jun 2020 05:24:06 +0000 (14:24 +0900)
committerGitHub <noreply@github.com>
Tue, 9 Jun 2020 05:24:06 +0000 (14:24 +0900)
When a NUI.Component.Control class was extended, the default style
was not loaded well.
This was because searching style logic was executed with not whole base classes
but only with the inherited class.

Co-authored-by: WooHyun Jung <wh0705.jung@samsung.com>
src/Tizen.NUI.Components/Controls/Control.cs

index 3ea6fe0..e75413a 100755 (executable)
@@ -52,7 +52,16 @@ namespace Tizen.NUI.Components
         [EditorBrowsable(EditorBrowsableState.Never)]
         public Control() : base()
         {
-            ViewStyle viewStyle = StyleManager.Instance.GetComponentStyle(this.GetType());
+            var cur_type = this.GetType();
+            ViewStyle viewStyle = null;
+
+            do
+            {
+                if (cur_type.Equals(typeof(Tizen.NUI.Components.Control))) break;
+                viewStyle = StyleManager.Instance.GetComponentStyle(cur_type);
+                cur_type = cur_type.BaseType;
+            }
+            while (viewStyle == null);
 
             if (viewStyle != null)
             {