[Tizen] Fixed many issues.
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / View.cs
index 7646242..d0ddfee 100755 (executable)
@@ -820,28 +820,21 @@ namespace Tizen.NUI.BaseComponents
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-        /// <summary>
-        /// Downcasts a handle to View handle.<br>
-        /// If handle points to a View, the downcast produces valid handle.<br>
-        /// If not, the returned handle is left uninitialized.<br>
-        /// </summary>
-        /// <param name="handle">Handle to an object</param>
-        /// <returns>A handle to a View or an uninitialized handle</returns>
-        [Obsolete("Please do not use! this will be deprecated")]
+        [Obsolete("Please do not use! this will be deprecated, instead please us as keyword.")]
         public new static View DownCast(BaseHandle handle)
         {
-            View ret = new View(NDalicPINVOKE.View_DownCast(BaseHandle.getCPtr(handle)), true);
+            View ret =  Registry.GetManagedBaseHandleFromNativePtr(handle) as View;
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }
 
-        [Obsolete("Please do not use! this will be deprecated")]
+        [Obsolete("Please do not use! this will be deprecated, instead please us as keyword.")]
         public static T DownCast<T>(View view) where T : View
         {
-            View ret = Registry.GetManagedBaseHandleFromNativePtr(view) as View;
+            T ret = Registry.GetManagedBaseHandleFromNativePtr(view) as T;
             if (ret != null)
             {
-                return (T)ret;
+                return ret;
             }
             return null;
         }
@@ -2021,7 +2014,9 @@ namespace Tizen.NUI.BaseComponents
 
         internal Layer GetLayer()
         {
-            Layer ret = new Layer(NDalicPINVOKE.Actor_GetLayer(swigCPtr), true);
+            IntPtr cPtr = NDalicPINVOKE.Actor_GetLayer(swigCPtr);
+            Layer ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Layer;
+
             if (NDalicPINVOKE.SWIGPendingException.Pending)
                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
@@ -2719,7 +2714,9 @@ namespace Tizen.NUI.BaseComponents
 
         public Renderer GetRendererAt(uint index)
         {
-            Renderer ret = new Renderer(NDalicPINVOKE.Actor_GetRendererAt(swigCPtr, index), true);
+            IntPtr cPtr = NDalicPINVOKE.Actor_GetRendererAt(swigCPtr, index);
+            Renderer ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Renderer;
+
             if (NDalicPINVOKE.SWIGPendingException.Pending)
                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;