Fix controls created by xaml issues (#341)
authorXianbing Teng <xb.teng@samsung.com>
Fri, 20 Jul 2018 10:21:54 +0000 (18:21 +0800)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Fri, 20 Jul 2018 10:21:54 +0000 (19:21 +0900)
src/Tizen.NUI/src/internal/Xaml/CreateValuesVisitor.cs
src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs
src/Tizen.NUI/src/public/BaseComponents/TextField.cs
src/Tizen.NUI/src/public/UIComponents/PushButton.cs
src/Tizen.NUI/src/public/UIComponents/Slider.cs
src/Tizen.NUI/src/public/XamlBinding/BindableObject.cs
src/Tizen.NUI/src/public/XamlBinding/ContentPage.cs

index 0dc695a..7d168b9 100755 (executable)
@@ -90,7 +90,7 @@ namespace Tizen.NUI.Xaml
                         value = Activator.CreateInstance(type);
                         if (value is BindableObject)
                         {
-                            ((BindableObject)value).isCreateByXaml = true;
+                            ((BindableObject)value).IsCreateByXaml = true;
                         }
                     }
                 }
@@ -202,7 +202,7 @@ namespace Tizen.NUI.Xaml
                 object ret = Activator.CreateInstance(nodeType, arguments);
                 if (ret is BindableObject)
                 {
-                    ((BindableObject)ret).isCreateByXaml = true;
+                    ((BindableObject)ret).IsCreateByXaml = true;
                 }
                 return ret;
             }
@@ -306,7 +306,7 @@ namespace Tizen.NUI.Xaml
                 value = Activator.CreateInstance(nodeType);
                 if (value is BindableObject)
                 {
-                    ((BindableObject)value).isCreateByXaml = true;
+                    ((BindableObject)value).IsCreateByXaml = true;
                 }
             }
 
index f442e56..545eb36 100755 (executable)
@@ -1217,10 +1217,26 @@ namespace Tizen.NUI.BaseComponents
         public TextEditor() : this(NDalicPINVOKE.TextEditor_New(), true)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            this.TextChanged += (obj, e) =>
+        }
+
+        internal override bool IsCreateByXaml
+        {
+            get
             {
-                this.Text = this.Text;
-            };
+                return base.IsCreateByXaml;
+            }
+            set
+            {
+                base.IsCreateByXaml = value;
+
+                if (value == true)
+                {
+                    this.TextChanged += (obj, e) =>
+                    {
+                        this.Text = this.Text;
+                    };
+                }
+            }
         }
 
         internal TextEditor(TextEditor handle) : this(NDalicPINVOKE.new_TextEditor__SWIG_1(TextEditor.getCPtr(handle)), true)
index d77f8b7..f62a203 100755 (executable)
@@ -1256,9 +1256,26 @@ namespace Tizen.NUI.BaseComponents
         public TextField() : this(NDalicPINVOKE.TextField_New(), true)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            this.TextChanged += (obj, e) => {
-                this.Text = this.Text;
-            };
+        }
+
+        internal override bool IsCreateByXaml
+        {
+            get
+            {
+                return base.IsCreateByXaml;
+            }
+            set
+            {
+                base.IsCreateByXaml = value;
+
+                if (value == true)
+                {
+                    this.TextChanged += (obj, e) =>
+                    {
+                        this.Text = this.Text;
+                    };
+                }
+            }
         }
 
         internal TextField(TextField handle) : this(NDalicPINVOKE.new_TextField__SWIG_1(TextField.getCPtr(handle)), true)
index e694d84..4c47db0 100755 (executable)
@@ -103,15 +103,31 @@ namespace Tizen.NUI.UIComponents
         public PushButton() : this(NDalicPINVOKE.PushButton_New(), true)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            this.Clicked += (sender, e) =>
+        }
+
+        internal override bool IsCreateByXaml
+        {
+            get
             {
-                ICommand command = this.Command;
-                if (command != null)
+                return base.IsCreateByXaml;
+            }
+            set
+            {
+                base.IsCreateByXaml = value;
+
+                if (value == true)
                 {
-                    command.Execute(this.CommandParameter);
+                    this.Clicked += (sender, e) =>
+                    {
+                        ICommand command = this.Command;
+                        if (command != null)
+                        {
+                            command.Execute(this.CommandParameter);
+                        }
+                        return true;
+                    };
                 }
-                return true;
-            };
+            }
         }
 
         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
index 89de3c0..59eef13 100755 (executable)
@@ -757,11 +757,26 @@ namespace Tizen.NUI.UIComponents
         public Slider() : this(NDalicPINVOKE.Slider_New(), true)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
 
-            this.ValueChanged += (obj, e) => {
-                this.Value = e.SlideValue;
-                return true;
-            };
+        internal override bool IsCreateByXaml
+        {
+            get
+            {
+                return base.IsCreateByXaml;
+            }
+            set
+            {
+                base.IsCreateByXaml = value;
+
+                if (value == true)
+                {
+                    this.ValueChanged += (obj, e) => {
+                        this.Value = e.SlideValue;
+                        return true;
+                    };
+                }
+            }
         }
 
         internal Slider(Slider handle) : this(NDalicPINVOKE.new_Slider__SWIG_1(Slider.getCPtr(handle)), true)
index 92f20d8..5d24e1b 100755 (executable)
@@ -148,7 +148,18 @@ namespace Tizen.NUI.Binding
             SetBinding(targetProperty, binding, false);
         }
 
-        internal bool isCreateByXaml = false;
+        private bool isCreateByXaml = false;
+        internal virtual bool IsCreateByXaml
+        {
+            get
+            {
+                return isCreateByXaml;
+            }
+            set
+            {
+                isCreateByXaml = value;
+            }
+        }
 
         /// <summary>
         /// Sets the value of the specified property.
index a7faadc..3a31e72 100755 (executable)
@@ -113,7 +113,7 @@ namespace Tizen.NUI
         [EditorBrowsable(EditorBrowsableState.Never)]
         public ContentPage(Window win)
         {
-            isCreateByXaml = true;
+            IsCreateByXaml = true;
 
             Root = new View();
             Root.WidthResizePolicy = ResizePolicyType.FillToParent;