[NUI] Manual merge from tizen50 (#653)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / ImageView.cs
index 30bcac2..41fa2ef 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  *
  */
+using System;
+using System.Runtime.InteropServices;
+using System.ComponentModel;
+using Tizen.NUI.Binding;
 
 namespace Tizen.NUI.BaseComponents
 {
-    using System;
-    using System.Runtime.InteropServices;
 
     /// <summary>
     /// ImageView is a class for displaying an image resource.<br />
     /// An instance of ImageView can be created using a URL or an image instance.<br />
     /// </summary>
+    /// <since_tizen> 3 </since_tizen>
     public class ImageView : View
     {
-        private global::System.Runtime.InteropServices.HandleRef swigCPtr;
-
-        internal ImageView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.ImageView_SWIGUpcast(cPtr), cMemoryOwn)
+        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static readonly BindableProperty ResourceUrlProperty = BindableProperty.Create(nameof(ImageView.ResourceUrl), typeof(string), typeof(ImageView), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
         {
-            swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
-        }
-
-        internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImageView obj)
+            var imageView = (ImageView)bindable;
+            if (newValue != null)
+            {
+                string url = (string)newValue;
+                if (imageView.IsCreateByXaml && url.Contains("*Resource*"))
+                {
+                    string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
+                    url = url.Replace("*Resource*", resource);
+                }
+                imageView._url = url;
+                imageView.UpdateImage();
+            }
+        },
+        defaultValueCreator: (bindable) =>
         {
-            return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
-        }
-
-
-        /// <summary>
-        /// Event arguments of resource ready.
-        /// </summary>
-        public class ResourceReadyEventArgs : EventArgs
+            var imageView = (ImageView)bindable;
+            Tizen.NUI.Object.GetProperty(imageView.swigCPtr, ImageView.Property.IMAGE).Get(out imageView._url);
+            return imageView._url;
+        });
+        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static readonly BindableProperty ImageProperty = BindableProperty.Create("Image", typeof(PropertyMap), typeof(ImageView), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
-            private View _view;
-
-            /// <summary>
-            /// The view whose resource is ready.
-            /// </summary>
-            /// <since_tizen> 3 </since_tizen>
-            public View View
+            var imageView = (ImageView)bindable;
+            if (newValue != null)
             {
-                get
+                PropertyMap map = (PropertyMap)newValue;
+                if (imageView.IsCreateByXaml)
                 {
-                    return _view;
+                    string url = "", alphaMaskURL = "", auxiliaryImageURL = "";
+                    string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
+                    PropertyValue urlValue = map.Find(NDalic.IMAGE_VISUAL_URL);
+                    bool ret = false;
+                    if (urlValue != null) ret = urlValue.Get(out url);
+                    PropertyMap mmap = new PropertyMap();
+                    if (ret && url.Contains("*Resource*"))
+                    {
+                        url = url.Replace("*Resource*", resource);
+                        mmap.Insert(NDalic.IMAGE_VISUAL_URL, new PropertyValue(url));
+                    }
+
+                    ret = false;
+                    PropertyValue alphaMaskUrlValue = map.Find(NDalic.IMAGE_VISUAL_ALPHA_MASK_URL);
+                    if (alphaMaskUrlValue != null) ret = alphaMaskUrlValue.Get(out alphaMaskURL);
+                    if (ret && alphaMaskURL.Contains("*Resource*"))
+                    {
+                        alphaMaskURL = alphaMaskURL.Replace("*Resource*", resource);
+                        mmap.Insert(NDalic.IMAGE_VISUAL_URL, new PropertyValue(alphaMaskURL));
+                    }
+
+                    ret = false;
+                    PropertyValue auxiliaryImageURLValue = map.Find(NDalic.IMAGE_VISUAL_AUXILIARY_IMAGE_URL);
+                    if (auxiliaryImageURLValue != null) ret = auxiliaryImageURLValue.Get(out auxiliaryImageURL);
+                    if (ret && auxiliaryImageURL.Contains("*Resource*"))
+                    {
+                        auxiliaryImageURL = auxiliaryImageURL.Replace("*Resource*", resource);
+                        mmap.Insert(NDalic.IMAGE_VISUAL_AUXILIARY_IMAGE_URL, new PropertyValue(auxiliaryImageURL));
+                    }
+
+                    map.Merge(mmap);
                 }
-                set
+                if (imageView._border == null)
                 {
-                    _view = value;
+                    Tizen.NUI.Object.SetProperty(imageView.swigCPtr, ImageView.Property.IMAGE, new Tizen.NUI.PropertyValue(map));
                 }
             }
-        }
-
-        private EventHandler<ResourceReadyEventArgs> _resourceReadyEventHandler;
-        [UnmanagedFunctionPointer(CallingConvention.StdCall)]
-        private delegate void ResourceReadyEventCallbackType(IntPtr data);
-        private ResourceReadyEventCallbackType _resourceReadyEventCallback;
-
-        /// <summary>
-        /// An event for ResourceReady signal which can be used to subscribe or unsubscribe the event handler.<br />
-        /// This signal is emitted after all resources required by a control are loaded and ready.<br />
-        /// Most resources are only loaded when the control is placed on the stage.<br />
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public event EventHandler<ResourceReadyEventArgs> ResourceReady
+        },
+        defaultValueCreator: (bindable) =>
         {
-            add
+            var imageView = (ImageView)bindable;
+            if (imageView._border == null)
             {
-                if (_resourceReadyEventHandler == null)
-                {
-                    _resourceReadyEventCallback = OnResourceReady;
-                    ResourceReadySignal(this).Connect(_resourceReadyEventCallback);
-                }
-
-                _resourceReadyEventHandler += value;
+                PropertyMap temp = new PropertyMap();
+                Tizen.NUI.Object.GetProperty(imageView.swigCPtr, ImageView.Property.IMAGE).Get(temp);
+                return temp;
             }
-
-            remove
+            else
             {
-                _resourceReadyEventHandler -= value;
-
-                if (_resourceReadyEventHandler == null && ResourceReadySignal(this).Empty() == false)
-                {
-                    ResourceReadySignal(this).Disconnect(_resourceReadyEventCallback);
-                }
+                return null;
             }
-        }
-
-        // Callback for View ResourceReady signal
-        private void OnResourceReady(IntPtr data)
+        });
+        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static readonly BindableProperty PreMultipliedAlphaProperty = BindableProperty.Create("PreMultipliedAlpha", typeof(bool), typeof(ImageView), false, propertyChanged: (bindable, oldValue, newValue) =>
         {
-            ResourceReadyEventArgs e = new ResourceReadyEventArgs();
-            if(data != null)
+            var imageView = (ImageView)bindable;
+            if (newValue != null)
             {
-                e.View = Registry.GetManagedBaseHandleFromNativePtr(data) as View;
+                Tizen.NUI.Object.SetProperty(imageView.swigCPtr, ImageView.Property.PRE_MULTIPLIED_ALPHA, new Tizen.NUI.PropertyValue((bool)newValue));
             }
-
-            if (_resourceReadyEventHandler != null)
+        },
+        defaultValueCreator: (bindable) =>
+        {
+            var imageView = (ImageView)bindable;
+            bool temp = false;
+            Tizen.NUI.Object.GetProperty(imageView.swigCPtr, ImageView.Property.PRE_MULTIPLIED_ALPHA).Get(out temp);
+            return temp;
+        });
+        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static readonly BindableProperty PixelAreaProperty = BindableProperty.Create("PixelArea", typeof(RelativeVector4), typeof(ImageView), null, propertyChanged: (bindable, oldValue, newValue) =>
+        {
+            var imageView = (ImageView)bindable;
+            if (newValue != null)
             {
-                _resourceReadyEventHandler(this, e);
+                Tizen.NUI.Object.SetProperty(imageView.swigCPtr, ImageView.Property.PIXEL_AREA, new Tizen.NUI.PropertyValue((RelativeVector4)newValue));
             }
-        }
-
-        /// <summary>
-        /// you can override it to clean-up your own resources.
-        /// </summary>
-        /// <param name="type">DisposeTypes</param>
-        /// <since_tizen> 3 </since_tizen>
-        protected override void Dispose(DisposeTypes type)
+        },
+        defaultValueCreator: (bindable) =>
         {
-            if (disposed)
+            var imageView = (ImageView)bindable;
+            Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
+            Tizen.NUI.Object.GetProperty(imageView.swigCPtr, ImageView.Property.PIXEL_AREA).Get(temp);
+            RelativeVector4 relativeTemp = new RelativeVector4(temp.X, temp.Y, temp.Z, temp.W);
+            return relativeTemp;
+        });
+        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static readonly BindableProperty BorderProperty = BindableProperty.Create("Border", typeof(Rectangle), typeof(ImageView), null, propertyChanged: (bindable, oldValue, newValue) =>
+        {
+            var imageView = (ImageView)bindable;
+            if (newValue != null)
             {
-                return;
+                imageView._border = (Rectangle)newValue;
+                imageView.UpdateImage();
             }
-
-            if(type == DisposeTypes.Explicit)
+        },
+        defaultValueCreator: (bindable) =>
+        {
+            var imageView = (ImageView)bindable;
+            return imageView._border;
+        });
+        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static readonly BindableProperty BorderOnlyProperty = BindableProperty.Create("BorderOnly", typeof(bool), typeof(ImageView), false, propertyChanged: (bindable, oldValue, newValue) =>
+        {
+            var imageView = (ImageView)bindable;
+            if (newValue != null)
             {
-                //Called by User
-                //Release your own managed resources here.
-                //You should release all of your own disposable objects here.
-                _border?.Dispose();
-                _border = null;
-                _nPatchMap?.Dispose();
-                _nPatchMap = null;
+                imageView._borderOnly = (bool)newValue;
+                imageView.UpdateImage();
             }
-
-            //Release your own unmanaged resources here.
-            //You should not access any managed member here except static instance.
-            //because the execution order of Finalizes is non-deterministic.
-
-            if (swigCPtr.Handle != global::System.IntPtr.Zero)
+        },
+        defaultValueCreator: (bindable) =>
+        {
+            var imageView = (ImageView)bindable;
+            return imageView._borderOnly ?? false;
+        });
+        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static readonly BindableProperty SynchronosLoadingProperty = BindableProperty.Create("SynchronosLoading", typeof(bool), typeof(ImageView), false, propertyChanged: (bindable, oldValue, newValue) =>
+        {
+            var imageView = (ImageView)bindable;
+            if (newValue != null)
             {
-                if (swigCMemOwn)
-                {
-                    swigCMemOwn = false;
-                    NDalicPINVOKE.delete_ImageView(swigCPtr);
-                }
-                swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+                imageView._synchronousLoading = (bool)newValue;
+                imageView.UpdateImage();
             }
+        },
+        defaultValueCreator: (bindable) =>
+        {
+            var imageView = (ImageView)bindable;
+            return imageView._synchronousLoading ?? false;
+        });
+        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static readonly BindableProperty OrientationCorrectionProperty = BindableProperty.Create("OrientationCorrection", typeof(bool), typeof(ImageView), false, propertyChanged: (bindable, oldValue, newValue) =>
+        {
+            var imageView = (ImageView)bindable;
+            if (newValue != null)
+            {
+                imageView._orientationCorrection = (bool)newValue;
+                imageView.UpdateImage();
+            }
+        },
+        defaultValueCreator: (bindable) =>
+        {
+            var imageView = (ImageView)bindable;
+            return imageView._orientationCorrection ?? false;
+        });
 
