[NUI] Sync Xaml code to newest (#795)
authorAdunFang <30402408+AdunFang@users.noreply.github.com>
Thu, 18 Apr 2019 10:22:13 +0000 (18:22 +0800)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Thu, 18 Apr 2019 10:22:13 +0000 (19:22 +0900)
70 files changed:
src/Tizen.NUI/src/internal/Xaml/ApplyPropertiesVisitor.cs
src/Tizen.NUI/src/internal/Xaml/CreateValuesVisitor.cs
src/Tizen.NUI/src/internal/Xaml/ExpandMarkupsVisitor.cs
src/Tizen.NUI/src/internal/Xaml/FillResourceDictionariesVisitor.cs
src/Tizen.NUI/src/internal/Xaml/IReferenceProvider.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/Xaml/MarkupExtensions/BindingExtension.cs
src/Tizen.NUI/src/internal/Xaml/MarkupExtensions/NullExtension.cs
src/Tizen.NUI/src/internal/Xaml/MarkupExtensions/StaticExtension.cs
src/Tizen.NUI/src/internal/Xaml/MarkupExtensions/StyleSheetExtension.cs
src/Tizen.NUI/src/internal/Xaml/MarkupExtensions/TypeExtension.cs
src/Tizen.NUI/src/internal/Xaml/NamescopingVisitor.cs
src/Tizen.NUI/src/internal/Xaml/PruneIgnoredNodesVisitor.cs
src/Tizen.NUI/src/internal/Xaml/ReflectionExtensions.cs
src/Tizen.NUI/src/internal/Xaml/RegisterXNamesVisitor.cs
src/Tizen.NUI/src/internal/Xaml/TypeConversionExtensions.cs
src/Tizen.NUI/src/internal/Xaml/ValueConverterProvider.cs
src/Tizen.NUI/src/internal/Xaml/XamlLoader.cs
src/Tizen.NUI/src/internal/Xaml/XamlNode.cs
src/Tizen.NUI/src/internal/Xaml/XamlNodeVisitor.cs
src/Tizen.NUI/src/internal/Xaml/XamlParseException.cs
src/Tizen.NUI/src/internal/Xaml/XamlParser.cs
src/Tizen.NUI/src/internal/XamlBinding/Application.cs
src/Tizen.NUI/src/internal/XamlBinding/BindableProperty.cs
src/Tizen.NUI/src/internal/XamlBinding/BindablePropertyConverter.cs
src/Tizen.NUI/src/internal/XamlBinding/Binding.cs
src/Tizen.NUI/src/internal/XamlBinding/BindingBase.cs
src/Tizen.NUI/src/internal/XamlBinding/BindingTypeConverter.cs
src/Tizen.NUI/src/internal/XamlBinding/ColorTypeConverter.cs
src/Tizen.NUI/src/internal/XamlBinding/Device.cs
src/Tizen.NUI/src/internal/XamlBinding/ExtentsTypeConverter.cs
src/Tizen.NUI/src/internal/XamlBinding/Interactivity/BindingCondition.cs
src/Tizen.NUI/src/internal/XamlBinding/Interactivity/DataTrigger.cs
src/Tizen.NUI/src/internal/XamlBinding/Interactivity/PropertyCondition.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/XamlBinding/Interactivity/Trigger.cs
src/Tizen.NUI/src/internal/XamlBinding/Interactivity/XamlPropertyCondition.cs
src/Tizen.NUI/src/internal/XamlBinding/Internals/DynamicResource.cs
src/Tizen.NUI/src/internal/XamlBinding/Internals/IDataTemplate.cs
src/Tizen.NUI/src/internal/XamlBinding/Internals/IDeserializer.cs
src/Tizen.NUI/src/internal/XamlBinding/Internals/IDynamicResourceHandler.cs
src/Tizen.NUI/src/internal/XamlBinding/Internals/INameScope.cs
src/Tizen.NUI/src/internal/XamlBinding/Internals/InvalidationTrigger.cs
src/Tizen.NUI/src/internal/XamlBinding/Internals/NameScope.cs
src/Tizen.NUI/src/internal/XamlBinding/Internals/NumericExtensions.cs
src/Tizen.NUI/src/internal/XamlBinding/Internals/PreserveAttribute.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/XamlBinding/Internals/Ticker.cs
src/Tizen.NUI/src/internal/XamlBinding/Internals/TypedBinding.cs
src/Tizen.NUI/src/internal/XamlBinding/Layout.cs
src/Tizen.NUI/src/internal/XamlBinding/LayoutOptionsConverter.cs
src/Tizen.NUI/src/internal/XamlBinding/ListStringTypeConverter.cs
src/Tizen.NUI/src/internal/XamlBinding/NavigationPage.cs
src/Tizen.NUI/src/internal/XamlBinding/RectangleTypeConverter.cs
src/Tizen.NUI/src/internal/XamlBinding/RotationTypeConverter.cs
src/Tizen.NUI/src/internal/XamlBinding/Setter.cs
src/Tizen.NUI/src/internal/XamlBinding/SizeTypeConverter.cs
src/Tizen.NUI/src/internal/XamlBinding/Style.cs
src/Tizen.NUI/src/internal/XamlBinding/SynchronizedList.cs
src/Tizen.NUI/src/internal/XamlBinding/ThicknessTypeConverter.cs
src/Tizen.NUI/src/internal/XamlBinding/TizenPlatformServices.cs
src/Tizen.NUI/src/internal/XamlBinding/TypeTypeConverter.cs
src/Tizen.NUI/src/internal/XamlBinding/UriTypeConverter.cs
src/Tizen.NUI/src/public/Xaml/ProvideCompiledAttribute.cs [new file with mode: 0755]
src/Tizen.NUI/src/public/Xaml/ViewExtensions.cs
src/Tizen.NUI/src/public/XamlBinding/BindableObject.cs
src/Tizen.NUI/src/public/XamlBinding/ContentPage.cs
src/Tizen.NUI/src/public/XamlBinding/Element.cs
src/Tizen.NUI/src/public/XamlBinding/IResourcesProvider.cs
src/Tizen.NUI/src/public/XamlBinding/IValueConverter.cs
src/Tizen.NUI/src/public/XamlBinding/NameScopeExtensions.cs
src/Tizen.NUI/src/public/XamlBinding/ResourceDictionary.cs
src/Tizen.NUI/src/public/XamlBinding/Transition.cs

index 588f5c7051b600b75cb17645b33d674d923371a2..76451c7d9acc63d85d9df9486c5c2645f8cb4085 100755 (executable)
@@ -37,6 +37,7 @@ namespace Tizen.NUI.Xaml
         public bool StopOnResourceDictionary { get; }
         public bool VisitNodeOnDataTemplate => true;
         public bool SkipChildren(INode node, INode parentNode) => false;
+        public bool IsResourceDictionary(ElementNode node) => typeof(ResourceDictionary).IsAssignableFrom(Context.Types[node]);
 
         public void Visit(ValueNode node, INode parentNode)
         {
@@ -281,7 +282,12 @@ namespace Tizen.NUI.Xaml
 #if NETSTANDARD1_0
             var bindableFieldInfo = elementType.GetFields().FirstOrDefault(fi => fi.Name == localName + "Property");
 #else
-            var bindableFieldInfo = elementType.GetFields(BindingFlags.Static | BindingFlags.Public|BindingFlags.FlattenHierarchy).FirstOrDefault(fi => fi.Name == localName + "Property");
+            var bindableFieldInfo = elementType.GetFields(BindingFlags.Static | BindingFlags.NonPublic|BindingFlags.FlattenHierarchy).FirstOrDefault(fi => fi.Name == localName + "Property");
+
+            if (null == bindableFieldInfo)
+            {
+                bindableFieldInfo = elementType.GetFields(BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy).FirstOrDefault(fi => fi.Name == localName + "Property");
+            }
 #endif
             Exception exception = null;
             if (exception == null && bindableFieldInfo == null) {
@@ -323,6 +329,7 @@ namespace Tizen.NUI.Xaml
             //If it's an attached BP, update elementType and propertyName
             var bpOwnerType = xamlelement.GetType();
             var attached = GetRealNameAndType(ref bpOwnerType, propertyName.NamespaceURI, ref localName, context, lineInfo);
+
             var property = GetBindableProperty(bpOwnerType, localName, lineInfo, false);
 
             //If the target is an event, connect
index bd4c9b3d8fde33175e49326bb361b26b22be49c2..c4e4c50ebd5a83974afb8bce5c06ead7e7c7a89b 100755 (executable)
@@ -29,6 +29,7 @@ namespace Tizen.NUI.Xaml
         public bool StopOnResourceDictionary => false;
         public bool VisitNodeOnDataTemplate => false;
         public bool SkipChildren(INode node, INode parentNode) => false;
+        public bool IsResourceDictionary(ElementNode node) => typeof(ResourceDictionary).IsAssignableFrom(Context.Types[node]);
 
         public void Visit(ValueNode node, INode parentNode)
         {
index 43324721560715a905e3c5ce1fad8c1db4022949..308e9e287a614734f7368da50846745c9833ef6c 100755 (executable)
@@ -33,6 +33,7 @@ namespace Tizen.NUI.Xaml
         public bool StopOnResourceDictionary => false;
         public bool VisitNodeOnDataTemplate => true;
         public bool SkipChildren(INode node, INode parentNode) => false;
+        public bool IsResourceDictionary(ElementNode node) => false;
 
         public void Visit(ValueNode node, INode parentNode)
         {
index 07197a2054734788207e812739a151ff4a5ec54d..2be8e7bf84a79e3be62c003a20e79e250cd4e026 100755 (executable)
@@ -21,6 +21,8 @@ namespace Tizen.NUI.Xaml
         public bool StopOnResourceDictionary => false;
         public bool VisitNodeOnDataTemplate => false;
 
+        public bool IsResourceDictionary(ElementNode node) => typeof(ResourceDictionary).IsAssignableFrom(Context.Types[node]);
+
         public void Visit(ValueNode node, INode parentNode)
         {
             if (!typeof(ResourceDictionary).IsAssignableFrom(Context.Types[((IElementNode)parentNode)]))
@@ -81,6 +83,5 @@ namespace Tizen.NUI.Xaml
                 return true;
             return false;
         }
-
     }
 }
\ No newline at end of file
diff --git a/src/Tizen.NUI/src/internal/Xaml/IReferenceProvider.cs b/src/Tizen.NUI/src/internal/Xaml/IReferenceProvider.cs
new file mode 100755 (executable)
index 0000000..89cb53f
--- /dev/null
@@ -0,0 +1,7 @@
+namespace Tizen.NUI.Xaml
+{
+    internal interface IReferenceProvider
+       {
+               object FindByName(string name);
+       }
+}
\ No newline at end of file
index e362dd1f276406669da0a87f16a1b5ad42aaf25c..9276783045c70efc56f4ecbdeab2ce4b9284bf39 100755 (executable)
@@ -8,15 +8,8 @@ namespace Tizen.NUI.Xaml
     [AcceptEmptyServiceProvider]
     internal sealed class BindingExtension : IMarkupExtension<BindingBase>
     {
-        public BindingExtension()
-        {
-            Mode = BindingMode.Default;
-            Path = Tizen.NUI.Binding.Binding.SelfPath;
-        }
-
-        public string Path { get; set; }
-
-        public BindingMode Mode { get; set; }
+               public string Path { get; set; } = Binding.Binding.SelfPath;
+               public BindingMode Mode { get; set; } = BindingMode.Default;
 
         public IValueConverter Converter { get; set; }
 
@@ -28,12 +21,21 @@ namespace Tizen.NUI.Xaml
 
         public string UpdateSourceEventName { get; set; }
 
+        public object TargetNullValue { get; set; }
+        
+               public object FallbackValue { get; set; }
+
         public TypedBindingBase TypedBinding { get; set; }
 
         BindingBase IMarkupExtension<BindingBase>.ProvideValue(IServiceProvider serviceProvider)
         {
             if (TypedBinding == null)
-                return new Tizen.NUI.Binding.Binding(Path, Mode, Converter, ConverterParameter, StringFormat, Source) { UpdateSourceEventName = UpdateSourceEventName };
+                return new Tizen.NUI.Binding.Binding(Path, Mode, Converter, ConverterParameter, StringFormat, Source)
+                               {
+                                   UpdateSourceEventName = UpdateSourceEventName,
+                    FallbackValue = FallbackValue,
+                    TargetNullValue = TargetNullValue,
+                               };
 
             TypedBinding.Mode = Mode;
             TypedBinding.Converter = Converter;
@@ -41,6 +43,8 @@ namespace Tizen.NUI.Xaml
             TypedBinding.StringFormat = StringFormat;
             TypedBinding.Source = Source;
             TypedBinding.UpdateSourceEventName = UpdateSourceEventName;
+            TypedBinding.FallbackValue = FallbackValue;
+            TypedBinding.TargetNullValue = TargetNullValue;
             return TypedBinding;
         }
 
index 091e30ea79ee4f780a2859e4562e4a8d038f4d4a..b5a310c3eea77332ac7f7fe24ca551d92c078f11 100755 (executable)
@@ -2,7 +2,7 @@
 
 namespace Tizen.NUI.Xaml
 {
-    // [ProvideCompiled("Tizen.NUI.Build.Tasks.NullExtension")]
+    [ProvideCompiled("Tizen.NUI.Xaml.Build.Tasks.NullExtension")]
     [AcceptEmptyServiceProvider]
     internal class NullExtension : IMarkupExtension
     {
index d22e0ed8d25fc58d2666a4a337ae8cca14989f50..5a4151d35981b5fe8a09b04d5d09a1fd06e67a46 100755 (executable)
@@ -7,7 +7,7 @@ using Tizen.NUI.Binding;
 namespace Tizen.NUI.Xaml
 {
     [ContentProperty(nameof(Member))]
-    // [ProvideCompiled("Tizen.NUI.Build.Tasks.StaticExtension")]
+    [ProvideCompiled("Tizen.NUI.Xaml.Build.Tasks.StaticExtension")]
     internal class StaticExtension : IMarkupExtension
     {
         public string Member { get; set; }
index b97485e07980833385360e974c072a16c6a8bd67..2b4c48371ea784e2f5788cb9a7e7ddb0a7f6c55d 100755 (executable)
@@ -8,7 +8,7 @@ using Tizen.NUI.Binding;
 namespace Tizen.NUI.Xaml
 {
     [ContentProperty(nameof(Style))]
-    // [ProvideCompiled("Tizen.NUI.Core.XamlC.StyleSheetProvider")]
+    [ProvideCompiled("Tizen.NUI.Core.XamlC.StyleSheetProvider")]
     internal sealed class StyleSheetExtension : IValueProvider
     {
         public string Style { get; set; }
index bfd3bd56d607415637e0b168b3973af1fdb640e0..9bcd36b9c4082ae7a67ac22b3f853e2f87ce7b0a 100755 (executable)
@@ -4,7 +4,7 @@ using Tizen.NUI.Binding;
 namespace Tizen.NUI.Xaml
 {
     [ContentProperty(nameof(TypeName))]
-    // [ProvideCompiled("Tizen.NUI.Build.Tasks.TypeExtension")]
+    [ProvideCompiled("Tizen.NUI.Xaml.Build.Tasks.TypeExtension")]
     internal class TypeExtension : IMarkupExtension<Type>
     {
         public string TypeName { get; set; }
index 18d8d37ca415c1853058b3725ab859f31c371d8b..99e0f89c20dedefb7b237f62d9c0a172ed9e41b2 100755 (executable)
@@ -19,6 +19,7 @@ namespace Tizen.NUI.Xaml
         public bool StopOnResourceDictionary => false;
         public bool VisitNodeOnDataTemplate => true;
         public bool SkipChildren(INode node, INode parentNode) => false;
+        public bool IsResourceDictionary(ElementNode node) => false;
 
         public void Visit(ValueNode node, INode parentNode)
         {
index f881a2e77f939ed67eaadb3a707867285bf48c7a..8c025e582507240e397da677bf9455dd2a167dea 100755 (executable)
@@ -10,6 +10,7 @@ namespace Tizen.NUI.Xaml
         public bool StopOnResourceDictionary => false;
         public bool VisitNodeOnDataTemplate => true;
         public bool SkipChildren(INode node, INode parentNode) => false;
+        public bool IsResourceDictionary(ElementNode node) => false;
 
         public void Visit(ElementNode node, INode parentNode)
         {
@@ -21,7 +22,7 @@ namespace Tizen.NUI.Xaml
                     continue;
                 if (!propertyName.Equals(XamlParser.McUri, "Ignorable"))
                     continue;
-                (parentNode.IgnorablePrefixes ?? (parentNode.IgnorablePrefixes = new List<string>()))?.AddRange(propertyValue.Split(','));
+                (parentNode.IgnorablePrefixes ?? (parentNode.IgnorablePrefixes = new List<string>())).AddRange(propertyValue.Split(','));
             }
 
             foreach (var propertyKvp in node.Properties.ToList())
index c356b0500130491d4464ad87faf2190a44a2bccd..98e036db14cb17efe90ce5c5ddb79519471a6a50 100755 (executable)
@@ -6,7 +6,6 @@ using System.Reflection;
 
 namespace Tizen.NUI.Binding.Internals
 {
-    [EditorBrowsable(EditorBrowsableState.Never)]
     internal static class ReflectionExtensions
     {
         public static FieldInfo GetField(this Type type, Func<FieldInfo, bool> predicate)
index 481493c65eaa5d0b1bad4db37fbb4a5a8d62c970..8ca6ddeab62c996446d25aa1c1ab450abaf83a50 100755 (executable)
@@ -8,16 +8,18 @@ namespace Tizen.NUI.Xaml
     {
         public RegisterXNamesVisitor(HydrationContext context)
         {
+            Context = context;
             Values = context.Values;
         }
 
         Dictionary<INode, object> Values { get; }
-
+        HydrationContext Context { get; }
         public TreeVisitingMode VisitingMode => TreeVisitingMode.TopDown;
         public bool StopOnDataTemplate => true;
         public bool StopOnResourceDictionary => false;
         public bool VisitNodeOnDataTemplate => false;
         public bool SkipChildren(INode node, INode parentNode) => false;
+        public bool IsResourceDictionary(ElementNode node) => typeof(ResourceDictionary).IsAssignableFrom(Context.Types[node]);
 
         public void Visit(ValueNode node, INode parentNode)
         {
index 153897efbd512d337344f2097550f8b8689906cf..8f465936f6d95c61c2ae1362714a5082cdd90cf5 100755 (executable)
@@ -100,6 +100,19 @@ namespace Tizen.NUI.Xaml
             return value.ConvertTo(toType, getConverter, serviceProvider);
         }
 
+        private delegate void ParseValueFunc(string s, IFormatProvider provider);
+
+        static private Dictionary<Type, ParseValueFunc> typeToParseValueFunc = null;
+
+        static private void BuildParseValueFunc()
+        {
+            if (null == typeToParseValueFunc)
+            {
+                typeToParseValueFunc = new Dictionary<Type, ParseValueFunc>();
+
+            }
+        }
+
         internal static object ConvertTo(this object value, Type toType, Func<object> getConverter,
             IServiceProvider serviceProvider)
         {
@@ -111,20 +124,24 @@ namespace Tizen.NUI.Xaml
             {
                 //If there's a [TypeConverter], use it
                 object converter = getConverter?.Invoke();
-                var xfTypeConverter = converter as TypeConverter;
-                var xfExtendedTypeConverter = xfTypeConverter as IExtendedTypeConverter;
-                if (xfExtendedTypeConverter != null)
-                    return value = xfExtendedTypeConverter.ConvertFromInvariantString(str, serviceProvider);
-                if (xfTypeConverter != null)
-                    return value = xfTypeConverter.ConvertFromInvariantString(str);
-                var converterType = converter?.GetType();
-                if (converterType != null)
+                if (null != converter)
                 {
-                    var convertFromStringInvariant = converterType.GetRuntimeMethod("ConvertFromInvariantString",
-                        new[] { typeof (string) });
-                    if (convertFromStringInvariant != null)
-                        return value = convertFromStringInvariant.Invoke(converter, new object[] { str });
+                    var xfTypeConverter = converter as TypeConverter;
+                    var xfExtendedTypeConverter = xfTypeConverter as IExtendedTypeConverter;
+                    if (xfExtendedTypeConverter != null)
+                        return value = xfExtendedTypeConverter.ConvertFromInvariantString(str, serviceProvider);
+                    if (xfTypeConverter != null)
+                        return value = xfTypeConverter.ConvertFromInvariantString(str);
+                    var converterType = converter?.GetType();
+                    if (converterType != null)
+                    {
+                        var convertFromStringInvariant = converterType.GetRuntimeMethod("ConvertFromInvariantString",
+                            new[] { typeof(string) });
+                        if (convertFromStringInvariant != null)
+                            return value = convertFromStringInvariant.Invoke(converter, new object[] { str });
+                    }
                 }
+
                 var ignoreCase = (serviceProvider?.GetService(typeof(IConverterOptions)) as IConverterOptions)?.IgnoreCase ?? false;
 
                 //If the type is nullable, as the value is not null, it's safe to assume we want the built-in conversion
@@ -134,6 +151,7 @@ namespace Tizen.NUI.Xaml
                 //Obvious Built-in conversions
                 if (toType.GetTypeInfo().IsEnum)
                     return Enum.Parse(toType, str, ignoreCase);
+
                 if (toType == typeof(SByte))
                     return SByte.Parse(str, CultureInfo.InvariantCulture);
                 if (toType == typeof(Int16))
index d4b5e61ff1fb4b2bc48165dbdc90254a8adabca5..1b8a56c6690e444cf85cccfca5f4790c084bf541 100755 (executable)
@@ -4,7 +4,6 @@ using System.Reflection;
 using Tizen.NUI;
 using Tizen.NUI.Xaml;
 
-// [assembly:Dependency(typeof(ValueConverterProvider))]
 namespace Tizen.NUI.Xaml
 {
     internal class ValueConverterProvider : IValueConverterProvider
index 502be8b22a3cd83f79758c7d5bfa2450f4c41c29..758a45fa7500ab3c9c6557c5f0bc9c22d38d4d6a 100755 (executable)
 
 using System;
 using System.Collections.Generic;
+using System.ComponentModel;
 using System.Diagnostics;
 using System.IO;
 using System.Reflection;
 using System.Text.RegularExpressions;
 using System.Xml;
+using Tizen.NUI.BaseComponents;
 using Tizen.NUI.Binding;
 using Tizen.NUI.Binding.Internals;
 
@@ -58,60 +60,34 @@ namespace Tizen.NUI.Xaml.Internals
 
 namespace Tizen.NUI.Xaml
 {
-    static class XamlLoader
+    static internal class XamlLoader
     {
         public static void Load(object view, Type callingType)
         {
-            var xaml = GetXamlForType(callingType);
-            if (string.IsNullOrEmpty(xaml))
-                throw new XamlParseException(string.Format("No embeddedresource found for {0}", callingType), new XmlLineInfo());
-            Console.WriteLine("============= Got xaml text is {0} ===========", xaml);
-            Load(view, xaml);
-        }
-
-        public static Transition LoadTransition(string animationXamlPath)
-        {
-            var xaml = GetAnimationXaml(animationXamlPath);
-            if (string.IsNullOrEmpty(xaml))
-                throw new XamlParseException(string.Format("No embeddedresource found for {0}", animationXamlPath), new XmlLineInfo());
-            Transition animation = new Transition();
-            using (var textReader = new StringReader(xaml))
-            using (var reader = XmlReader.Create(textReader))
+            try
             {
-                while (reader.Read())
-                {
-                    //Skip until element
-                    if (reader.NodeType == XmlNodeType.Whitespace)
-                        continue;
-                    if (reader.NodeType == XmlNodeType.XmlDeclaration)
-                        continue;
-                    if (reader.NodeType != XmlNodeType.Element)
-                    {
-                        Debug.WriteLine("Unhandled node {0} {1} {2}", reader.NodeType, reader.Name, reader.Value);
-                        continue;
-                    }
-
-                    var rootnode = new RuntimeRootNode(new XmlType(reader.NamespaceURI, reader.Name, null), animation, (IXmlNamespaceResolver)reader);
-                    XamlParser.ParseXaml(rootnode, reader);
-                    Visit(rootnode, new HydrationContext
-                    {
-                        RootElement = animation,
-#pragma warning disable 0618
-                        ExceptionHandler = ResourceLoader.ExceptionHandler ?? (Internals.XamlLoader.DoNotThrowOnExceptions ? e => { } : (Action<Exception>)null)
-#pragma warning restore 0618
-                    });
-                    break;
-                }
+                var xaml = GetXamlForType(callingType);
+                if (string.IsNullOrEmpty(xaml))
+                    throw new XamlParseException(string.Format("Can't get xaml from type {0}", callingType), new XmlLineInfo());
+                Load(view, xaml);
+            }
+            catch (XamlParseException e)
+            {
+                Tizen.Log.Fatal("NUI", "XamlParseException e.Message: " + e.Message);
+                Console.WriteLine("\n[FATAL] XamlParseException e.Message: {0}\n", e.Message);
             }
-            return animation;
         }
 
-        public static Animation LoadAnimation(string animationXamlPath)
+        public static T LoadObject<T>(string path)
         {
-            var xaml = GetAnimationXaml(animationXamlPath);
+            var xaml = GetAnimationXaml(path);
             if (string.IsNullOrEmpty(xaml))
-                throw new XamlParseException(string.Format("No embeddedresource found for {0}", animationXamlPath), new XmlLineInfo());
-            Animation animation = new Animation();
+                throw new XamlParseException(string.Format("No embeddedresource found for {0}", path), new XmlLineInfo());
+            Type type = typeof(T);
+            T ret = (T)type.Assembly.CreateInstance(type.FullName);
+
+            NameScopeExtensions.PushElement(ret);
+
             using (var textReader = new StringReader(xaml))
             using (var reader = XmlReader.Create(textReader))
             {
@@ -128,11 +104,11 @@ namespace Tizen.NUI.Xaml
                         continue;
                     }
 
-                    var rootnode = new RuntimeRootNode(new XmlType(reader.NamespaceURI, reader.Name, null), animation, (IXmlNamespaceResolver)reader);
+                    var rootnode = new RuntimeRootNode(new XmlType(reader.NamespaceURI, reader.Name, null), ret, (IXmlNamespaceResolver)reader);
                     XamlParser.ParseXaml(rootnode, reader);
                     Visit(rootnode, new HydrationContext
                     {
-                        RootElement = animation,
+                        RootElement = ret,
 #pragma warning disable 0618
                         ExceptionHandler = ResourceLoader.ExceptionHandler ?? (Internals.XamlLoader.DoNotThrowOnExceptions ? e => { } : (Action<Exception>)null)
 #pragma warning restore 0618
@@ -140,7 +116,9 @@ namespace Tizen.NUI.Xaml
                     break;
                 }
             }
-            return animation;
+
+            NameScopeExtensions.PopElement();
+            return ret;
         }
 
         public static void Load(object view, string xaml)
index ea38a727fe233a1ce439bf7be95166c6cf3c4fdf..44a7df8c9dd9565895865daebb624c9441cf2c4e 100755 (executable)
@@ -164,11 +164,9 @@ namespace Tizen.NUI.Xaml
             return false;
         }
 
-        bool IsResourceDictionary() => XmlType.Name == "ResourceDictionary";
-
         protected bool SkipChildren(IXamlNodeVisitor visitor, INode node, INode parentNode) =>
                (visitor.StopOnDataTemplate && IsDataTemplate(parentNode))
-            || (visitor.StopOnResourceDictionary && IsResourceDictionary())
+            || (visitor.StopOnResourceDictionary && visitor.IsResourceDictionary(this))
             || visitor.SkipChildren(node, parentNode);
 
         protected bool SkipVisitNode(IXamlNodeVisitor visitor, INode parentNode) =>
index f1254bc7a7ec0bc1cdfe6b56dd803a149eef7f93..68687809f25c274a11113a0010f8ca97221cc2a0 100755 (executable)
@@ -15,6 +15,7 @@ namespace Tizen.NUI.Xaml
         void Visit(RootNode node, INode parentNode);
         void Visit(ListNode node, INode parentNode);
         bool SkipChildren(INode node, INode parentNode);
+        bool IsResourceDictionary(ElementNode node);
     }
 
     internal enum TreeVisitingMode {
@@ -45,5 +46,6 @@ namespace Tizen.NUI.Xaml
         public void Visit(RootNode node, INode parentNode) => action(node, parentNode);
         public void Visit(ListNode node, INode parentNode) => action(node, parentNode);
         public bool SkipChildren(INode node, INode parentNode) => false;
+        public bool IsResourceDictionary(ElementNode node) => false;
     }
 }
\ No newline at end of file
index 055c1a54e19bc3ddd10976b304d23220e7430aba..27a5841baf46d53b935464a81b7e08f0bdb4ec4b 100755 (executable)
@@ -1,4 +1,6 @@
 using System;
+using System.Diagnostics;
+using System.Text;
 using System.Xml;
 
 namespace Tizen.NUI.Xaml
@@ -7,7 +9,22 @@ namespace Tizen.NUI.Xaml
     {
         readonly string _unformattedMessage;
 
-        public XamlParseException(string message, IXmlLineInfo xmlInfo, Exception innerException = null) : base(FormatMessage(message, xmlInfo), innerException)
+        static private StringBuilder GetStackInfo()
+        {
+            StringBuilder ret = new StringBuilder("\nStack:\n");
+
+            StackTrace st = new StackTrace();
+
+            for (int i = 2; i < st.FrameCount; i++)
+            {
+                StackFrame sf = st.GetFrame(i);
+                ret.AppendFormat("File:{0}, Method:{1}, Line:{2}\n", sf.GetFileName(), sf.GetMethod().Name, sf.GetFileLineNumber());
+            }
+
+            return ret;
+        }
+
+        public XamlParseException(string message, IXmlLineInfo xmlInfo, Exception innerException = null) : base(FormatMessage(message + GetStackInfo(), xmlInfo), innerException)
         {
             _unformattedMessage = message;
             XmlInfo = xmlInfo;
index 63f30da27d08b473d7fe22d999fcfdb8dbf7d444..c2707dd3f67366f43ad80f36812ae615f33e4b1b 100755 (executable)
@@ -40,7 +40,7 @@ namespace Tizen.NUI.Xaml
 {
     internal static class XamlParser
     {
-        public const string XFUri = "http://xamarin.com/schemas/2014/forms";
+        public const string XFUri = "http://tizen.org/Tizen.NUI/2018/XAML";
         public const string NUI2018Uri = "http://tizen.org/Tizen.NUI/2018/XAML";
         public const string X2006Uri = "http://schemas.microsoft.com/winfx/2006/xaml";
         public const string X2009Uri = "http://schemas.microsoft.com/winfx/2009/xaml";
index cbfefcc6d734cc3e42eee9fb0949efa9932cfe6e..1461a00f0ccabdacab15c98a2f9f05fd440f0898 100755 (executable)
@@ -47,7 +47,7 @@ namespace Tizen.NUI.Binding
                 if (_appIndexProvider == null)
                     throw new ArgumentException("No IAppIndexingProvider was provided");
                 if (_appIndexProvider.AppLinks == null)
-                    throw new ArgumentException("No AppLinks implementation was found, if in Android make sure you installed the Xamarin.Forms.AppLinks");
+                    throw new ArgumentException("No AppLinks implementation was found, if in Android make sure you installed the Tizen.NUI.Binding.AppLinks");
                 return _appIndexProvider.AppLinks;
             }
         }
index 48fb4bf1416f91bc21d41fb8a78f7d81127d810d..8f4c1f38a989a77b4bb652ae9b9d7c5cfe6906ba 100755 (executable)
@@ -105,6 +105,19 @@ namespace Tizen.NUI.Binding
         {
             { typeof(Uri), new UriTypeConverter() },
             { typeof(Color), new ColorTypeConverter() },
+            { typeof(Size2D), new Size2DTypeConverter() },
+            { typeof(Position2D), new Position2DTypeConverter() },
+            { typeof(Size), new SizeTypeConverter() },
+            { typeof(Position), new PositionTypeConverter() },
+            { typeof(Rectangle), new RectangleTypeConverter() },
+            { typeof(Rotation), new RotationTypeConverter() },
+            { typeof(Thickness), new ThicknessTypeConverter() },
+            { typeof(Vector2), new Vector2TypeConverter() },
+            { typeof(Vector3), new Vector3TypeConverter() },
+            { typeof(Vector4), new Vector4TypeConverter() },
+            { typeof(RelativeVector2), new RelativeVector2TypeConverter() },
+            { typeof(RelativeVector3), new RelativeVector3TypeConverter() },
+            { typeof(RelativeVector4), new RelativeVector4TypeConverter() },
         };
 
         // more or less the encoding of this, without the need to reflect
index 9f99006c1ad2b42634a953ba1b70eac2f64d599f..ea258e617cd2fb8219d9f5c570494bc2c29fc322 100755 (executable)
@@ -10,7 +10,7 @@ using Tizen.NUI.Xaml;
 
 namespace Tizen.NUI.Binding
 {
-    // [Xaml.ProvideCompiled("Xamarin.Forms.Core.XamlC.BindablePropertyConverter")]
+    [Xaml.ProvideCompiled("Tizen.NUI.Xaml.Core.XamlC.BindablePropertyConverter")]
     [Xaml.TypeConversion(typeof(BindableProperty))]
     internal sealed class BindablePropertyConverter : TypeConverter, IExtendedTypeConverter
     {
index 6debd8cc3772771e1ee22e93cfe0324f71a14844..bbbd9d918f325723c664319ea14734f651d8241f 100755 (executable)
@@ -100,9 +100,8 @@ namespace Tizen.NUI.Binding
             if (propertyGetter == null)
                 throw new ArgumentNullException("propertyGetter");
 
-            string path = GetBindingPath(propertyGetter);
-            return new Binding(path, mode, converter, converterParameter, stringFormat);
-        }
+                       return new Binding(GetBindingPath(propertyGetter), mode, converter, converterParameter, stringFormat);
+               }
 
         internal override void Apply(bool fromTarget)
         {
index 8ea280da2157297b826a4051366418306d1ae988..93a2355f82044574e0fabc20e8d947c6cf7c6379 100755 (executable)
@@ -15,6 +15,8 @@ namespace Tizen.NUI.Binding
 
         BindingMode _mode = BindingMode.Default;
         string _stringFormat;
+        object _targetNullValue;
+        object _fallbackValue;
 
         internal BindingBase()
         {
@@ -55,7 +57,24 @@ namespace Tizen.NUI.Binding
             }
         }
 
-        internal bool AllowChaining { get; set; }
+               public object TargetNullValue
+               {
+                       get { return _targetNullValue; }
+                       set {
+                               ThrowIfApplied();
+                               _targetNullValue = value;
+                       }
+               }
+
+               public object FallbackValue {
+                       get => _fallbackValue;
+                       set {
+                               ThrowIfApplied();
+                               _fallbackValue = value;
+                       }
+               }
+
+               internal bool AllowChaining { get; set; }
 
         internal object Context { get; set; }
 
@@ -73,7 +92,7 @@ namespace Tizen.NUI.Binding
             SynchronizedCollections.Remove(collection);
         }
 
-        internal static void EnableCollectionSynchronization(IEnumerable collection, object context, CollectionSynchronizationCallback callback)
+        public static void EnableCollectionSynchronization(IEnumerable collection, object context, CollectionSynchronizationCallback callback)
         {
             if (collection == null)
                 throw new ArgumentNullException(nameof(collection));
@@ -106,6 +125,8 @@ namespace Tizen.NUI.Binding
 
         internal virtual object GetSourceValue(object value, Type targetPropertyType)
         {
+            if (value == null && TargetNullValue != null)
+                return TargetNullValue;
             if (StringFormat != null)
                 return string.Format(StringFormat, value);
 
index 014640f2cadefaa9a203c395574703180025371c..62839e27e10c7ecf4e0b92dc1ccd07e41b0139cd 100755 (executable)
@@ -1,6 +1,6 @@
 ï»¿namespace Tizen.NUI.Binding
 {
-    // [Xaml.ProvideCompiled("Xamarin.Forms.Core.XamlC.BindingTypeConverter")]
+    [Xaml.ProvideCompiled("Tizen.NUI.Xaml.Core.XamlC.BindingTypeConverter")]
     [Xaml.TypeConversion(typeof(Binding))]
     internal sealed class BindingTypeConverter : TypeConverter
     {
index 494218c12dd492ab6e5b0fd3564dc610d25b3736..51cb273342526d7ff9bf2d02101aefd0f27ec7ac 100755 (executable)
@@ -1,12 +1,9 @@
 using System;
-using System.Linq;
-using System.Reflection;
-
-using Tizen.NUI;
+using System.Globalization;
 
 namespace Tizen.NUI.Binding
 {
-    // [Xaml.ProvideCompiled("Tizen.NUI.XamlC.ColorTypeConverter")]
+    [Xaml.ProvideCompiled("Tizen.NUI.Xaml.Core.XamlC.ColorTypeConverter")]
     [Xaml.TypeConversion(typeof(Color))]
     internal class ColorTypeConverter : TypeConverter
     {
@@ -47,7 +44,10 @@ namespace Tizen.NUI.Binding
                 }
                 else if (parts.Length == 4) //like 0.5,0.5,0.5,0.5
                 {
-                    return new Color(float.Parse(parts[0].Trim()), float.Parse(parts[1].Trim()), float.Parse(parts[2].Trim()), float.Parse(parts[3].Trim()));
+                    return new Color(Single.Parse(parts[0].Trim(), CultureInfo.InvariantCulture),
+                                     Single.Parse(parts[1].Trim(), CultureInfo.InvariantCulture),
+                                     Single.Parse(parts[2].Trim(), CultureInfo.InvariantCulture),
+                                     Single.Parse(parts[3].Trim(), CultureInfo.InvariantCulture));
                 }
             }
 
index c22328750bdf6fd82e920619977b34785b9bf4b7..8987212e53675ecb491915476041921c73ab15e8 100755 (executable)
@@ -61,7 +61,7 @@ namespace Tizen.NUI.Binding
             get
             {
                 // if (info == null)
-                //     throw new InvalidOperationException("You MUST call Xamarin.Forms.Init(); prior to using it.");
+                //     throw new InvalidOperationException("You MUST call Tizen.NUI.Xaml.Init(); prior to using it.");
                 return info;
             }
             set { info = value; }
index 5903c021a679f86616bae23addae1ea1225c853a..cd9511385a61ace71913e708463f3a1f11c2da4b 100755 (executable)
@@ -1,4 +1,5 @@
 using System;
+using System.Globalization;
 using System.Linq;
 using System.Reflection;
 
@@ -15,7 +16,10 @@ namespace Tizen.NUI.Binding
                 string[] parts = value.Split(',');
                 if (parts.Length == 4)
                 {
-                    return new Extents(ushort.Parse(parts[0].Trim()), ushort.Parse(parts[1].Trim()), ushort.Parse(parts[2].Trim()), ushort.Parse(parts[3].Trim()));
+                    return new Extents(ushort.Parse(parts[0].Trim(), CultureInfo.InvariantCulture),
+                                       ushort.Parse(parts[1].Trim(), CultureInfo.InvariantCulture),
+                                       ushort.Parse(parts[2].Trim(), CultureInfo.InvariantCulture), 
+                                       ushort.Parse(parts[3].Trim(), CultureInfo.InvariantCulture));
                 }
             }
 
index 738addffc6400088139caf3442d64cb394fdd3ae..63f031924451001f3133b2bcbb5cb0301a3c37ca 100755 (executable)
@@ -3,7 +3,7 @@ using Tizen.NUI.Xaml;
 
 namespace Tizen.NUI.Binding
 {
-    // [ProvideCompiled("Xamarin.Forms.Core.XamlC.PassthroughValueProvider")]
+    [ProvideCompiled("Tizen.NUI.Xaml.Core.XamlC.PassthroughValueProvider")]
     [AcceptEmptyServiceProvider]
     internal sealed class BindingCondition : Condition, IValueProvider
     {
index 9bc02669439f1fd86d98c7d99ede1b4bb4caf00a..96e881550d3087af2a8751bb61bd5ca69ea76d6a 100755 (executable)
@@ -5,7 +5,7 @@ using Tizen.NUI.Xaml;
 namespace Tizen.NUI.Binding
 {
     [ContentProperty("Setters")]
-    // [ProvideCompiled("Xamarin.Forms.Core.XamlC.PassthroughValueProvider")]
+    [ProvideCompiled("Tizen.NUI.Xaml.Core.XamlC.PassthroughValueProvider")]
     [AcceptEmptyServiceProvider]
     internal sealed class DataTrigger : TriggerBase, IValueProvider
     {
diff --git a/src/Tizen.NUI/src/internal/XamlBinding/Interactivity/PropertyCondition.cs b/src/Tizen.NUI/src/internal/XamlBinding/Interactivity/PropertyCondition.cs
new file mode 100755 (executable)
index 0000000..54bc675
--- /dev/null
@@ -0,0 +1,112 @@
+using System;
+using System.ComponentModel;
+using System.Reflection;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Xaml
+{
+       [ProvideCompiled("Tizen.NUI.Xaml.Core.XamlC.PassthroughValueProvider")]
+       [AcceptEmptyServiceProvider]
+       internal sealed class PropertyCondition : Condition, IValueProvider
+       {
+               readonly BindableProperty _stateProperty;
+
+               BindableProperty _property;
+               object _triggerValue;
+
+               public PropertyCondition()
+               {
+                       _stateProperty = BindableProperty.CreateAttached("State", typeof(bool), typeof(PropertyCondition), false, propertyChanged: OnStatePropertyChanged);
+               }
+
+               public BindableProperty Property
+               {
+                       get { return _property; }
+                       set
+                       {
+                               if (_property == value)
+                                       return;
+                               if (IsSealed)
+                                       throw new InvalidOperationException("Can not change Property once the Trigger has been applied.");
+                               _property = value;
+
+                               //convert the value
+                               if (_property != null && s_valueConverter != null)
+                               {
+                                       Func<MemberInfo> minforetriever = () => Property.DeclaringType.GetRuntimeProperty(Property.PropertyName);
+                                       Value = s_valueConverter.Convert(Value, Property.ReturnType, minforetriever, null);
+                               }
+                       }
+               }
+
+               public object Value
+               {
+                       get { return _triggerValue; }
+                       set
+                       {
+                               if (_triggerValue == value)
+                                       return;
+                               if (IsSealed)
+                                       throw new InvalidOperationException("Can not change Value once the Trigger has been applied.");
+
+                               //convert the value
+                               if (_property != null && s_valueConverter != null)
+                               {
+                                       Func<MemberInfo> minforetriever = () => Property.DeclaringType.GetRuntimeProperty(Property.PropertyName);
+                                       value = s_valueConverter.Convert(value, Property.ReturnType, minforetriever, null);
+                               }
+                               _triggerValue = value;
+                       }
+               }
+
+               object IValueProvider.ProvideValue(IServiceProvider serviceProvider)
+               {
+                       //This is no longer required
+                       return this;
+               }
+
+               internal override bool GetState(BindableObject bindable)
+               {
+                       return (bool)bindable.GetValue(_stateProperty);
+               }
+
+               static IValueConverterProvider s_valueConverter = DependencyService.Get<IValueConverterProvider>();
+
+               internal override void SetUp(BindableObject bindable)
+               {
+                       object newvalue = bindable.GetValue(Property);
+                       bool newState = (newvalue == Value) || (newvalue != null && newvalue.Equals(Value));
+                       bindable.SetValue(_stateProperty, newState);
+                       bindable.PropertyChanged += OnAttachedObjectPropertyChanged;
+               }
+
+               internal override void TearDown(BindableObject bindable)
+               {
+                       bindable.ClearValue(_stateProperty);
+                       bindable.PropertyChanged -= OnAttachedObjectPropertyChanged;
+               }
+
+               void OnAttachedObjectPropertyChanged(object sender, PropertyChangedEventArgs e)
+               {
+                       var bindable = (BindableObject)sender;
+                       var oldState = (bool)bindable.GetValue(_stateProperty);
+
+                       if (Property == null)
+                               return;
+                       if (e.PropertyName != Property.PropertyName)
+                               return;
+                       object newvalue = bindable.GetValue(Property);
+                       bool newstate = (newvalue == Value) || (newvalue != null && newvalue.Equals(Value));
+                       if (oldState != newstate)
+                               bindable.SetValue(_stateProperty, newstate);
+               }
+
+               void OnStatePropertyChanged(BindableObject bindable, object oldValue, object newValue)
+               {
+                       if ((bool)oldValue == (bool)newValue)
+                               return;
+
+                       ConditionChanged?.Invoke(bindable, (bool)oldValue, (bool)newValue);
+               }
+       }
+}
\ No newline at end of file
index 6a41249d4f3d01b077bded149457348d93ccfaaf..28fd9446ea52e33f1570b3261d17f08763782d27 100755 (executable)
@@ -7,7 +7,7 @@ using Tizen.NUI.Xaml;
 namespace Tizen.NUI.Binding
 {
     [ContentProperty("Setters")]
-    // [ProvideCompiled("Xamarin.Forms.Core.XamlC.PassthroughValueProvider")]
+    [ProvideCompiled("Tizen.NUI.Xaml.Core.XamlC.PassthroughValueProvider")]
     [AcceptEmptyServiceProvider]
     internal sealed class Trigger : TriggerBase, IValueProvider
     {
index 1f83d1838ac38f804f4f5085a76fd5493fdaee64..b17ac58f4c6512545912abf7d544c6f41a37f857 100755 (executable)
@@ -5,7 +5,7 @@ using Tizen.NUI.Xaml;
 
 namespace Tizen.NUI.Binding
 {
-    // [ProvideCompiled("Tizen.NUI.Core.XamlC.PassthroughValueProvider")]
+    [ProvideCompiled("Tizen.NUI.Core.XamlC.PassthroughValueProvider")]
     [AcceptEmptyServiceProvider]
     internal sealed class XamlPropertyCondition : Condition, IValueProvider
     {
@@ -28,7 +28,6 @@ namespace Tizen.NUI.Binding
                     return;
                 if (IsSealed)
                     throw new InvalidOperationException("Can not change Property once the Trigger has been applied.");
-
                 _property = value;
 
                 //convert the value
index 67c6ff71c92f6804a8028c8e97fe6b63d547911e..30545a84f8f5709c8e057d5214e15074a3510abe 100755 (executable)
@@ -2,7 +2,6 @@ using System.ComponentModel;
 
 namespace Tizen.NUI.Binding.Internals
 {
-    [EditorBrowsable(EditorBrowsableState.Never)]
     internal class DynamicResource
     {
         public DynamicResource(string key)
index 727cd9827b99f6d4909b81123c76c8130bef0199..676ec7aabd47c9c9ac2a55cbe9bccbcd21e43762 100755 (executable)
@@ -3,7 +3,6 @@ using System.ComponentModel;
 
 namespace Tizen.NUI.Binding.Internals
 {
-    [EditorBrowsable(EditorBrowsableState.Never)]
     internal interface IDataTemplate
     {
         Func<object> LoadTemplate { get; set; }
index 21bc94d6f28c28f484900180c807c4d51fb9d1bf..8c6c63d0b1f9d6dd30e82573d5a85679932ddb3d 100755 (executable)
@@ -4,7 +4,6 @@ using System.Threading.Tasks;
 
 namespace Tizen.NUI.Binding.Internals
 {
-    [EditorBrowsable(EditorBrowsableState.Never)]
     internal interface IDeserializer
     {
         Task<IDictionary<string, object>> DeserializePropertiesAsync();
index cef4d8c19f666e5c5d27205d8017ce38cbe20cf1..62d53a2259386d3adef6e55afbc4fe5c1e74f369 100755 (executable)
@@ -3,7 +3,6 @@ using Tizen.NUI.Binding;
 
 namespace Tizen.NUI.Binding.Internals
 {
-    [EditorBrowsable(EditorBrowsableState.Never)]
     internal interface IDynamicResourceHandler
     {
         void SetDynamicResource(BindableProperty property, string key);
index 6da4b4ce4f24561eaad9ba4059eb5b4390f2c745..c9b6ba83d179c79730a318be71ed14976bbf7e73 100755 (executable)
@@ -4,7 +4,6 @@ using System.Xml;
 
 namespace Tizen.NUI.Binding.Internals
 {
-    [EditorBrowsable(EditorBrowsableState.Never)]
     internal interface INameScope
     {
         object FindByName(string name);
index 78e0d8b65a7bf4643d09c63469005097ee089ef0..1e093210ffc52ec30969ef3b4eb1190078a6fc66 100755 (executable)
@@ -4,7 +4,6 @@ using System.ComponentModel;
 namespace Tizen.NUI.Binding.Internals
 {
     [Flags]
-    [EditorBrowsable(EditorBrowsableState.Never)]
     internal enum InvalidationTrigger
     {
         Undefined = 0,
index 9eee776bd4416f2cf8452b6d0284d80aea37eaab..13b4bfa43d5cc2479fb4e2fa3527452dedfd3ef1 100755 (executable)
@@ -7,7 +7,6 @@ using Tizen.NUI.Xaml;
 
 namespace Tizen.NUI.Binding.Internals
 {
-    [EditorBrowsable(EditorBrowsableState.Never)]
     internal class NameScope : INameScope
     {
         public static readonly BindableProperty NameScopeProperty = BindableProperty.CreateAttached("NameScope", typeof(INameScope), typeof(NameScope), default(INameScope));
index 1c6342cd2db95ab805c2d6dc7c12e0a0ed896d44..995554a51f76413fee825aa7231b992768ad77d5 100755 (executable)
@@ -3,7 +3,6 @@ using System.ComponentModel;
 
 namespace Tizen.NUI.Binding.Internals
 {
-    [EditorBrowsable(EditorBrowsableState.Never)]
     internal static class NumericExtensions
     {
 
diff --git a/src/Tizen.NUI/src/internal/XamlBinding/Internals/PreserveAttribute.cs b/src/Tizen.NUI/src/internal/XamlBinding/Internals/PreserveAttribute.cs
new file mode 100755 (executable)
index 0000000..08aa02a
--- /dev/null
@@ -0,0 +1,22 @@
+using System;
+using System.ComponentModel;
+
+namespace Tizen.NUI.Binding.Internals
+{
+       [AttributeUsage(AttributeTargets.All)]
+    internal class PreserveAttribute : Attribute
+       {
+               public bool AllMembers;
+               public bool Conditional;
+
+               public PreserveAttribute(bool allMembers, bool conditional)
+               {
+                       AllMembers = allMembers;
+                       Conditional = conditional;
+               }
+
+               public PreserveAttribute()
+               {
+               }
+       }
+}
\ No newline at end of file
index 3b21a997a0412353bf5fa030992ed393abd317ac..7b00bb973fe9b8d21ebe85ca27e6a746fd3cdf86 100755 (executable)
@@ -7,7 +7,6 @@ using Tizen.NUI.Binding;
 
 namespace Tizen.NUI.Binding.Internals
 {
-    [EditorBrowsable(EditorBrowsableState.Never)]
     internal abstract class Ticker
     {
         static Ticker s_ticker;
index 69b35c98482ef90442a71c70351b12918cf21c71..ed30914a74fb4889cd8328ae2189df3851fc273e 100755 (executable)
@@ -9,7 +9,6 @@ using Tizen.NUI.Binding;
 namespace Tizen.NUI.Binding.Internals
 {
     //FIXME: need a better name for this, and share with Binding, so we can share more unittests
-    [EditorBrowsable(EditorBrowsableState.Never)]
     internal abstract class TypedBindingBase : BindingBase
     {
         IValueConverter _converter;
@@ -54,7 +53,6 @@ namespace Tizen.NUI.Binding.Internals
         }
     }
 
-    [EditorBrowsable(EditorBrowsableState.Never)]
     internal sealed class TypedBinding<TSource, TProperty> : TypedBindingBase
     {
         readonly Func<TSource, TProperty> _getter;
index d7c12a8eec80624a27ac5e3df768aa15b3c6a6af..f3a00719d66acc2c5ebba0624b2927029d15dfd6 100755 (executable)
@@ -58,7 +58,7 @@ namespace Tizen.NUI.Binding
         public static readonly BindableProperty CascadeInputTransparentProperty = BindableProperty.Create(
             nameof(CascadeInputTransparent), typeof(bool), typeof(Layout), true);
 
-        public new static readonly BindableProperty PaddingProperty = PaddingElement.PaddingProperty;
+        public static new readonly BindableProperty PaddingProperty = PaddingElement.PaddingProperty;
 
         static IList<KeyValuePair<Layout, int>> s_resolutionList = new List<KeyValuePair<Layout, int>>();
         static bool s_relayoutInProgress;
index e486931abb180b07bc35bfd083605a6bdd1481ac..98cddaa360172c6217baee3a14f3afabedf1c77e 100755 (executable)
@@ -7,7 +7,7 @@ using Tizen.NUI;
 
 namespace Tizen.NUI.Binding
 {
-    // [Xaml.ProvideCompiled("Xamarin.Forms.Core.XamlC.LayoutOptionsConverter")]
+    [Xaml.ProvideCompiled("Tizen.NUI.Xaml.Core.XamlC.LayoutOptionsConverter")]
     [Xaml.TypeConversion(typeof(LayoutOptions))]
     internal sealed class LayoutOptionsConverter : TypeConverter
     {
index 8960553b62dc5b7ae14a7ab5456a21aa8ea4379d..e7327c3beb413ff2272c9585bfb43e61c9329efa 100755 (executable)
@@ -4,7 +4,7 @@ using System.Linq;
 
 namespace Tizen.NUI.Binding
 {
-    // [Xaml.ProvideCompiled("Tizen.NUI.Core.XamlC.ListStringTypeConverter")]
+    [Xaml.ProvideCompiled("Tizen.NUI.Core.XamlC.ListStringTypeConverter")]
     [Xaml.TypeConversion(typeof(List<string>))]
     internal class ListStringTypeConverter : TypeConverter
     {
index 887f0d93d1f375c30e5cfb0ee39d40015093716f..eef0cb8fc0905a65ce60a19118ca7fb199452dcd 100755 (executable)
@@ -172,7 +172,7 @@ namespace Tizen.NUI
         /// The title of the back button for the specified page.
         /// </summary>
         /// <param name="page">The Page whose back-button's title is being requested.</param>
-        /// <returns>The title of the back button that would be shown if the specified page were the Xamarin.Forms.CurrentPage.</returns>
+        /// <returns>The title of the back button that would be shown if the specified page were the Tizen.NUI.Xaml.CurrentPage.</returns>
         public static string GetBackButtonTitle(BindableObject page)
         {
             return (string)page.GetValue(BackButtonTitleProperty);
@@ -241,6 +241,11 @@ namespace Tizen.NUI
         /// </summary>
         public event EventHandler<NavigationEventArgs> Popped;
 
+        /// <summary>
+        /// Event that is raised when the last nonroot element is popped from this NavigationPage element.
+        /// </summary>
+        public event EventHandler<NavigationEventArgs> PoppedToRoot;
+
         /// <summary>
         /// Pops all but the root Page off the navigation stack.
         /// </summary>
index 9bbbfd9fd3969a1e7bc845dbe43322d747126f63..9bdaef6cac3506043b7f130192de7b9716960381 100755 (executable)
@@ -5,7 +5,7 @@ using Tizen.NUI;
 
 namespace Tizen.NUI.Binding
 {
-    // [Xaml.ProvideCompiled("Xamarin.Forms.Core.XamlC.RectangleTypeConverter")]
+    [Xaml.ProvideCompiled("Tizen.NUI.Xaml.Core.XamlC.RectangleTypeConverter")]
     [Xaml.TypeConversion(typeof(Rectangle))]
     internal class RectangleTypeConverter : TypeConverter
     {
index dc287138331fbd5ce721335825c4752c895d36ca..4f48d72c60bc7c07b371d28d17b7ba1819e651a8 100755 (executable)
@@ -1,8 +1,5 @@
 using System;
-using System.Linq;
-using System.Reflection;
-
-using Tizen.NUI;
+using System.Globalization;
 
 namespace Tizen.NUI.Binding
 {
@@ -10,16 +7,48 @@ namespace Tizen.NUI.Binding
     {
         public override object ConvertFromInvariantString(string value)
         {
+            /// public Rotation(Radian radian(float), Vector3 vector3)
+            /// Default: <View Orientation="45.0,12,13,0" />
+            /// Oritation="D:23, 0, 0, 1"
+            /// Oritation="R:23, 0, 0, 1" 
             if (value != null)
             {
                 string[] parts = value.Split(',');
                 if (parts.Length == 4)
                 {
-                    Radian radian = new Radian(float.Parse(parts[0].Trim()));
-                    Vector3 vector3 = new Vector3( float.Parse(parts[1].Trim()), float.Parse(parts[2].Trim()), float.Parse(parts[3].Trim()) );
-                    //Ex: <View Orientation="45.0,12,13,0" />
-                    // public Rotation(Radian radian(float), Vector3 vector3)
-                    return new Rotation( radian, vector3 );
+                    bool useDefault = true;
+                    Radian radian = null;
+                    string[] head = parts[0].Trim().Split(':');
+                    if (head.Length == 2)
+                    {
+                        useDefault = false;
+                        string radianOrDegree = head[0].Trim().ToLowerInvariant();
+                        if(radianOrDegree == "d" || radianOrDegree == "degree")
+                        {
+                            /// Oritation="D:23, 0, 0, 1"
+                            radian = new Radian( new Degree( Single.Parse( head[1].Trim(), CultureInfo.InvariantCulture ) ) );
+                        }
+                        else if (radianOrDegree == "r" || radianOrDegree == "radian")
+                        {
+                            /// Oritation="R:23, 0, 0, 1"
+                            radian = new Radian( Single.Parse( head[1].Trim(), CultureInfo.InvariantCulture ) );
+                        }
+                        else
+                        {
+                            throw new InvalidOperationException($"Cannot convert the first parameter \"{value}\" into Radian of {typeof(Rotation)}");
+                        }
+                    }
+
+                    if (useDefault)
+                    {
+                        ///Default: <View Orientation="45.0,12,13,0" />
+                        radian = new Radian( Single.Parse( parts[0].Trim(), CultureInfo.InvariantCulture ) );
+                    }
+
+                    Vector3 vector3 = new Vector3(Single.Parse(parts[1].Trim(), CultureInfo.InvariantCulture),
+                                                  Single.Parse(parts[2].Trim(), CultureInfo.InvariantCulture),
+                                                  Single.Parse(parts[3].Trim(), CultureInfo.InvariantCulture));
+                    return new Rotation(radian, vector3);
                 }
             }
 
index 29021869a40f168c209b9e97bc792ff0fefe895e..7e0bb79bd21d3b6e9b1fbe55b439530ac5acb4b6 100755 (executable)
@@ -9,7 +9,7 @@ using Tizen.NUI.Xaml;
 namespace Tizen.NUI.Binding
 {
     [ContentProperty("Value")]
-    // [ProvideCompiled("Tizen.NUI.Core.XamlC.SetterValueProvider")]
+    [ProvideCompiled("Tizen.NUI.Core.XamlC.SetterValueProvider")]
     internal sealed class Setter : IValueProvider
     {
         readonly ConditionalWeakTable<BindableObject, object> _originalValues = new ConditionalWeakTable<BindableObject, object>();
index 1b54bb5b55d5d85728f9e7ad540196cb59d8312e..2a2d06c143ac553806e8fe9bb241e59800ddd2f2 100755 (executable)
@@ -4,9 +4,11 @@ using System.Reflection;
 using System.Globalization;
 
 using Tizen.NUI;
+using Tizen.NUI.Xaml;
 
 namespace Tizen.NUI.Binding
 {
+    [ProvideCompiledAttribute("Tizen.NUI.Xaml.Core.XamlC.Size2DTypeConverter")]
     internal class SizeTypeConverter : TypeConverter
     {
         public override object ConvertFromInvariantString(string value)
@@ -26,6 +28,7 @@ namespace Tizen.NUI.Binding
         }
     }
 
+    [ProvideCompiledAttribute("Tizen.NUI.Xaml.Core.XamlC.Size2DTypeConverter")]
     internal class Size2DTypeConverter : TypeConverter
     {
         public override object ConvertFromInvariantString(string value)
index 305d9f75fb0b0744c166a1dd1c269634d7230d39..a5719643a06b917040094eb76199afd09beee3ff 100755 (executable)
@@ -8,7 +8,7 @@ namespace Tizen.NUI.Binding
     [ContentProperty("Setters")]
     internal sealed class Style : IStyle
     {
-        internal const string StyleClassPrefix = "Xamarin.Forms.StyleClass.";
+        internal const string StyleClassPrefix = "Tizen.NUI.Binding.StyleClass.";
 
         readonly BindableProperty _basedOnResourceProperty = BindableProperty.CreateAttached("BasedOnResource", typeof(Style), typeof(Style), default(Style),
             propertyChanged: OnBasedOnResourceChanged);
@@ -74,7 +74,7 @@ namespace Tizen.NUI.Binding
             }
         }
 
-        public IList<Behavior> Behaviors
+        internal IList<Behavior> Behaviors
         {
             get { return _behaviors ?? (_behaviors = new AttachedCollection<Behavior>()); }
         }
@@ -85,7 +85,7 @@ namespace Tizen.NUI.Binding
 
         public IList<Setter> Setters { get; }
 
-        public IList<TriggerBase> Triggers
+        internal IList<TriggerBase> Triggers
         {
             get { return _triggers ?? (_triggers = new AttachedCollection<TriggerBase>()); }
         }
index a0761b4ecd1a896542356012fec988a2c5f5cbdb..54f6648cb7cd0782ef072d4d60d7041d576fbb20 100755 (executable)
@@ -75,15 +75,14 @@ namespace Tizen.NUI.Binding
 
         public IEnumerator<T> GetEnumerator()
         {
-            lock (_list)
+            ReadOnlyCollection<T> snap = _snapshot;
+            if (snap == null)
             {
-                ReadOnlyCollection<T> snap = _snapshot;
-                if (snap == null)
-                {
+                lock (_list)
                     _snapshot = snap = new ReadOnlyCollection<T>(_list.ToList());
-                }
-                return snap?.GetEnumerator();
             }
+
+            return snap?.GetEnumerator();
         }
 
         public int IndexOf(T item)
index a1a376d77d942a2a3d4493b481495dad6bf20834..72271c33091fdeff66364055f43f754d929a78db 100755 (executable)
@@ -3,7 +3,7 @@ using System.Globalization;
 
 namespace Tizen.NUI.Binding
 {
-    // [Xaml.ProvideCompiled("Xamarin.Forms.Core.XamlC.ThicknessTypeConverter")]
+    [Xaml.ProvideCompiled("Tizen.NUI.Xaml.Core.XamlC.ThicknessTypeConverter")]
     [Xaml.TypeConversion(typeof(Thickness))]
     internal class ThicknessTypeConverter : TypeConverter
     {
index b1f804f35d22fb333a1b60c4f855150e1f30ea9e..d05bf086738e4a4d5a70144eeea4bba27a60393a 100755 (executable)
@@ -215,9 +215,9 @@ namespace Tizen.NUI.Binding
                             if (refAsm != null)
                             {
                                 RegisterAssemblyRecursively(refAsm);
-                                if (refName.Name == "Xamarin.Forms.Core")
+                                if (refName.Name == "Tizen.NUI.Xaml.Core")
                                 {
-                                    if (refAsm.GetType("Xamarin.Forms.PlatformConfiguration.TizenSpecific.VisualElement") != null)
+                                    if (refAsm.GetType("Tizen.NUI.Xaml.PlatformConfiguration.TizenSpecific.VisualElement") != null)
                                     {
                                         IsTizenSpecificAvailable = true;
                                     }
index cd614015c3695f2d5030150a86db2bcffdb85710..fa8f3926e3aa161036ed0eb21d206fd15dd6441f 100755 (executable)
@@ -4,7 +4,7 @@ using Tizen.NUI.Xaml;
 
 namespace Tizen.NUI.Binding
 {
-    // [Xaml.ProvideCompiled("Xamarin.Forms.Core.XamlC.TypeTypeConverter")]
+    [Xaml.ProvideCompiled("Tizen.NUI.Xaml.Core.XamlC.TypeTypeConverter")]
     [Xaml.TypeConversion(typeof(Type))]
     internal sealed class TypeTypeConverter : TypeConverter, IExtendedTypeConverter
     {
index 8a5437d9e23c8ee40ca625b8434d93edaa370ae6..67928a3bc8aaaafa91409beb626068da4f2ed46c 100755 (executable)
@@ -2,7 +2,7 @@
 
 namespace Tizen.NUI.Binding
 {
-    // [Xaml.ProvideCompiled("Tizen.NUI.Core.XamlC.UriTypeConverter")]
+    [Xaml.ProvideCompiled("Tizen.NUI.Core.XamlC.UriTypeConverter")]
     [Xaml.TypeConversion(typeof(Uri))]
     internal class UriTypeConverter : TypeConverter
     {
diff --git a/src/Tizen.NUI/src/public/Xaml/ProvideCompiledAttribute.cs b/src/Tizen.NUI/src/public/Xaml/ProvideCompiledAttribute.cs
new file mode 100755 (executable)
index 0000000..4ea4385
--- /dev/null
@@ -0,0 +1,15 @@
+using System;
+
+namespace Tizen.NUI.Xaml
+{
+       [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
+       sealed class ProvideCompiledAttribute : Attribute
+       {
+               public string CompiledVersion { get; }
+
+               public ProvideCompiledAttribute (string compiledVersion)
+               {
+                       CompiledVersion = compiledVersion;
+               }
+       }
+}
\ No newline at end of file
index 9523d35ab4b1053cd9c979163ec72ba0bcadb730..2197921fb6ca2fe7baee1b6f854f1d6545dc12d4 100755 (executable)
 using System;
 using System.Reflection;
 using System.ComponentModel;
+using Tizen.NUI.Binding;
 
 namespace Tizen.NUI.Xaml
 {
     /// <summary>
-    /// Extension class for View defining Xamarin.Forms.Xaml.Extensions.LoadFromXaml{TView} method.
+    /// Extension class for View defining Tizen.NUI.Xaml.Extensions.LoadFromXaml{TView} method.
     /// </summary>
     [EditorBrowsable(EditorBrowsableState.Never)]
     public static class Extensions
@@ -69,9 +70,9 @@ namespace Tizen.NUI.Xaml
 
         /// 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 Transition LoadTransition(string animationXamlPath)
+        public static T LoadObject<T>(string path)
         {
-            return XamlLoader.LoadTransition(animationXamlPath);
+            return XamlLoader.LoadObject<T>(path);
         }
-       }
+    }
 }
\ No newline at end of file
index 09f565cd9f92ee1c75891b59c5ab703a40044ad7..7ddbc048e1c166d3b29f94d0550d26e19123dc78 100755 (executable)
@@ -17,7 +17,8 @@ namespace Tizen.NUI.Binding
         /// <summary>
         /// Implements the bound property whose interface is provided by the BindingContext property.
         /// </summary>
-        internal static readonly BindableProperty BindingContextProperty =
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static readonly BindableProperty BindingContextProperty =
             BindableProperty.Create("BindingContext", typeof(object), typeof(BindableObject), default(object),
                                     BindingMode.OneWay, null, BindingContextPropertyChanged, null, null, BindingContextPropertyBindingChanging);
 
@@ -62,7 +63,7 @@ namespace Tizen.NUI.Binding
         }
 
         /// <summary>
-        /// Clears any value set by Xamarin.Forms.BindableObject.SetValue.
+        /// Clears any value set by Tizen.NUI.Xaml.BindableObject.SetValue.
         /// </summary>
         /// <param name="property">The BindableProperty to clear</param>
         internal void ClearValue(BindableProperty property)
@@ -71,7 +72,7 @@ namespace Tizen.NUI.Binding
         }
 
         /// <summary>
-        /// Clears any value set by Xamarin.Forms.BindableObject.SetValue for the property that is identified by propertyKey.
+        /// Clears any value set by Tizen.NUI.Xaml.BindableObject.SetValue for the property that is identified by propertyKey.
         /// </summary>
         /// <param name="propertyKey">The BindablePropertyKey that identifies the BindableProperty to clear.</param>
         internal void ClearValue(BindablePropertyKey propertyKey)
index 5f04e4776f2bb71e933b46a777b4bb6fb681b20f..63891ff6fc63d9eeeeb5d00dd4a7574d5281529e 100755 (executable)
@@ -35,27 +35,13 @@ namespace Tizen.NUI
         [EditorBrowsable(EditorBrowsableState.Never)]
         public View Root {get; internal set;}
 
-        internal static readonly BindableProperty ContentProperty = BindableProperty.Create(nameof(Content), typeof(View), typeof(ContentPage), null, propertyChanged: (bindable, oldValue, newValue) =>
+        /// <summary>
+        /// The contents of ContentPage can be added into it.
+        /// </summary>
+        /// 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 ContentProperty = BindableProperty.Create(nameof(Content), typeof(View), typeof(ContentPage), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
-            // var self = (IControlTemplated)bindable;
-            // var newElement = (Element)newValue;
-            // if (self.ControlTemplate == null)
-            // {
-            //  while (self.InternalChildren.Count > 0)
-            //  {
-            //      self.InternalChildren.RemoveAt(self.InternalChildren.Count - 1);
-            //  }
-
-            //         if (newValue != null)
-            //      self.InternalChildren.Add(newElement);
-            // }
-            // else
-            // {
-            //         if (newElement != null)
-            //         {
-            //      BindableObject.SetInheritedBindingContext(newElement, bindable.BindingContext);
-            //         }
-            // }
             var self = (ContentPage)bindable;
             if (newValue != null)
             {
@@ -115,10 +101,8 @@ namespace Tizen.NUI
             IsCreateByXaml = true;
 
             Root = new View();
-            Root.Size2D = new Size2D(win.WindowSize.Width, win.WindowSize.Height);
-            Root.ParentOrigin = ParentOrigin.TopLeft;
-            Root.PivotPoint = PivotPoint.TopLeft;
-            Root.PositionUsesPivotPoint = true;
+            Root.WidthResizePolicy = ResizePolicyType.FillToParent;
+            Root.HeightResizePolicy = ResizePolicyType.FillToParent;
 
             win.Add(Root);
         }
@@ -247,19 +231,16 @@ namespace Tizen.NUI
 
         /// 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 Animation CreateAnimation(string animationType)
+        public Transition GetTransition(string transitionName)
         {
-            Animation ani = null;
             Transition trans = null;
-            transDictionary.TryGetValue(animationType, out trans);
-
-            ani = trans?.CreateAnimation();
-            return ani;
+            transDictionary.TryGetValue(transitionName, out trans);
+            return trans;
         }
 
-        private void CreateAnimationFactory()
+        private void LoadTransitions()
         {
-            foreach (string str in transitionType)
+            foreach (string str in transitionNames)
             {
                 string resourceName = str + ".xaml";
                 Transition trans = null;
@@ -270,7 +251,7 @@ namespace Tizen.NUI
 
                 if (File.Exists(likelyResourcePath))
                 {
-                    trans = Extensions.LoadTransition(likelyResourcePath);
+                    trans = Extensions.LoadObject<Transition>(likelyResourcePath);
                 }
                 if (trans)
                 {
@@ -279,20 +260,20 @@ namespace Tizen.NUI
             }
         }
 
-        private string[] transitionType;
+        private string[] transitionNames;
 
         /// 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 string[] TransitionType
+        public string[] TransitionNames
         {
             get
             {
-                return transitionType;
+                return transitionNames;
             }
             set
             {
-                transitionType = value;
-                CreateAnimationFactory();
+                transitionNames = value;
+                LoadTransitions();
             }
         }
     }
index f932e694e3d78e629056bed62c3b827a8b79208e..59a9cda07418652a1309aad652cb03689713270e 100755 (executable)
@@ -347,8 +347,13 @@ namespace Tizen.NUI.Binding
         {
             INameScope namescope = GetNameScope();
             if (namescope == null)
-                throw new InvalidOperationException("this element is not in a namescope");
-            return namescope.FindByName(name);
+            {
+                return null;
+            }
+            else
+            {
+                return namescope.FindByName(name);
+            }
         }
 
         void INameScope.RegisterName(string name, object scopedElement)
@@ -600,6 +605,8 @@ namespace Tizen.NUI.Binding
             object value;
             if (this.TryGetResource(key, out value))
                 OnResourceChanged(property, value);
+
+            Tizen.NUI.Application.AddResourceChangedCallback(this, (this as Element).OnResourcesChanged);
         }
 
         internal event EventHandler ParentSet;
index add06df0d778b7163d65e1a14fe4596da7109aee..613ac8998af8cf424fc8afec76876a8a4f7438ae 100755 (executable)
@@ -10,6 +10,7 @@ namespace Tizen.NUI.Binding
         /// Check if resources created.
         /// </summary>
         bool IsResourcesCreated { get; }
+
         /// <summary>
         /// Saved xaml resources.
         /// </summary>
index 504bb7e1fe36d8c91248043005c7034eefd0262e..3ba97ca1fec95c35c065c8f00e9cbd99370c466c 100755 (executable)
@@ -17,6 +17,7 @@ namespace Tizen.NUI.Binding
         /// <param name="culture">The culture to use in the converter.</param>
         /// <returns>A converted value. If the method returns null, the valid null value is used.</returns>
         object Convert(object value, Type targetType, object parameter, CultureInfo culture);
+
         /// <summary>
         /// Converts a value.
         /// </summary>
index 4f92cde87ff4508837b75faee00450a7467d9830..b1c047f2d5ea1669039dc08d02284690f2d02844 100755 (executable)
@@ -1,3 +1,4 @@
+using System.Collections.Generic;
 using System.ComponentModel;
 using Tizen.NUI.Binding.Internals;
 
@@ -18,5 +19,27 @@ namespace Tizen.NUI.Binding
         {
             return (T)namescope.FindByName(name);
         }
+
+        private static Stack<Element> elementStack = new Stack<Element>();
+
+        internal static void PushElement(object element)
+        {
+            elementStack.Push((Element)element);
+        }
+
+        internal static void PopElement()
+        {
+            elementStack.Pop();
+        }
+
+        /// <summary>
+        /// Used to find the object defined in Xaml file.
+        /// </summary>
+        /// 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 T FindByNameInCurrentNameScope<T>(string name)
+        {
+            return FindByName<T>(elementStack.Peek(), name);
+        }
     }
 }
\ No newline at end of file
index 5e32d27fe1885d38de2fa96fd1e905247cdb1d02..4f9f30fabb09d32c72ef90e6baf8b3542c581049 100755 (executable)
@@ -369,7 +369,7 @@ namespace Tizen.NUI.Binding
 
         event EventHandler<ResourcesChangedEventArgs> ValuesChanged;
 
-        // [Xaml.ProvideCompiled("Xamarin.Forms.Core.XamlC.RDSourceTypeConverter")]
+        [Xaml.ProvideCompiled("Tizen.NUI.Xaml.Core.XamlC.RDSourceTypeConverter")]
         internal class RDSourceTypeConverter : TypeConverter, IExtendedTypeConverter
         {
             object IExtendedTypeConverter.ConvertFromInvariantString(string value, IServiceProvider serviceProvider)
index c8c4745149e944d517e85f7ff0d17bacb5c39597..9dc577e6a5030af7ca8f3bf20cd6ac446e0b2029 100755 (executable)
+using System.Collections.Generic;
 using System.ComponentModel;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Xaml;
 using static Tizen.NUI.Animation;
 
 namespace Tizen.NUI
 {
+    /// <since_tizen> 5 </since_tizen>
     /// 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 class Transition : BaseHandle
+    public class AnimationBehavior
     {
-        private string name;
-
+        private string _key = null;
+        /// <since_tizen> 5 </since_tizen>
         /// 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 string Name
+        public string Key
         {
             get
             {
-                return name;
+                return _key;
             }
             set
             {
-                name = value;
+                _key = value;
             }
         }
 
-        private int duration;
+        private string _property = null;
 
+        /// <since_tizen> 5 </since_tizen>
         /// 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 int Duration
+        public string Property
         {
             get
             {
-                return duration;
+                return _property;
             }
             set
             {
-                duration = value;
+                _property = value;
             }
         }
 
-        private int loopCount;
+        private string _destValue = null;
 
+        /// <since_tizen> 5 </since_tizen>
         /// 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 int LoopCount
+        public string DestValue
         {
             get
             {
-                return loopCount;
+                return _destValue;
             }
             set
             {
-                loopCount = value;
+                _destValue = value;
             }
         }
 
-        private EndActions endAction;
+        private int _startTime = -1;
 
+        /// <since_tizen> 5 </since_tizen>
         /// 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 EndActions EndAction
+        public int StartTime
         {
             get
             {
-                return endAction;
+                return _startTime;
             }
             set
             {
-                endAction = value;
+                _startTime = value;
             }
         }
 
-        private string[] _properties = null;
+        private int _endTime = -1;
 
+        /// <since_tizen> 5 </since_tizen>
         /// 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 string[] Properties
+        public int EndTime
         {
             get
             {
-                return _properties;
+                return _endTime;
             }
             set
             {
-                _properties = value;
+                _endTime = value;
             }
         }
+    }
 
-        private string[] _destValue = null;
+    /// <since_tizen> 5 </since_tizen>
+    /// 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 class Transition : Animation
+    {
+        private string name;
 
+        /// <since_tizen> 5 </since_tizen>
         /// 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 string[] DestValue
+        public string Name
         {
             get
             {
-                return _destValue;
+                return name;
             }
             set
             {
-                _destValue = value;
+                name = value;
             }
         }
 
-        private int[] _startTime = null;
+        private Dictionary<string, AnimationBehavior> behaviors = new Dictionary<string, AnimationBehavior>();
 
+        /// <since_tizen> 5 </since_tizen>
         /// 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 int[] StartTime
+        public AnimationBehavior[] Behaviors
         {
-            get
-            {
-                return _startTime;
-            }
             set
             {
-                _startTime = value;
+                if (null != value)
+                {
+                    foreach (AnimationBehavior behavior in value)
+                    {
+                        behaviors.Add(behavior.Key, behavior);
+                    }
+                }
             }
         }
 
-        private int[] _endTime = null;
-
+        /// <since_tizen> 5 </since_tizen>
         /// 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 int[] EndTime
+        public void AnimateTo(View instance, string behaviorKey)
         {
-            get
+            AnimationBehavior behavior = null;
+            behaviors.TryGetValue(behaviorKey, out behavior);
+
+            if (null != behavior)
             {
-                return _endTime;
+                var elementType = instance.GetType();
+                PropertyInfo propertyInfo = elementType.GetProperties().FirstOrDefault(fi => fi.Name == behavior.Property);
+
+                if (propertyInfo != null)
+                {
+                    object destinationValue = ConvertTo(behavior.DestValue, propertyInfo.PropertyType);
+
+                    if (destinationValue != null)
+                    {
+                        if (0 <= behavior.StartTime)
+                        {
+                            AnimateTo(instance, behavior.Property, destinationValue, behavior.StartTime, behavior.EndTime);
+                        }
+                        else
+                        {
+                            AnimateTo(instance, behavior.Property, destinationValue);
+                        }
+                    }
+                }
             }
-            set
+            else
             {
-                _endTime = value;
+                throw new XamlParseException(string.Format("Behaviors don't have key {0}", behaviorKey), new XmlLineInfo());
             }
         }
 
+        /// <since_tizen> 5 </since_tizen>
         /// 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 Animation CreateAnimation()
+        public void AnimateBy(View instance, string behaviorKey)
         {
-            Animation ani = new Animation();
+            AnimationBehavior behavior = null;
+            behaviors.TryGetValue(behaviorKey, out behavior);
 
-            ani.Duration = Duration;
-            ani.LoopCount = LoopCount;
-            ani.EndAction = EndAction;
+            if (null != behavior)
+            {
+                var elementType = instance.GetType();
+                PropertyInfo propertyInfo = elementType.GetProperties().FirstOrDefault(fi => fi.Name == behavior.Property);
 
-            ani.Properties = Properties;
-            ani.DestValue = DestValue;
-            ani.StartTime = StartTime;
-            ani.EndTime = EndTime;
+                if (propertyInfo != null)
+                {
+                    object destinationValue = ConvertTo(behavior.DestValue, propertyInfo.PropertyType);
 
-            return ani;
+                    if (destinationValue != null)
+                    {
+                        if (0 <= behavior.StartTime)
+                        {
+                            AnimateBy(instance, behavior.Property, destinationValue, behavior.StartTime, behavior.EndTime);
+                        }
+                        else
+                        {
+                            AnimateBy(instance, behavior.Property, destinationValue);
+                        }
+                    }
+                }
+            }
+            else
+            {
+                throw new XamlParseException(string.Format("Behaviors don't have key {0}", behaviorKey), new XmlLineInfo());
+            }
         }
     }
 }
\ No newline at end of file