-            base.Dispose(type);
-        }
+        private global::System.Runtime.InteropServices.HandleRef swigCPtr;
+        private EventHandler<ResourceReadyEventArgs> _resourceReadyEventHandler;
+        private ResourceReadyEventCallbackType _resourceReadyEventCallback;
+        private EventHandler<ResourceLoadedEventArgs> _resourceLoadedEventHandler;
+        private _resourceLoadedCallbackType _resourceLoadedCallback;
+
+        private Rectangle _border = null;
+        private PropertyMap _nPatchMap = null;
+        private bool? _synchronousLoading = null;
+        private bool? _borderOnly = null;
+        private string _url = null;
+        private bool? _orientationCorrection = null;
 
-        internal new class Property
-        {
-            internal static readonly int RESOURCE_URL = NDalicPINVOKE.ImageView_Property_RESOURCE_URL_get();
-            internal static readonly int IMAGE = NDalicPINVOKE.ImageView_Property_IMAGE_get();
-            internal static readonly int PRE_MULTIPLIED_ALPHA = NDalicPINVOKE.ImageView_Property_PRE_MULTIPLIED_ALPHA_get();
-            internal static readonly int PIXEL_AREA = NDalicPINVOKE.ImageView_Property_PIXEL_AREA_get();
-        }
 
         /// <summary>
         /// Creates an initialized ImageView.
@@ -168,8 +235,8 @@ namespace Tizen.NUI.BaseComponents
         public ImageView() : this(NDalicPINVOKE.ImageView_New__SWIG_0(), true)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-
         }
+
         /// <summary>
         /// Creates an initialized ImageView from a URL to an image resource.<br />
         /// If the string is empty, ImageView will not display anything.<br />
@@ -188,78 +255,119 @@ namespace Tizen.NUI.BaseComponents
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
 
         }
-
-        /// <summary>
-        /// [Obsolete("Please do not use! this will be deprecated")]
-        /// </summary>
-        [Obsolete("Please do not use! this will be deprecated")]
-        public new static ImageView DownCast(BaseHandle handle)
+        internal ImageView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.ImageView_SWIGUpcast(cPtr), cMemoryOwn)
         {
-            ImageView ret =  Registry.GetManagedBaseHandleFromNativePtr(handle) as ImageView;
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
+            swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
         }
+
+        [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+        private delegate void ResourceReadyEventCallbackType(IntPtr data);
+        [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+        private delegate void _resourceLoadedCallbackType(IntPtr view);
+
         /// <summary>
-        /// Sets this ImageView from the given URL.<br />
-        /// If the URL is empty, ImageView will not display anything.<br />
+        /// An event for ResourceReady signal which can be used to subscribe or unsubscribe the event handler.<br />
+        /// This signal is emitted after all resources required by a control are loaded and ready.<br />
+        /// Most resources are only loaded when the control is placed on the stage.<br />
         /// </summary>
-        /// <param name="url">The URL to the image resource to display.</param>
         /// <since_tizen> 3 </since_tizen>
-        public void SetImage(string url)
+        public event EventHandler<ResourceReadyEventArgs> ResourceReady
         {
-            _url = url;
-            NDalicPINVOKE.ImageView_SetImage__SWIG_1(swigCPtr, url);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            add
+            {
+                if (_resourceReadyEventHandler == null)
+                {
+                    _resourceReadyEventCallback = OnResourceReady;
+                    ResourceReadySignal(this).Connect(_resourceReadyEventCallback);
+                }
+
+                _resourceReadyEventHandler += value;
+            }
+
+            remove
+            {
+                _resourceReadyEventHandler -= value;
+
+                if (_resourceReadyEventHandler == null && ResourceReadySignal(this).Empty() == false)
+                {
+                    ResourceReadySignal(this).Disconnect(_resourceReadyEventCallback);
+                }
+            }
         }
-        internal void SetImage(string url, Uint16Pair size)
+
+        internal event EventHandler<ResourceLoadedEventArgs> ResourceLoaded
         {
-            _url = url;
-            NDalicPINVOKE.ImageView_SetImage__SWIG_2(swigCPtr, url, Uint16Pair.getCPtr(size));
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-        }
+            add
+            {
+                if (_resourceLoadedEventHandler == null)
+                {
+                    _resourceLoadedCallback = OnResourceLoaded;
+                    this.ResourceReadySignal(this).Connect(_resourceLoadedCallback);
+                }
 
-        internal ViewResourceReadySignal ResourceReadySignal(View view) {
-            ViewResourceReadySignal ret = new ViewResourceReadySignal(NDalicPINVOKE.ResourceReadySignal(View.getCPtr(view)), false);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
+                _resourceLoadedEventHandler += value;
+            }
+            remove
+            {
+                _resourceLoadedEventHandler -= value;
+
+                if (_resourceLoadedEventHandler == null && this.ResourceReadySignal(this).Empty() == false)
+                {
+                    this.ResourceReadySignal(this).Disconnect(_resourceLoadedCallback);
+                }
+            }
         }
 
         /// <summary>
-        /// Queries if all resources required by a control are loaded and ready.<br />
-        /// Most resources are only loaded when the control is placed on the stage.<br />
-        /// True if the resources are loaded and ready, false otherwise.<br />
+        /// Enumeration for LoadingStatus of image.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public new  bool IsResourceReady()
+        /// <since_tizen> 5 </since_tizen>
+        public enum LoadingStatusType
         {
-            bool ret = NDalicPINVOKE.IsResourceReady(swigCPtr);
-            if (NDalicPINVOKE.SWIGPendingException.Pending)
-                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
+            /// <summary>
+            /// Loading preparing status.
+            /// </summary>
+            /// <since_tizen> 5 </since_tizen>
+            Preparing,
+            /// <summary>
+            /// Loading ready status.
+            /// </summary>
+            /// <since_tizen> 5 </since_tizen>
+            Ready,
+            /// <summary>
+            /// Loading failed status.
+            /// </summary>
+            /// <since_tizen> 5 </since_tizen>
+            Failed
         }
 
         /// <summary>
         /// ImageView ResourceUrl, type string.
+        /// This is one of mandatory property. Even if not set or null set, it sets empty string ("") internally.
+        /// When it is set as null, it gives empty string ("") to be read.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         public string ResourceUrl
         {
             get
             {
-                GetProperty(ImageView.Property.RESOURCE_URL).Get(out _url);
-                return _url;
+                return (string)GetValue(ResourceUrlProperty);
             }
             set
             {
-                _url = value;
-                UpdateImage();
+                _url = (value == null? "" : value);
+                SetValue(ResourceUrlProperty, _url);
+                NotifyPropertyChanged();
             }
         }
 
         /// <summary>
-        /// ImageView ImageMap, type PropertyMap: string if it is a URL, map otherwise
+        /// This will be deprecated, please use Image instead. <br />
+        /// ImageView ImageMap, type PropertyMap: string if it is a URL, map otherwise.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
+        [Obsolete("Please do not use! This will be deprecated! Please use Image property instead!")]
+        [EditorBrowsable(EditorBrowsableState.Never)]
         public PropertyMap ImageMap
         {
             get
@@ -279,7 +387,36 @@ namespace Tizen.NUI.BaseComponents
             {
                 if (_border == null)
                 {
+                    if (_url != null) { value.Add("url", new PropertyValue(_url)); }
                     SetProperty(ImageView.Property.IMAGE, new Tizen.NUI.PropertyValue(value));
+                    NotifyPropertyChanged();
+                }
+            }
+        }
+
+        /// <summary>
+        /// ImageView Image, type PropertyMap
+        /// </summary>
+        /// <since_tizen> 4 </since_tizen>
+        public PropertyMap Image
+        {
+            get
+            {
+                if (_border == null)
+                {
+                    return (PropertyMap)GetValue(ImageProperty);
+                }
+                else
+                {
+                    return null;
+                }
+            }
+            set
+            {
+                if (_border == null)
+                {
+                    SetValue(ImageProperty, value);
+                    NotifyPropertyChanged();
                 }
             }
         }
@@ -293,13 +430,12 @@ namespace Tizen.NUI.BaseComponents
         {
             get
             {
-                bool temp = false;
-                GetProperty(ImageView.Property.PRE_MULTIPLIED_ALPHA).Get(out temp);
-                return temp;
+                return (bool)GetValue(PreMultipliedAlphaProperty);
             }
             set
             {
-                SetProperty(ImageView.Property.PRE_MULTIPLIED_ALPHA, new Tizen.NUI.PropertyValue(value));
+                SetValue(PreMultipliedAlphaProperty, value);
+                NotifyPropertyChanged();
             }
         }
 
@@ -312,13 +448,12 @@ namespace Tizen.NUI.BaseComponents
         {
             get
             {
-                Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
-                GetProperty(ImageView.Property.PIXEL_AREA).Get(temp);
-                return temp;
+                return (RelativeVector4)GetValue(PixelAreaProperty);
             }
             set
             {
-                SetProperty(ImageView.Property.PIXEL_AREA, new Tizen.NUI.PropertyValue(value));
+                SetValue(PixelAreaProperty, value);
+                NotifyPropertyChanged();
             }
         }
 
@@ -333,12 +468,12 @@ namespace Tizen.NUI.BaseComponents
         {
             get
             {
-                return _border;
+                return (Rectangle)GetValue(BorderProperty);
             }
             set
             {
-                _border = value;
-                UpdateImage();
+                SetValue(BorderProperty, value);
+                NotifyPropertyChanged();
             }
         }
 
@@ -353,12 +488,12 @@ namespace Tizen.NUI.BaseComponents
         {
             get
             {
-                return _borderOnly ?? false;
+                return (bool)GetValue(BorderOnlyProperty);
             }
             set
             {
-                _borderOnly = value;
-                UpdateImage();
+                SetValue(BorderOnlyProperty, value);
+                NotifyPropertyChanged();
             }
         }
 
@@ -370,12 +505,201 @@ namespace Tizen.NUI.BaseComponents
         {
             get
             {
-                return _synchronousLoading ?? false;
+                return (bool)GetValue(SynchronosLoadingProperty);
             }
             set
             {
-                _synchronousLoading = value;
-                UpdateImage();
+                SetValue(SynchronosLoadingProperty, value);
+                NotifyPropertyChanged();
+            }
+        }
+
+        /// <summary>
+        /// Gets or sets whether to automatically correct the orientation of an image.<br />
+        /// </summary>
+        /// <since_tizen> 5 </since_tizen>
+        public bool OrientationCorrection
+        {
+            get
+            {
+                return (bool)GetValue(OrientationCorrectionProperty);
+            }
+            set
+            {
+                SetValue(OrientationCorrectionProperty, value);
+                NotifyPropertyChanged();
+            }
+        }
+
+        /// <summary>
+        /// Gets the loading state of the visual resource.
+        /// </summary>
+        /// <since_tizen> 5 </since_tizen>
+        public ImageView.LoadingStatusType LoadingStatus
+        {
+            get
+            {
+                return (ImageView.LoadingStatusType)NDalicManualPINVOKE.View_GetVisualResourceStatus(swigCPtr, (int)Property.IMAGE);
+            }
+        }
+
+        /// <summary>
+        /// Downcasts a handle to imageView handle.
+        /// </summary>
+        /// Please do not use! this will be deprecated!
+        /// Instead please use as keyword.
+        /// <since_tizen> 3 </since_tizen>
+        [Obsolete("Please do not use! This will be deprecated! Please use as keyword instead! " +
+            "Like: " +
+            "BaseHandle handle = new ImageView(imagePath); " +
+            "ImageView image = handle as ImageView")]
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static ImageView DownCast(BaseHandle handle)
+        {
+            ImageView ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as ImageView;
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        /// <summary>
+        /// Sets this ImageView from the given URL.<br />
+        /// If the URL is empty, ImageView will not display anything.<br />
+        /// </summary>
+        /// <param name="url">The URL to the image resource to display.</param>
+        /// <since_tizen> 3 </since_tizen>
+        public void SetImage(string url)
+        {
+            _url = url;
+            NDalicPINVOKE.ImageView_SetImage__SWIG_1(swigCPtr, url);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
+        /// Queries if all resources required by a control are loaded and ready.<br />
+        /// Most resources are only loaded when the control is placed on the stage.<br />
+        /// True if the resources are loaded and ready, false otherwise.<br />
+        /// </summary>
+        /// <since_tizen> 3 </since_tizen>
+        public new bool IsResourceReady()
+        {
+            bool ret = NDalicPINVOKE.IsResourceReady(swigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending)
+                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        /// <summary>
+        /// Forcefully reloads the image. All the visuals using this image will reload to the latest image.
+        /// </summary>
+        /// <since_tizen> 5 </since_tizen>
+        public void Reload()
+        {
+            this.DoAction(ImageView.Property.IMAGE, Property.ACTION_RELOAD, new PropertyValue(0));
+        }
+
+        /// <summary>
+        /// Plays the animated GIF. This is also the default playback mode.
+        /// </summary>
+        /// <since_tizen> 5 </since_tizen>
+        public void Play()
+        {
+            this.DoAction(ImageView.Property.IMAGE, Property.ACTION_PLAY, new PropertyValue(0));
+        }
+
+        /// <summary>
+        /// Pauses the animated GIF.
+        /// </summary>
+        /// <since_tizen> 5 </since_tizen>
+        public void Pause()
+        {
+            this.DoAction(ImageView.Property.IMAGE, Property.ACTION_PAUSE, new PropertyValue(0));
+        }
+
+        /// <summary>
+        /// Stops the animated GIF.
+        /// </summary>
+        /// <since_tizen> 5 </since_tizen>
+        public void Stop()
+        {
+            this.DoAction(ImageView.Property.IMAGE, Property.ACTION_STOP, new PropertyValue(0));
+        }
+
+        internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImageView obj)
+        {
+            return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
+        }
+
+        internal void SetImage(string url, Uint16Pair size)
+        {
+            _url = url;
+            NDalicPINVOKE.ImageView_SetImage__SWIG_2(swigCPtr, url, Uint16Pair.getCPtr(size));
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        internal ViewResourceReadySignal ResourceReadySignal(View view)
+        {
+            ViewResourceReadySignal ret = new ViewResourceReadySignal(NDalicPINVOKE.ResourceReadySignal(View.getCPtr(view)), false);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        internal ResourceLoadingStatusType GetResourceStatus()
+        {
+            return (ResourceLoadingStatusType)NDalicManualPINVOKE.View_GetVisualResourceStatus(this.swigCPtr, Property.IMAGE);
+        }
+
+        /// <summary>
+        /// you can override it to clean-up your own resources.
+        /// </summary>
+        /// <param name="type">DisposeTypes</param>
+        /// <since_tizen> 3 </since_tizen>
+        protected override void Dispose(DisposeTypes type)
+        {
+            if (disposed)
+            {
+                return;
+            }
+
+            if (type == DisposeTypes.Explicit)
+            {
+                //Called by User
+                //Release your own managed resources here.
+                //You should release all of your own disposable objects here.
+                _border?.Dispose();
+                _border = null;
+                _nPatchMap?.Dispose();
+                _nPatchMap = null;
+            }
+
+            //Release your own unmanaged resources here.
+            //You should not access any managed member here except static instance.
+            //because the execution order of Finalizes is non-deterministic.
+
+            if (swigCPtr.Handle != global::System.IntPtr.Zero)
+            {
+                if (swigCMemOwn)
+                {
+                    swigCMemOwn = false;
+                    NDalicPINVOKE.delete_ImageView(swigCPtr);
+                }
+                swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+            }
+
+            base.Dispose(type);
+        }
+
+        // Callback for View ResourceReady signal
+        private void OnResourceReady(IntPtr data)
+        {
+            ResourceReadyEventArgs e = new ResourceReadyEventArgs();
+            if (data != null)
+            {
+                e.View = Registry.GetManagedBaseHandleFromNativePtr(data) as View;
+            }
+
+            if (_resourceReadyEventHandler != null)
+            {
+                _resourceReadyEventHandler(this, e);
             }
         }
 
@@ -390,30 +714,88 @@ namespace Tizen.NUI.BaseComponents
                     _nPatchMap.Add(NpatchImageVisualProperty.URL, new PropertyValue(_url));
                     _nPatchMap.Add(NpatchImageVisualProperty.Border, new PropertyValue(_border));
                     if (_borderOnly != null) { _nPatchMap.Add(NpatchImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); }
-                    if (_synchronousLoading != null) _nPatchMap.Add(NpatchImageVisualProperty.SynchronousLoading, new PropertyValue((bool)_synchronousLoading));
+                    if (_synchronousLoading != null) { _nPatchMap.Add(NpatchImageVisualProperty.SynchronousLoading, new PropertyValue((bool)_synchronousLoading)); }
+                    if (_orientationCorrection != null) { _nPatchMap.Add(ImageVisualProperty.OrientationCorrection, new PropertyValue((bool)_orientationCorrection)); }
                     SetProperty(ImageView.Property.IMAGE, new PropertyValue(_nPatchMap));
                 }
-                else if(_synchronousLoading != null)
+                else if (_synchronousLoading != null || _orientationCorrection != null)
                 { // for normal image, with synchronous loading property
                     PropertyMap imageMap = new PropertyMap();
                     imageMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
                     imageMap.Add(ImageVisualProperty.URL, new PropertyValue(_url));
-                    imageMap.Add(ImageVisualProperty.SynchronousLoading, new PropertyValue((bool)_synchronousLoading));
+                    if (_synchronousLoading != null) { imageMap.Add(ImageVisualProperty.SynchronousLoading, new PropertyValue((bool)_synchronousLoading)); }
+                    if (_orientationCorrection != null) { imageMap.Add(ImageVisualProperty.OrientationCorrection, new PropertyValue((bool)_orientationCorrection)); }
                     SetProperty(ImageView.Property.IMAGE, new PropertyValue(imageMap));
                 }
                 else
                 { // just for normal image
-                    SetProperty(ImageView.Property.RESOURCE_URL, new PropertyValue(_url));
+                    SetProperty(ImageView.Property.IMAGE, new PropertyValue(_url));
                 }
             }
         }
 
-        private Rectangle _border = null;
-        private PropertyMap _nPatchMap = null;
-        private bool? _synchronousLoading = null;
-        private bool? _borderOnly = null;
-        private string _url = null;
+        private void OnResourceLoaded(IntPtr view)
+        {
+            ResourceLoadedEventArgs e = new ResourceLoadedEventArgs();
+            e.Status = (ResourceLoadingStatusType)NDalicManualPINVOKE.View_GetVisualResourceStatus(this.swigCPtr, Property.IMAGE);
 
-    }
+            if (_resourceLoadedEventHandler != null)
+            {
+                _resourceLoadedEventHandler(this, e);
+            }
+        }
+
+        /// <summary>
+        /// Event arguments of resource ready.
+        /// </summary>
+        /// <since_tizen> 3 </since_tizen>
+        public class ResourceReadyEventArgs : EventArgs
+        {
+            private View _view;
+
+            /// <summary>
+            /// The view whose resource is ready.
+            /// </summary>
+            /// <since_tizen> 3 </since_tizen>
+            public View View
+            {
+                get
+                {
+                    return _view;
+                }
+                set
+                {
+                    _view = value;
+                }
+            }
+        }
 
-}
\ No newline at end of file
+        internal class ResourceLoadedEventArgs : EventArgs
+        {
+            private ResourceLoadingStatusType status = ResourceLoadingStatusType.Invalid;
+            public ResourceLoadingStatusType Status
+            {
+                get
+                {
+                    return status;
+                }
+                set
+                {
+                    status = value;
+                }
+            }
+        }
+
+        internal new class Property
+        {
+            internal static readonly int RESOURCE_URL = NDalicPINVOKE.ImageView_Property_RESOURCE_URL_get();
+            internal static readonly int IMAGE = NDalicPINVOKE.ImageView_Property_IMAGE_get();
+            internal static readonly int PRE_MULTIPLIED_ALPHA = NDalicPINVOKE.ImageView_Property_PRE_MULTIPLIED_ALPHA_get();
+            internal static readonly int PIXEL_AREA = NDalicPINVOKE.ImageView_Property_PIXEL_AREA_get();
+            internal static readonly int ACTION_RELOAD = NDalicManualPINVOKE.ImageView_IMAGE_VISUAL_ACTION_RELOAD_get();
+            internal static readonly int ACTION_PLAY = NDalicManualPINVOKE.ImageView_IMAGE_VISUAL_ACTION_PLAY_get();
+            internal static readonly int ACTION_PAUSE = NDalicManualPINVOKE.ImageView_IMAGE_VISUAL_ACTION_PAUSE_get();
+            internal static readonly int ACTION_STOP = NDalicManualPINVOKE.ImageView_IMAGE_VISUAL_ACTION_STOP_get();
+        }
+    }
+}