</PropertyGroup>
<ItemGroup>
- <ProjectReference Include="..\Tizen.NUI\Tizen.NUI.csproj" />
+ <Folder Include="lib\" />
</ItemGroup>
<ItemGroup>
- <Folder Include="lib\" />
+ <ProjectReference Include="..\Tizen.NUI.Xaml\Tizen.NUI.Xaml.csproj" />
</ItemGroup>
<ItemGroup>
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{837994B4-B99D-4EFE-B6FF-1BE17EE78711}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.NUI.Xaml", "..\Tizen.NUI.Xaml\Tizen.NUI.Xaml.csproj", "{7940BB09-D1C6-45BC-A220-723F823C3DFB}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
{837994B4-B99D-4EFE-B6FF-1BE17EE78711}.Release|x64.Build.0 = Release|Any CPU
{837994B4-B99D-4EFE-B6FF-1BE17EE78711}.Release|x86.ActiveCfg = Release|Any CPU
{837994B4-B99D-4EFE-B6FF-1BE17EE78711}.Release|x86.Build.0 = Release|Any CPU
+ {7940BB09-D1C6-45BC-A220-723F823C3DFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7940BB09-D1C6-45BC-A220-723F823C3DFB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7940BB09-D1C6-45BC-A220-723F823C3DFB}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {7940BB09-D1C6-45BC-A220-723F823C3DFB}.Debug|x64.Build.0 = Debug|Any CPU
+ {7940BB09-D1C6-45BC-A220-723F823C3DFB}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {7940BB09-D1C6-45BC-A220-723F823C3DFB}.Debug|x86.Build.0 = Debug|Any CPU
+ {7940BB09-D1C6-45BC-A220-723F823C3DFB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7940BB09-D1C6-45BC-A220-723F823C3DFB}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7940BB09-D1C6-45BC-A220-723F823C3DFB}.Release|x64.ActiveCfg = Release|Any CPU
+ {7940BB09-D1C6-45BC-A220-723F823C3DFB}.Release|x64.Build.0 = Release|Any CPU
+ {7940BB09-D1C6-45BC-A220-723F823C3DFB}.Release|x86.ActiveCfg = Release|Any CPU
+ {7940BB09-D1C6-45BC-A220-723F823C3DFB}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
using System.ComponentModel;
using Microsoft.Windows.Design;
using Tizen.NUI.BaseComponents;
-using Tizen.NUI.Binding;
+using Tizen.NUI.XamlBinding;
namespace Tizen.NUI.Design
{
using System.Reflection;
using Tizen.NUI.BaseComponents;
using Tizen.NUI.UIComponents;
+using Tizen.NUI.Xaml;
namespace Tizen.NUI
{
--- /dev/null
+using System.Runtime.CompilerServices;
+
+using Tizen.NUI.XamlBinding;
+using Tizen.NUI.Xaml;
+
+[assembly: XamlCompilationAttribute(XamlCompilationOptions.Compile)]
+
+[assembly: XmlnsDefinition("http://tizen.org/Tizen.NUI/2018/XAML", "Tizen.NUI")]
+[assembly: XmlnsDefinition("http://tizen.org/Tizen.NUI/2018/XAML", "Tizen.NUI.Xaml.Forms.BaseComponents")]
+[assembly: XmlnsDefinition("http://tizen.org/Tizen.NUI/2018/XAML", "Tizen.NUI.UIComponents")]
+[assembly: XmlnsDefinition("http://tizen.org/Tizen.NUI/2018/XAML", "Tizen.NUI.Xaml")]
+[assembly: XmlnsDefinition("http://tizen.org/Tizen.NUI/2018/XAML", "Tizen.NUI.XamlBinding")]
+[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml", "Tizen.NUI.Xaml")]
+[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml", "System", AssemblyName = "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
+[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml", "System", AssemblyName = "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
+[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2009/xaml", "Tizen.NUI.Xaml")]
+[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2009/xaml", "System", AssemblyName = "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
+[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2009/xaml", "System", AssemblyName = "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
--- /dev/null
+using System.Reflection;
+
+//[assembly: AssemblyCompany("Tizen.NUI.Xaml Inc.")]
+//[assembly: AssemblyProduct("Tizen.NUI.Xaml")]
+[assembly: AssemblyCopyright("Copyright ?Xamarin Inc. 2013-2017")]
+[assembly: AssemblyTrademark("")]
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <TargetFramework>netstandard2.0</TargetFramework>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <ProjectReference Include="..\Tizen.NUI\Tizen.NUI.csproj" />
+ </ItemGroup>
+
+ <Target Name="ChangeAliasesOfStrongNameAssemblies" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences">
+ <ItemGroup>
+ <ReferencePath Condition="'%(FileName)' == 'Tizen.System.SystemSettings'">
+ <Aliases>TizenSystemSettings</Aliases>
+ </ReferencePath>
+ </ItemGroup>
+ </Target>
+
+</Project>
\ No newline at end of file
--- /dev/null
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.26430.12
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.NUI.Xaml", "Tizen.NUI.Xaml.csproj", "{473C3BEC-2F67-4285-85FC-BF4E96BFFF1C}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.System.SystemSettings", "..\Tizen.System.SystemSettings\Tizen.System.SystemSettings.csproj", "{8D71B1B6-9901-436F-8914-9F812E1B10A7}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{33B7EFD5-0050-416D-A2D1-8F18F26F106D}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{1C550C1F-9370-42FF-86FA-EDCD6262B258}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Common", "..\Tizen.Applications.Common\Tizen.Applications.Common.csproj", "{2AEDCAA7-543F-48A1-BEA3-CF3E14F6EDC2}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.NUI", "..\Tizen.NUI\Tizen.NUI.csproj", "{B5CEBFFC-3355-408A-8F99-3DE922271F72}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {473C3BEC-2F67-4285-85FC-BF4E96BFFF1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {473C3BEC-2F67-4285-85FC-BF4E96BFFF1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {473C3BEC-2F67-4285-85FC-BF4E96BFFF1C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {473C3BEC-2F67-4285-85FC-BF4E96BFFF1C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8D71B1B6-9901-436F-8914-9F812E1B10A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8D71B1B6-9901-436F-8914-9F812E1B10A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8D71B1B6-9901-436F-8914-9F812E1B10A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8D71B1B6-9901-436F-8914-9F812E1B10A7}.Release|Any CPU.Build.0 = Release|Any CPU
+ {33B7EFD5-0050-416D-A2D1-8F18F26F106D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {33B7EFD5-0050-416D-A2D1-8F18F26F106D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {33B7EFD5-0050-416D-A2D1-8F18F26F106D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {33B7EFD5-0050-416D-A2D1-8F18F26F106D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1C550C1F-9370-42FF-86FA-EDCD6262B258}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1C550C1F-9370-42FF-86FA-EDCD6262B258}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1C550C1F-9370-42FF-86FA-EDCD6262B258}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1C550C1F-9370-42FF-86FA-EDCD6262B258}.Release|Any CPU.Build.0 = Release|Any CPU
+ {2AEDCAA7-543F-48A1-BEA3-CF3E14F6EDC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2AEDCAA7-543F-48A1-BEA3-CF3E14F6EDC2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2AEDCAA7-543F-48A1-BEA3-CF3E14F6EDC2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2AEDCAA7-543F-48A1-BEA3-CF3E14F6EDC2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B5CEBFFC-3355-408A-8F99-3DE922271F72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B5CEBFFC-3355-408A-8F99-3DE922271F72}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B5CEBFFC-3355-408A-8F99-3DE922271F72}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B5CEBFFC-3355-408A-8F99-3DE922271F72}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {F532FBB4-80FB-46CE-A5EC-4E1333BF2622}
+ EndGlobalSection
+EndGlobal
--- /dev/null
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Xml;
+using Tizen.NUI.XamlBinding.Internals;
+using Tizen.NUI.XamlBinding;
+using Tizen.NUI.StyleSheets;
+
+using static System.String;
+
+namespace Tizen.NUI.Xaml
+{
+ internal class ApplyPropertiesVisitor : IXamlNodeVisitor
+ {
+ public static readonly IList<XmlName> Skips = new List<XmlName> {
+ XmlName.xKey,
+ XmlName.xTypeArguments,
+ XmlName.xArguments,
+ XmlName.xFactoryMethod,
+ XmlName.xName,
+ XmlName.xDataType
+ };
+
+ public ApplyPropertiesVisitor(HydrationContext context, bool stopOnResourceDictionary = false)
+ {
+ Context = context;
+ StopOnResourceDictionary = stopOnResourceDictionary;
+ }
+
+ Dictionary<INode, object> Values => Context.Values;
+ HydrationContext Context { get; }
+
+ public TreeVisitingMode VisitingMode => TreeVisitingMode.BottomUp;
+ public bool StopOnDataTemplate => true;
+ 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)
+ {
+ var parentElement = parentNode as IElementNode;
+ var value = Values [node];
+ var source = Values [parentNode];
+ XmlName propertyName;
+
+ if (TryGetPropertyName(node, parentNode, out propertyName)) {
+ if (TrySetRuntimeName(propertyName, source, value, node))
+ return;
+ if (Skips.Contains(propertyName))
+ return;
+ if (parentElement.SkipProperties.Contains(propertyName))
+ return;
+ if (propertyName.Equals(XamlParser.McUri, "Ignorable"))
+ return;
+ SetPropertyValue(source, propertyName, value, Context.RootElement, node, Context, node);
+ } else if (IsCollectionItem(node, parentNode) && parentNode is IElementNode) {
+ // Collection element, implicit content, or implicit collection element.
+ var contentProperty = GetContentPropertyName(Context.Types[parentElement].GetTypeInfo());
+ if (contentProperty != null) {
+ var name = new XmlName(((ElementNode)parentNode).NamespaceURI, contentProperty);
+ if (Skips.Contains(name))
+ return;
+ if (parentElement.SkipProperties.Contains(propertyName))
+ return;
+ SetPropertyValue(source, name, value, Context.RootElement, node, Context, node);
+ }
+ }
+ }
+
+ public void Visit(MarkupNode node, INode parentNode)
+ {
+ }
+
+ public void Visit(ElementNode node, INode parentNode)
+ {
+ XmlName propertyName;
+ if (TryGetPropertyName(node, parentNode, out propertyName) && propertyName == XmlName._CreateContent) {
+ var s0 = Values[parentNode];
+ if (s0 is ElementTemplate) {
+ SetTemplate(s0 as ElementTemplate, node);
+ return;
+ }
+ }
+
+ var parentElement = parentNode as IElementNode;
+ propertyName = XmlName.Empty;
+
+ //Simplify ListNodes with single elements
+ var pList = parentNode as ListNode;
+ if (pList != null && pList.CollectionItems.Count == 1) {
+ propertyName = pList.XmlName;
+ parentNode = parentNode.Parent;
+ parentElement = parentNode as IElementNode;
+ }
+
+ var value = Values[node];
+
+ if (propertyName != XmlName.Empty || TryGetPropertyName(node, parentNode, out propertyName)) {
+ if (Skips.Contains(propertyName))
+ return;
+ if (parentElement == null)
+ return;
+ if (parentElement.SkipProperties.Contains(propertyName))
+ return;
+
+ var source = Values[parentNode];
+ ProvideValue(ref value, node, source, propertyName);
+ SetPropertyValue(source, propertyName, value, Context.RootElement, node, Context, node);
+ }
+ else if (IsCollectionItem(node, parentNode) && parentNode is IElementNode) {
+ var source = Values[parentNode];
+ ProvideValue(ref value, node, source, XmlName.Empty);
+ string contentProperty;
+ Exception xpe = null;
+ var xKey = node.Properties.ContainsKey(XmlName.xKey) ? ((ValueNode)node.Properties[XmlName.xKey]).Value as string : null;
+
+ //ResourceDictionary
+ if (xpe == null && TryAddToResourceDictionary(source as ResourceDictionary, value, xKey, node, out xpe))
+ return;
+
+ // Collection element, implicit content, or implicit collection element.
+ if (xpe == null && typeof(IEnumerable).IsAssignableFrom(Context.Types[parentElement]) && Context.Types[parentElement].GetRuntimeMethods().Any(mi => mi.Name == "Add" && mi.GetParameters().Length == 1)) {
+ var addMethod =
+ Context.Types[parentElement].GetRuntimeMethods().First(mi => mi.Name == "Add" && mi.GetParameters().Length == 1);
+
+ addMethod?.Invoke(source, new[] { value });
+ return;
+ }
+ if (xpe == null && (contentProperty = GetContentPropertyName(Context.Types[parentElement].GetTypeInfo())) != null) {
+ var name = new XmlName(node.NamespaceURI, contentProperty);
+ if (Skips.Contains(name))
+ return;
+ if (parentElement.SkipProperties.Contains(propertyName))
+ return;
+
+ SetPropertyValue(source, name, value, Context.RootElement, node, Context, node);
+ return;
+ }
+ if (xpe == null && Context.Types[parentElement].GetRuntimeMethods().Any(mi => mi.Name == "Add" && mi.GetParameters().Length == 1))
+ {
+ //if there are similar parameters in the function, this will exist issue.
+ var addMethod = Context.Types[parentElement].GetRuntimeMethods().First(mi => mi.Name == "Add" && mi.GetParameters().Length == 1);
+ if(addMethod != null) addMethod.Invoke(source, new[] { value });
+ return;
+ }
+ xpe = xpe ?? new XamlParseException($"Can not set the content of {((IElementNode)parentNode).XmlType.Name} as it doesn't have a ContentPropertyAttribute", node);
+ if (Context.ExceptionHandler != null)
+ Context.ExceptionHandler(xpe);
+ throw xpe;
+ }
+ else if (IsCollectionItem(node, parentNode) && parentNode is ListNode) {
+ var source = Values[parentNode.Parent];
+ ProvideValue(ref value, node, source, XmlName.Empty);
+ var parentList = (ListNode)parentNode;
+ if (Skips.Contains(parentList.XmlName))
+ return;
+ Exception xpe = null;
+ var xKey = node.Properties.ContainsKey(XmlName.xKey) ? ((ValueNode)node.Properties[XmlName.xKey]).Value as string : null;
+
+ object _;
+ var collection = GetPropertyValue(source, parentList.XmlName, Context, parentList, out _) as IEnumerable;
+ if (collection == null)
+ xpe = new XamlParseException($"Property {parentList.XmlName.LocalName} is null or is not IEnumerable", node);
+
+ if (xpe == null && TryAddToResourceDictionary(collection as ResourceDictionary, value, xKey, node, out xpe))
+ return;
+
+ MethodInfo addMethod;
+ if (xpe == null && (addMethod = collection.GetType().GetRuntimeMethods().First(mi => mi.Name == "Add" && mi.GetParameters().Length == 1)) != null) {
+ addMethod.Invoke(collection, new[] { Values[node] });
+ return;
+ }
+ xpe = xpe ?? new XamlParseException($"Value of {parentList.XmlName.LocalName} does not have a Add() method", node);
+ if (Context.ExceptionHandler != null)
+ Context.ExceptionHandler(xpe);
+ else
+ throw xpe;
+ }
+ }
+
+
+
+ public void Visit(RootNode node, INode parentNode)
+ {
+ }
+
+ public void Visit(ListNode node, INode parentNode)
+ {
+ }
+
+ public static bool TryGetPropertyName(INode node, INode parentNode, out XmlName name)
+ {
+ name = default(XmlName);
+ var parentElement = parentNode as IElementNode;
+ if (parentElement == null)
+ return false;
+ foreach (var kvp in parentElement.Properties) {
+ if (kvp.Value != node)
+ continue;
+ name = kvp.Key;
+ return true;
+ }
+ return false;
+ }
+
+ internal static bool IsCollectionItem(INode node, INode parentNode)
+ {
+ var parentList = parentNode as IListNode;
+ if (parentList == null)
+ return false;
+ return parentList.CollectionItems.Contains(node);
+ }
+
+ internal static string GetContentPropertyName(System.Reflection.TypeInfo typeInfo)
+ {
+ while (typeInfo != null) {
+ var propName = GetContentPropertyName(typeInfo.CustomAttributes);
+ if (propName != null)
+ return propName;
+ typeInfo = typeInfo?.BaseType?.GetTypeInfo();
+ }
+ return null;
+ }
+
+ void ProvideValue(ref object value, ElementNode node, object source, XmlName propertyName)
+ {
+ var markupExtension = value as IMarkupExtension;
+ var valueProvider = value as IValueProvider;
+
+ if (markupExtension == null && valueProvider == null)
+ return;
+
+ XamlServiceProvider serviceProvider = null;
+ if (value.GetType().GetTypeInfo().GetCustomAttribute<AcceptEmptyServiceProviderAttribute>() == null)
+ serviceProvider = new XamlServiceProvider(node, Context);
+
+ if (serviceProvider != null && serviceProvider.IProvideValueTarget != null && propertyName != XmlName.Empty) {
+ ((XamlValueTargetProvider)serviceProvider.IProvideValueTarget).TargetProperty = GetTargetProperty(source, propertyName, Context, node);
+ }
+
+ if (markupExtension != null)
+ value = markupExtension.ProvideValue(serviceProvider);
+ else if (valueProvider != null)
+ value = valueProvider.ProvideValue(serviceProvider);
+ }
+
+ static string GetContentPropertyName(IEnumerable<CustomAttributeData> attributes)
+ {
+ var contentAttribute =
+ attributes.FirstOrDefault(cad => ContentPropertyAttribute.ContentPropertyTypes.Contains(cad.AttributeType.FullName));
+ if (contentAttribute == null || contentAttribute.ConstructorArguments.Count != 1)
+ return null;
+ if (contentAttribute.ConstructorArguments [0].ArgumentType == typeof(string))
+ return (string)contentAttribute.ConstructorArguments [0].Value;
+ return null;
+ }
+
+ static bool GetRealNameAndType(ref Type elementType, string namespaceURI, ref string localname,
+ HydrationContext context, IXmlLineInfo lineInfo)
+ {
+ var dotIdx = localname.IndexOf('.');
+ if (dotIdx > 0) {
+ var typename = localname.Substring(0, dotIdx);
+ localname = localname.Substring(dotIdx + 1);
+ XamlParseException xpe;
+ elementType = XamlParser.GetElementType(new XmlType(namespaceURI, typename, null), lineInfo,
+ context.RootElement.GetType().GetTypeInfo().Assembly, out xpe);
+
+ if (xpe != null)
+ throw xpe;
+ return true;
+ }
+ return false;
+ }
+
+ static BindableProperty GetBindableProperty(Type elementType, string localName, IXmlLineInfo lineInfo,
+ bool throwOnError = false)
+ {
+#if NETSTANDARD1_0
+ var bindableFieldInfo = elementType.GetFields().FirstOrDefault(fi => fi.Name == localName + "Property");
+#else
+ 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) {
+ exception =
+ new XamlParseException(
+ Format("BindableProperty {0} not found on {1}", localName + "Property", elementType.Name), lineInfo);
+ }
+
+ if (exception == null)
+ return bindableFieldInfo.GetValue(null) as BindableProperty;
+ if (throwOnError)
+ throw exception;
+ return null;
+ }
+
+ static object GetTargetProperty(object xamlelement, XmlName propertyName, HydrationContext context, IXmlLineInfo lineInfo)
+ {
+ var localName = propertyName.LocalName;
+ //If it's an attached BP, update elementType and propertyName
+ var bpOwnerType = xamlelement.GetType();
+ GetRealNameAndType(ref bpOwnerType, propertyName.NamespaceURI, ref localName, context, lineInfo);
+ var property = GetBindableProperty(bpOwnerType, localName, lineInfo, false);
+
+ if (property != null)
+ return property;
+
+ var elementType = xamlelement.GetType();
+ var propertyInfo = elementType.GetRuntimeProperties().FirstOrDefault(p => p.Name == localName);
+ return propertyInfo;
+ }
+
+ public static void SetPropertyValue(object xamlelement, XmlName propertyName, object value, object rootElement, INode node, HydrationContext context, IXmlLineInfo lineInfo)
+ {
+ var localName = propertyName.LocalName;
+ var serviceProvider = new XamlServiceProvider(node, context);
+ Exception xpe = null;
+ var xKey = node is IElementNode && ((IElementNode)node).Properties.ContainsKey(XmlName.xKey) ? ((ValueNode)((IElementNode)node).Properties[XmlName.xKey]).Value as string : null;
+
+ //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
+ if (xpe == null && TryConnectEvent(xamlelement, localName, attached, value, rootElement, lineInfo, out xpe))
+ return;
+
+ //If Value is DynamicResource and it's a BP, SetDynamicResource
+ if (xpe == null && TrySetDynamicResource(xamlelement, property, value, lineInfo, out xpe))
+ return;
+
+ //If value is BindingBase, SetBinding
+ if (xpe == null && TrySetBinding(xamlelement, property, localName, value, lineInfo, out xpe))
+ return;
+
+ //If it's a BindableProberty, SetValue
+ if (xpe == null && TrySetValue(xamlelement, property, attached, value, lineInfo, serviceProvider, out xpe))
+ return;
+
+ //If we can assign that value to a normal property, let's do it
+ if (xpe == null && TrySetProperty(xamlelement, localName, value, lineInfo, serviceProvider, context, out xpe))
+ return;
+
+ //If it's an already initialized property, add to it
+ if (xpe == null && TryAddToProperty(xamlelement, propertyName, value, xKey, lineInfo, serviceProvider, context, out xpe))
+ return;
+
+ xpe = xpe ?? new XamlParseException($"Cannot assign property \"{localName}\": Property does not exist, or is not assignable, or mismatching type between value and property", lineInfo);
+ if (context.ExceptionHandler != null)
+ context.ExceptionHandler(xpe);
+ else
+ throw xpe;
+ }
+
+ public static object GetPropertyValue(object xamlElement, XmlName propertyName, HydrationContext context, IXmlLineInfo lineInfo, out object targetProperty)
+ {
+ var localName = propertyName.LocalName;
+ Exception xpe = null;
+ object value;
+ targetProperty = null;
+
+ //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 it's a BindableProberty, GetValue
+ if (xpe == null && TryGetValue(xamlElement, property, attached, out value, lineInfo, out xpe, out targetProperty))
+ return value;
+
+ //If it's a normal property, get it
+ if (xpe == null && TryGetProperty(xamlElement, localName, out value, lineInfo, context, out xpe, out targetProperty))
+ return value;
+
+ xpe = xpe ?? new XamlParseException($"Property {localName} is not found or does not have an accessible getter", lineInfo);
+ if (context.ExceptionHandler != null)
+ context.ExceptionHandler(xpe);
+ else
+ throw xpe;
+
+ return null;
+ }
+
+ static bool TryConnectEvent(object element, string localName, bool attached, object value, object rootElement, IXmlLineInfo lineInfo, out Exception exception)
+ {
+ exception = null;
+
+ if (attached)
+ return false;
+
+ var elementType = element.GetType();
+ var eventInfo = elementType.GetRuntimeEvent(localName);
+ var stringValue = value as string;
+
+ if (eventInfo == null || IsNullOrEmpty(stringValue))
+ return false;
+
+ var methodInfo = rootElement.GetType().GetRuntimeMethods().FirstOrDefault(mi => mi.Name == (string)value);
+ if (methodInfo == null) {
+ exception = new XamlParseException($"No method {value} found on type {rootElement.GetType()}", lineInfo);
+ return false;
+ }
+
+ try {
+ eventInfo.AddEventHandler(element, methodInfo.CreateDelegate(eventInfo.EventHandlerType, rootElement));
+ return true;
+ } catch (ArgumentException ae) {
+ exception = new XamlParseException($"Method {stringValue} does not have the correct signature", lineInfo, ae);
+ }
+ return false;
+ }
+
+ static bool TrySetDynamicResource(object element, BindableProperty property, object value, IXmlLineInfo lineInfo, out Exception exception)
+ {
+ exception = null;
+
+ var elementType = element.GetType();
+ var dynamicResource = value as DynamicResource;
+ var bindable = element as BindableObject;
+
+ if (dynamicResource == null || property == null)
+ return false;
+
+ if (bindable == null) {
+ exception = new XamlParseException($"{elementType.Name} is not a BindableObject", lineInfo);
+ return false;
+ }
+
+ bindable.SetDynamicResource(property, dynamicResource.Key);
+ return true;
+ }
+
+ static bool TrySetBinding(object element, BindableProperty property, string localName, object value, IXmlLineInfo lineInfo, out Exception exception)
+ {
+ exception = null;
+
+ var elementType = element.GetType();
+ var binding = value.ConvertTo(typeof(BindingBase),pinfoRetriever:null,serviceProvider:null) as BindingBase;
+ var bindable = element as BindableObject;
+ var nativeBindingService = DependencyService.Get<INativeBindingService>();
+
+ if (binding == null)
+ return false;
+
+ if (bindable != null && property != null) {
+ bindable.SetBinding(property, binding);
+ return true;
+ }
+
+ if (nativeBindingService != null && property != null && nativeBindingService.TrySetBinding(element, property, binding))
+ return true;
+
+ if (nativeBindingService != null && nativeBindingService.TrySetBinding(element, localName, binding))
+ return true;
+
+ if (property != null)
+ exception = new XamlParseException($"{elementType.Name} is not a BindableObject or does not support native bindings", lineInfo);
+
+ return false;
+ }
+
+ static bool TrySetValue(object element, BindableProperty property, bool attached, object value, IXmlLineInfo lineInfo, XamlServiceProvider serviceProvider, out Exception exception)
+ {
+ exception = null;
+
+ var elementType = element.GetType();
+ var bindable = element as BindableObject;
+ var nativeBindingService = DependencyService.Get<INativeBindingService>();
+
+ if (property == null)
+ return false;
+
+ if (serviceProvider != null && serviceProvider.IProvideValueTarget != null)
+ ((XamlValueTargetProvider)serviceProvider.IProvideValueTarget).TargetProperty = property;
+
+ Func<MemberInfo> minforetriever;
+ if (attached)
+ minforetriever = () => property.DeclaringType.GetRuntimeMethod("Get" + property.PropertyName, new [] { typeof(BindableObject) });
+ else
+ {
+ minforetriever = () => property.DeclaringType.GetRuntimeProperties().LastOrDefault(p => p.Name == property.PropertyName);
+ }
+ //minforetriever = () => property.DeclaringType.GetRuntimeProperty(property.PropertyName);
+ var convertedValue = value.ConvertTo(property.ReturnType, minforetriever, serviceProvider);
+
+ if (bindable != null) {
+ //SetValue doesn't throw on mismatching type, so check before to get a chance to try the property setting or the collection adding
+ var nullable = property.ReturnTypeInfo.IsGenericType &&
+ property.ReturnTypeInfo.GetGenericTypeDefinition() == typeof(Nullable<>);
+ if ((convertedValue == null && (!property.ReturnTypeInfo.IsValueType || nullable)) ||
+ (property.ReturnType.IsInstanceOfType(convertedValue))) {
+ bindable.SetValue(property, convertedValue);
+ return true;
+ }
+
+ // This might be a collection; see if we can add to it
+ return TryAddValue(bindable, property, value, serviceProvider);
+ }
+
+ if (nativeBindingService != null && nativeBindingService.TrySetValue(element, property, convertedValue))
+ return true;
+
+ exception = new XamlParseException($"{elementType.Name} is not a BindableObject or does not support setting native BindableProperties", lineInfo);
+ return false;
+ }
+
+ static bool TryGetValue(object element, BindableProperty property, bool attached, out object value, IXmlLineInfo lineInfo, out Exception exception, out object targetProperty)
+ {
+ exception = null;
+ value = null;
+ targetProperty = property;
+ var elementType = element.GetType();
+ var bindable = element as BindableObject;
+
+ if (property == null)
+ return false;
+
+ if (bindable == null)
+ return false;
+
+ value = bindable.GetValue(property);
+ return true;
+ }
+
+ static bool TrySetProperty(object element, string localName, object value, IXmlLineInfo lineInfo, XamlServiceProvider serviceProvider, HydrationContext context, out Exception exception)
+ {
+ exception = null;
+
+ var elementType = element.GetType();
+ var propertyInfo = elementType.GetRuntimeProperties().FirstOrDefault(p => p.Name == localName);
+ MethodInfo setter;
+ if (propertyInfo == null || !propertyInfo.CanWrite || (setter = propertyInfo.SetMethod) == null)
+ return false;
+
+ if (!IsVisibleFrom(setter, context.RootElement))
+ return false;
+
+ if (serviceProvider != null && serviceProvider.IProvideValueTarget != null)
+ ((XamlValueTargetProvider)serviceProvider.IProvideValueTarget).TargetProperty = propertyInfo;
+
+ object convertedValue = value.ConvertTo(propertyInfo.PropertyType, () => propertyInfo, serviceProvider);
+ if (convertedValue != null && !propertyInfo.PropertyType.IsInstanceOfType(convertedValue))
+ return false;
+
+ setter.Invoke(element, new object [] { convertedValue });
+ return true;
+ }
+
+ static bool TryGetProperty(object element, string localName, out object value, IXmlLineInfo lineInfo, HydrationContext context, out Exception exception, out object targetProperty)
+ {
+ exception = null;
+ value = null;
+ var elementType = element.GetType();
+ PropertyInfo propertyInfo = null;
+ try {
+ propertyInfo = elementType.GetRuntimeProperty(localName);
+ } catch (AmbiguousMatchException) {
+ // Get most derived instance of property
+ foreach (var property in elementType.GetRuntimeProperties().Where(prop => prop.Name == localName)) {
+ if (propertyInfo == null || propertyInfo.DeclaringType.IsAssignableFrom(property.DeclaringType))
+ propertyInfo = property;
+ }
+ }
+ MethodInfo getter;
+ targetProperty = propertyInfo;
+ if (propertyInfo == null || !propertyInfo.CanRead || (getter = propertyInfo.GetMethod) == null)
+ return false;
+
+ if (!IsVisibleFrom(getter, context.RootElement))
+ return false;
+
+ value = getter.Invoke(element, new object[] { });
+ return true;
+ }
+
+ static bool IsVisibleFrom(MethodInfo method, object rootElement)
+ {
+ if (method.IsPublic)
+ return true;
+ if (method.IsPrivate && method.DeclaringType == rootElement.GetType())
+ return true;
+ if ((method.IsAssembly || method.IsFamilyOrAssembly) && method.DeclaringType.AssemblyQualifiedName == rootElement.GetType().AssemblyQualifiedName)
+ return true;
+ if (method.IsFamily && method.DeclaringType.IsAssignableFrom(rootElement.GetType()))
+ return true;
+ return false;
+ }
+
+ static bool TryAddToProperty(object element, XmlName propertyName, object value, string xKey, IXmlLineInfo lineInfo, XamlServiceProvider serviceProvider, HydrationContext context, out Exception exception)
+ {
+ exception = null;
+
+ object targetProperty;
+ var collection = GetPropertyValue(element, propertyName, context, lineInfo, out targetProperty) as IEnumerable;
+
+ if (collection == null)
+ return false;
+
+ if (exception == null && TryAddToResourceDictionary(collection as ResourceDictionary, value, xKey, lineInfo, out exception))
+ return true;
+
+ if (exception != null)
+ return false;
+
+ var addMethod = collection.GetType().GetRuntimeMethods().First(mi => mi.Name == "Add" && mi.GetParameters().Length == 1);
+ if (addMethod == null)
+ return false;
+
+ if (serviceProvider != null && serviceProvider.IProvideValueTarget != null)
+ ((XamlValueTargetProvider)serviceProvider.IProvideValueTarget).TargetProperty = targetProperty;
+
+ addMethod.Invoke(collection, new [] { value.ConvertTo(addMethod.GetParameters() [0].ParameterType, (Func<TypeConverter>)null, serviceProvider) });
+ return true;
+ }
+
+ static bool TryAddToResourceDictionary(ResourceDictionary resourceDictionary, object value, string xKey, IXmlLineInfo lineInfo, out Exception exception)
+ {
+ exception = null;
+
+ if (resourceDictionary == null)
+ return false;
+
+ if (xKey != null)
+ resourceDictionary.Add(xKey, value);
+ else if (value is Tizen.NUI.XamlBinding.Style)
+ resourceDictionary.Add((Tizen.NUI.XamlBinding.Style)value);
+ else if (value is ResourceDictionary)
+ resourceDictionary.Add((ResourceDictionary)value);
+ else if (value is StyleSheets.StyleSheet)
+ resourceDictionary.Add((StyleSheets.StyleSheet)value);
+ else {
+ exception = new XamlParseException("resources in ResourceDictionary require a x:Key attribute", lineInfo);
+ return false;
+ }
+ return true;
+ }
+
+ void SetTemplate(ElementTemplate dt, INode node)
+ {
+#pragma warning disable 0612
+ ((IDataTemplate)dt).LoadTemplate = () => {
+#pragma warning restore 0612
+ var cnode = node.Clone();
+ var context = new HydrationContext { ParentContext = Context, RootElement = Context.RootElement };
+ cnode.Accept(new XamlNodeVisitor((n, parent) => n.Parent = parent), node.Parent); //set parents for {StaticResource}
+ cnode.Accept(new ExpandMarkupsVisitor(context), null);
+ cnode.Accept(new NamescopingVisitor(context), null);
+ cnode.Accept(new CreateValuesVisitor(context), null);
+ cnode.Accept(new RegisterXNamesVisitor(context), null);
+ cnode.Accept(new FillResourceDictionariesVisitor(context), null);
+ cnode.Accept(new ApplyPropertiesVisitor(context, true), null);
+ return context.Values [cnode];
+ };
+ }
+
+ static bool TryAddValue(BindableObject bindable, BindableProperty property, object value, XamlServiceProvider serviceProvider)
+ {
+ if(property?.ReturnTypeInfo?.GenericTypeArguments == null){
+ return false;
+ }
+
+ if(property.ReturnType == null){
+ return false;
+ }
+
+ if (property.ReturnTypeInfo.GenericTypeArguments.Length != 1 ||
+ !property.ReturnTypeInfo.GenericTypeArguments[0].IsInstanceOfType(value))
+ return false;
+
+ // This might be a collection we can add to; see if we can find an Add method
+ var addMethod = GetAllRuntimeMethods(property.ReturnType)
+ .FirstOrDefault(mi => mi.Name == "Add" && mi.GetParameters().Length == 1);
+ if (addMethod == null)
+ return false;
+
+ // If there's an add method, get the collection
+ var collection = bindable.GetValue(property);
+
+ // And add the new value to it
+ addMethod.Invoke(collection, new[] { value.ConvertTo(addMethod.GetParameters()[0].ParameterType, (Func<TypeConverter>)null, serviceProvider) });
+ return true;
+ }
+
+ static IEnumerable<MethodInfo> GetAllRuntimeMethods(Type type)
+ {
+ return type.GetRuntimeMethods()
+ .Concat(type.GetTypeInfo().ImplementedInterfaces.SelectMany(t => t.GetRuntimeMethods()));
+ }
+
+ bool TrySetRuntimeName(XmlName propertyName, object source, object value, ValueNode node)
+ {
+ if (propertyName != XmlName.xName)
+ return false;
+
+ var runTimeName = source.GetType().GetTypeInfo().GetCustomAttribute<RuntimeNamePropertyAttribute>();
+ if (runTimeName == null)
+ return false;
+
+ SetPropertyValue(source, new XmlName("", runTimeName.Name), value, Context.RootElement, node, Context, node);
+ return true;
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Reflection;
+using System.Xml;
+using Tizen.NUI.XamlBinding.Internals;
+using Tizen.NUI.XamlBinding;
+
+
+namespace Tizen.NUI.Xaml
+{
+ internal class CreateValuesVisitor : IXamlNodeVisitor
+ {
+ public CreateValuesVisitor(HydrationContext context)
+ {
+ Context = context;
+ }
+
+ Dictionary<INode, object> Values
+ {
+ get { return Context.Values; }
+ }
+
+ HydrationContext Context { get; }
+
+ public TreeVisitingMode VisitingMode => TreeVisitingMode.BottomUp;
+ 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)
+ {
+ Values[node] = node.Value;
+ }
+
+ public void Visit(MarkupNode node, INode parentNode)
+ {
+ }
+
+ public void Visit(ElementNode node, INode parentNode)
+ {
+ object value = null;
+
+ XamlParseException xpe;
+ var type = XamlParser.GetElementType(node.XmlType, node, Context.RootElement?.GetType().GetTypeInfo().Assembly,
+ out xpe);
+ if (xpe != null)
+ throw xpe;
+
+ Context.Types[node] = type;
+ string ctorargname;
+ if (IsXaml2009LanguagePrimitive(node))
+ value = CreateLanguagePrimitive(type, node);
+ else if (node.Properties.ContainsKey(XmlName.xArguments) || node.Properties.ContainsKey(XmlName.xFactoryMethod))
+ value = CreateFromFactory(type, node);
+ else if (
+ type.GetTypeInfo()
+ .DeclaredConstructors.Any(
+ ci =>
+ ci.IsPublic && ci.GetParameters().Length != 0 &&
+ ci.GetParameters().All(pi => pi.CustomAttributes.Any(attr => attr.AttributeType == typeof (ParameterAttribute)))) &&
+ ValidateCtorArguments(type, node, out ctorargname))
+ value = CreateFromParameterizedConstructor(type, node);
+ else if (!type.GetTypeInfo().DeclaredConstructors.Any(ci => ci.IsPublic && ci.GetParameters().Length == 0) &&
+ !ValidateCtorArguments(type, node, out ctorargname))
+ {
+ throw new XamlParseException($"The Property {ctorargname} is required to create a {type?.FullName} object.", node);
+ }
+ else
+ {
+ //this is a trick as the DataTemplate parameterless ctor is internal, and we can't CreateInstance(..., false) on WP7
+ try
+ {
+ if (type == typeof (DataTemplate))
+ value = new DataTemplate();
+ if (type == typeof (ControlTemplate))
+ value = new ControlTemplate();
+ if (value == null && node.CollectionItems.Any() && node.CollectionItems.First() is ValueNode)
+ {
+ var serviceProvider = new XamlServiceProvider(node, Context);
+ var converted = ((ValueNode)node.CollectionItems.First()).Value.ConvertTo(type, () => type.GetTypeInfo(),
+ serviceProvider);
+ if (converted != null && converted.GetType() == type)
+ value = converted;
+ }
+ if (value == null)
+ {
+ value = Activator.CreateInstance(type);
+ }
+ }
+ catch (TargetInvocationException e)
+ {
+ if (e.InnerException is XamlParseException || e.InnerException is XmlException)
+ throw e.InnerException;
+ throw;
+ }
+ }
+
+ Values[node] = value;
+
+ var markup = value as IMarkupExtension;
+ if (markup != null && (value is TypeExtension || value is StaticExtension || value is ArrayExtension))
+ {
+ var serviceProvider = new XamlServiceProvider(node, Context);
+
+ var visitor = new ApplyPropertiesVisitor(Context);
+ foreach (var cnode in node.Properties.Values.ToList())
+ cnode.Accept(visitor, node);
+ foreach (var cnode in node.CollectionItems)
+ cnode.Accept(visitor, node);
+
+ value = markup.ProvideValue(serviceProvider);
+
+ INode xKey;
+ if (!node.Properties.TryGetValue(XmlName.xKey, out xKey))
+ xKey = null;
+
+ node.Properties.Clear();
+ node.CollectionItems.Clear();
+
+ if (xKey != null)
+ node.Properties.Add(XmlName.xKey, xKey);
+
+ Values[node] = value;
+ }
+
+ if (value is BindableObject)
+ NameScope.SetNameScope(value as BindableObject, node.Namescope);
+ }
+
+ public void Visit(RootNode node, INode parentNode)
+ {
+ var rnode = (XamlLoader.RuntimeRootNode)node;
+ Values[node] = rnode.Root;
+ Context.Types[node] = rnode.Root.GetType();
+ var bindableRoot = rnode.Root as BindableObject;
+ if (bindableRoot != null)
+ NameScope.SetNameScope(bindableRoot, node.Namescope);
+ }
+
+ public void Visit(ListNode node, INode parentNode)
+ {
+ //this is a gross hack to keep ListNode alive. ListNode must go in favor of Properties
+ XmlName name;
+ if (ApplyPropertiesVisitor.TryGetPropertyName(node, parentNode, out name))
+ node.XmlName = name;
+ }
+
+ bool ValidateCtorArguments(Type nodeType, IElementNode node, out string missingArgName)
+ {
+ missingArgName = null;
+ var ctorInfo =
+ nodeType.GetTypeInfo()
+ .DeclaredConstructors.FirstOrDefault(
+ ci =>
+ ci.GetParameters().Length != 0 && ci.IsPublic &&
+ ci.GetParameters().All(pi => pi.CustomAttributes.Any(attr => attr.AttributeType == typeof (ParameterAttribute))));
+ if (ctorInfo == null)
+ return true;
+ foreach (var parameter in ctorInfo.GetParameters())
+ {
+ // Modify the namespace
+ var propname =
+ parameter.CustomAttributes.First(ca => ca.AttributeType.FullName == "Tizen.NUI.XamlBinding.ParameterAttribute")?
+ .ConstructorArguments.First()
+ .Value as string;
+ if (!node.Properties.ContainsKey(new XmlName("", propname)))
+ {
+ missingArgName = propname;
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public object CreateFromParameterizedConstructor(Type nodeType, IElementNode node)
+ {
+ var ctorInfo =
+ nodeType.GetTypeInfo()
+ .DeclaredConstructors.FirstOrDefault(
+ ci =>
+ ci.GetParameters().Length != 0 && ci.IsPublic &&
+ ci.GetParameters().All(pi => pi.CustomAttributes.Any(attr => attr.AttributeType == typeof (ParameterAttribute))));
+ object[] arguments = CreateArgumentsArray(node, ctorInfo);
+
+ if (arguments != null)
+ {
+ return ctorInfo?.Invoke(arguments);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public object CreateFromFactory(Type nodeType, IElementNode node)
+ {
+ object[] arguments = CreateArgumentsArray(node);
+
+ if (!node.Properties.ContainsKey(XmlName.xFactoryMethod))
+ {
+ //non-default ctor
+ return Activator.CreateInstance(nodeType, arguments);
+ }
+
+ var factoryMethod = ((string)((ValueNode)node.Properties[XmlName.xFactoryMethod]).Value);
+ Type[] types = arguments == null ? new Type[0] : arguments.Select(a => a.GetType()).ToArray();
+ Func<MethodInfo, bool> isMatch = m => {
+ if (m.Name != factoryMethod)
+ return false;
+ var p = m.GetParameters();
+ if (p.Length != types.Length)
+ return false;
+ if (!m.IsStatic)
+ return false;
+ for (var i = 0; i < p.Length; i++) {
+ if ((p [i].ParameterType.IsAssignableFrom(types [i])))
+ continue;
+ var op_impl = p[i].ParameterType.GetImplicitConversionOperator(fromType: types[i], toType: p[i].ParameterType)
+ ?? types[i].GetImplicitConversionOperator(fromType: types[i], toType: p[i].ParameterType);
+
+ if (op_impl == null)
+ return false;
+ arguments [i] = op_impl.Invoke(null, new [] { arguments [i]});
+ }
+ return true;
+ };
+ var mi = nodeType.GetRuntimeMethods().FirstOrDefault(isMatch);
+ if (mi == null)
+ throw new MissingMemberException($"No static method found for {nodeType.FullName}::{factoryMethod} ({string.Join(", ", types.Select(t => t.FullName))})");
+ return mi.Invoke(null, arguments);
+ }
+
+ public object[] CreateArgumentsArray(IElementNode enode)
+ {
+ if (!enode.Properties.ContainsKey(XmlName.xArguments))
+ return null;
+ var node = enode.Properties[XmlName.xArguments];
+ var elementNode = node as ElementNode;
+ if (elementNode != null)
+ {
+ var array = new object[1];
+ array[0] = Values[elementNode];
+ return array;
+ }
+
+ var listnode = node as ListNode;
+ if (listnode != null)
+ {
+ var array = new object[listnode.CollectionItems.Count];
+ for (var i = 0; i < listnode.CollectionItems.Count; i++)
+ array[i] = Values[(ElementNode)listnode.CollectionItems[i]];
+ return array;
+ }
+ return null;
+ }
+
+ public object[] CreateArgumentsArray(IElementNode enode, ConstructorInfo ctorInfo)
+ {
+ if( ctorInfo != null )
+ {
+ var n = ctorInfo.GetParameters().Length;
+ var array = new object[n];
+ for (var i = 0; i < n; i++)
+ {
+ var parameter = ctorInfo.GetParameters()[i];
+ var propname =
+ parameter?.CustomAttributes?.First(attr => attr.AttributeType == typeof (ParameterAttribute))?
+ .ConstructorArguments.First()
+ .Value as string;
+ var name = new XmlName("", propname);
+ INode node;
+ if (!enode.Properties.TryGetValue(name, out node))
+ {
+ String msg = "";
+ if (propname != null)
+ {
+ msg = String.Format("The Property {0} is required to create a {1} object.", propname, ctorInfo.DeclaringType.FullName);
+ }
+ else
+ {
+ msg = "propname is null.";
+ }
+ throw new XamlParseException(msg, enode as IXmlLineInfo);
+ }
+ if (!enode.SkipProperties.Contains(name))
+ enode.SkipProperties.Add(name);
+ var value = Context.Values[node];
+ var serviceProvider = new XamlServiceProvider(enode, Context);
+ var convertedValue = value?.ConvertTo(parameter?.ParameterType, () => parameter, serviceProvider);
+ array[i] = convertedValue;
+ }
+ return array;
+ }
+
+ return null;
+ }
+
+ static bool IsXaml2009LanguagePrimitive(IElementNode node)
+ {
+ return node.NamespaceURI == XamlParser.X2009Uri;
+ }
+
+ static object CreateLanguagePrimitive(Type nodeType, IElementNode node)
+ {
+ object value = null;
+ if (nodeType == typeof(string))
+ value = String.Empty;
+ else if (nodeType == typeof(Uri))
+ value = null;
+ else
+ {
+ value = Activator.CreateInstance(nodeType);
+ }
+
+ if (node.CollectionItems.Count == 1 && node.CollectionItems[0] is ValueNode &&
+ ((ValueNode)node.CollectionItems[0]).Value is string)
+ {
+ var valuestring = ((ValueNode)node.CollectionItems[0]).Value as string;
+
+ if (nodeType == typeof(SByte)) {
+ sbyte retval;
+ if (sbyte.TryParse(valuestring, NumberStyles.Number, CultureInfo.InvariantCulture, out retval))
+ return retval;
+ }
+ if (nodeType == typeof(Int16)) {
+ short retval;
+ if (short.TryParse(valuestring, NumberStyles.Number, CultureInfo.InvariantCulture, out retval))
+ return retval;
+ }
+ if (nodeType == typeof(Int32)) {
+ int retval;
+ if (int.TryParse(valuestring, NumberStyles.Number, CultureInfo.InvariantCulture, out retval))
+ return retval;
+ }
+ if (nodeType == typeof(Int64)) {
+ long retval;
+ if (long.TryParse(valuestring, NumberStyles.Number, CultureInfo.InvariantCulture, out retval))
+ return retval;
+ }
+ if (nodeType == typeof(Byte)) {
+ byte retval;
+ if (byte.TryParse(valuestring, NumberStyles.Number, CultureInfo.InvariantCulture, out retval))
+ return retval;
+ }
+ if (nodeType == typeof(UInt16)) {
+ ushort retval;
+ if (ushort.TryParse(valuestring, NumberStyles.Number, CultureInfo.InvariantCulture, out retval))
+ return retval;
+ }
+ if (nodeType == typeof(UInt32)) {
+ uint retval;
+ if (uint.TryParse(valuestring, NumberStyles.Number, CultureInfo.InvariantCulture, out retval))
+ return retval;
+ }
+ if (nodeType == typeof(UInt64)) {
+ ulong retval;
+ if (ulong.TryParse(valuestring, NumberStyles.Number, CultureInfo.InvariantCulture, out retval))
+ return retval;
+ }
+ if (nodeType == typeof(Single)) {
+ float retval;
+ if (float.TryParse(valuestring, NumberStyles.Number, CultureInfo.InvariantCulture, out retval))
+ return retval;
+ }
+ if (nodeType == typeof(Double)) {
+ double retval;
+ if (double.TryParse(valuestring, NumberStyles.Number, CultureInfo.InvariantCulture, out retval))
+ return retval;
+ }
+ if (nodeType == typeof (Boolean))
+ {
+ bool outbool;
+ if (bool.TryParse(valuestring, out outbool))
+ return outbool;
+ }
+ if (nodeType == typeof(TimeSpan)) {
+ TimeSpan retval;
+ if (TimeSpan.TryParse(valuestring, CultureInfo.InvariantCulture, out retval))
+ return retval;
+ }
+ if (nodeType == typeof (char))
+ {
+ char retval;
+ if (char.TryParse(valuestring, out retval))
+ return retval;
+ }
+ if (nodeType == typeof (string))
+ return valuestring;
+ if (nodeType == typeof (decimal))
+ {
+ decimal retval;
+ if (decimal.TryParse(valuestring, NumberStyles.Number, CultureInfo.InvariantCulture, out retval))
+ return retval;
+ }
+
+ else if (nodeType == typeof (Uri))
+ {
+ Uri retval;
+ if (Uri.TryCreate(valuestring, UriKind.RelativeOrAbsolute, out retval))
+ return retval;
+ }
+ }
+ return value;
+ }
+ }
+}
--- /dev/null
+namespace Tizen.NUI.Xaml
+{
+ internal static class DesignMode
+ {
+ public static bool IsDesignModeEnabled { get; internal set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Xml;
+using Tizen.NUI.XamlBinding.Internals;
+
+namespace Tizen.NUI.Xaml
+{
+ internal class ExpandMarkupsVisitor : IXamlNodeVisitor
+ {
+ public ExpandMarkupsVisitor(HydrationContext context)
+ {
+ Context = context;
+ }
+
+ public static readonly IList<XmlName> Skips = new List<XmlName>
+ {
+ XmlName.xKey,
+ XmlName.xTypeArguments,
+ XmlName.xFactoryMethod,
+ XmlName.xName,
+ XmlName.xDataType
+ };
+
+ Dictionary<INode, object> Values
+ {
+ get { return Context.Values; }
+ }
+
+ HydrationContext Context { get; }
+
+ public TreeVisitingMode VisitingMode => TreeVisitingMode.BottomUp;
+ public bool StopOnDataTemplate => false;
+ 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)
+ {
+ }
+
+ public void Visit(MarkupNode markupnode, INode parentNode)
+ {
+ var parentElement = parentNode as IElementNode;
+ XmlName propertyName;
+ if (!ApplyPropertiesVisitor.TryGetPropertyName(markupnode, parentNode, out propertyName))
+ return;
+ if (Skips.Contains(propertyName))
+ return;
+ if (parentElement.SkipProperties.Contains(propertyName))
+ return;
+
+ var markupString = markupnode.MarkupString;
+ var node =
+ ParseExpression(ref markupString, markupnode.NamespaceResolver, markupnode, markupnode, parentNode) as IElementNode;
+ if (node != null)
+ {
+ ((IElementNode)parentNode).Properties[propertyName] = node;
+ node.Parent = parentNode;
+ }
+ }
+
+ public void Visit(ElementNode node, INode parentNode)
+ {
+ }
+
+ public void Visit(RootNode node, INode parentNode)
+ {
+ }
+
+ public void Visit(ListNode node, INode parentNode)
+ {
+ }
+
+ INode ParseExpression(ref string expression, IXmlNamespaceResolver nsResolver, IXmlLineInfo xmlLineInfo, INode node,
+ INode parentNode)
+ {
+ if (expression.StartsWith("{}", StringComparison.Ordinal))
+ return new ValueNode(expression.Substring(2), null);
+
+ if (expression[expression.Length - 1] != '}')
+ throw new Exception("Expression must end with '}'");
+
+ int len;
+ string match;
+ if (!MarkupExpressionParser.MatchMarkup(out match, expression, out len))
+ throw new Exception();
+ expression = expression.Substring(len).TrimStart();
+ if (expression.Length == 0)
+ throw new Exception("Expression did not end in '}'");
+
+ var serviceProvider = new XamlServiceProvider(node, Context);
+ serviceProvider.Add(typeof (IXmlNamespaceResolver), nsResolver);
+
+ return new MarkupExpansionParser().Parse(match, ref expression, serviceProvider);
+ }
+
+ public class MarkupExpansionParser : MarkupExpressionParser, IExpressionParser<INode>
+ {
+ IElementNode node;
+
+ object IExpressionParser.Parse(string match, ref string remaining, IServiceProvider serviceProvider)
+ {
+ return Parse(match, ref remaining, serviceProvider);
+ }
+
+ public INode Parse(string match, ref string remaining, IServiceProvider serviceProvider)
+ {
+ var nsResolver = serviceProvider.GetService(typeof (IXmlNamespaceResolver)) as IXmlNamespaceResolver;
+ if (nsResolver == null)
+ throw new ArgumentException();
+ IXmlLineInfo xmlLineInfo = null;
+ var xmlLineInfoProvider = serviceProvider.GetService(typeof (IXmlLineInfoProvider)) as IXmlLineInfoProvider;
+ if (xmlLineInfoProvider != null)
+ xmlLineInfo = xmlLineInfoProvider.XmlLineInfo;
+
+ var split = match.Split(':');
+ if (split.Length > 2)
+ throw new ArgumentException();
+
+ string prefix; //, name;
+ if (split.Length == 2)
+ {
+ prefix = split[0];
+ // name = split [1];
+ }
+ else
+ {
+ prefix = "";
+ // name = split [0];
+ }
+
+ Type type;
+ var typeResolver = serviceProvider.GetService(typeof (IXamlTypeResolver)) as IXamlTypeResolver;
+ if (typeResolver == null)
+ type = null;
+ // Add Binding and StaticResource support, The ordinal code can't find BindingExtension for Binding
+ //else if (match == "Binding")
+ //{
+ // type = typeof(BindingExtension);
+ //}
+ //else if (match == "StaticResource")
+ //{
+ // type = typeof(StaticResourceExtension);
+ //}
+ else
+ {
+ //The order of lookup is to look for the Extension-suffixed class name first and then look for the class name without the Extension suffix.
+ if (!typeResolver.TryResolve(match + "Extension", out type) && !typeResolver.TryResolve(match, out type))
+ {
+ var lineInfoProvider = serviceProvider.GetService(typeof (IXmlLineInfoProvider)) as IXmlLineInfoProvider;
+ var lineInfo = (lineInfoProvider != null) ? lineInfoProvider.XmlLineInfo : new XmlLineInfo();
+ throw new XamlParseException(String.Format("MarkupExtension not found for {0}", match), lineInfo);
+ }
+ }
+
+ var namespaceuri = nsResolver.LookupNamespace(prefix) ?? "";
+ var xmltype = new XmlType(namespaceuri, type?.Name, null);
+
+ if (type == null)
+ throw new NotSupportedException();
+
+ node = xmlLineInfo == null
+ ? new ElementNode(xmltype, null, nsResolver)
+ : new ElementNode(xmltype, null, nsResolver, xmlLineInfo.LineNumber, xmlLineInfo.LinePosition);
+
+ if (remaining.StartsWith("}", StringComparison.Ordinal))
+ {
+ remaining = remaining.Substring(1);
+ return node;
+ }
+
+ char next;
+ string piece;
+ while ((piece = GetNextPiece(ref remaining, out next)) != null)
+ HandleProperty(piece, serviceProvider, ref remaining, next != '=');
+
+ return node;
+ }
+
+ protected override void SetPropertyValue(string prop, string strValue, object value, IServiceProvider serviceProvider)
+ {
+ var nsResolver = serviceProvider.GetService(typeof (IXmlNamespaceResolver)) as IXmlNamespaceResolver;
+
+ var childnode = value as INode ?? new ValueNode(strValue, nsResolver);
+ childnode.Parent = node;
+ if (prop != null)
+ {
+ var name = new XmlName(node.NamespaceURI, prop);
+ node.Properties[name] = childnode;
+ }
+ else //ContentProperty
+ node.CollectionItems.Add(childnode);
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Reflection;
+using Tizen.NUI.XamlBinding;
+
+namespace Tizen.NUI.Xaml
+{
+ internal class FillResourceDictionariesVisitor : IXamlNodeVisitor
+ {
+ public FillResourceDictionariesVisitor(HydrationContext context)
+ {
+ Context = context;
+ }
+
+ HydrationContext Context { get; }
+ Dictionary<INode, object> Values => Context.Values;
+
+ public TreeVisitingMode VisitingMode => TreeVisitingMode.TopDown;
+ public bool StopOnDataTemplate => true;
+ 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)]))
+ return;
+
+ node.Accept(new ApplyPropertiesVisitor(Context, stopOnResourceDictionary: false), parentNode);
+ }
+
+ public void Visit(MarkupNode node, INode parentNode)
+ {
+ }
+
+ public void Visit(ElementNode node, INode parentNode)
+ {
+ var value = Values[node];
+ XmlName propertyName;
+ //Set RD to VE
+ if (typeof(ResourceDictionary).IsAssignableFrom(Context.Types[node]) && ApplyPropertiesVisitor.TryGetPropertyName(node, parentNode, out propertyName)) {
+ if ((propertyName.LocalName == "Resources" ||
+ propertyName.LocalName.EndsWith(".Resources", StringComparison.Ordinal)) && value is ResourceDictionary) {
+ var source = Values[parentNode];
+ ApplyPropertiesVisitor.SetPropertyValue(source, propertyName, value, Context.RootElement, node, Context, node);
+ return;
+ }
+ }
+
+ //Only proceed further if the node is a keyless RD
+ if ( parentNode is IElementNode
+ && typeof(ResourceDictionary).IsAssignableFrom(Context.Types[((IElementNode)parentNode)])
+ && !((IElementNode)parentNode).Properties.ContainsKey(XmlName.xKey))
+ node.Accept(new ApplyPropertiesVisitor(Context, stopOnResourceDictionary: false), parentNode);
+ else if ( parentNode is ListNode
+ && typeof(ResourceDictionary).IsAssignableFrom(Context.Types[((IElementNode)parentNode.Parent)])
+ && !((IElementNode)parentNode.Parent).Properties.ContainsKey(XmlName.xKey))
+ node.Accept(new ApplyPropertiesVisitor(Context, stopOnResourceDictionary: false), parentNode);
+ }
+
+ public void Visit(RootNode node, INode parentNode)
+ {
+ }
+
+ public void Visit(ListNode node, INode parentNode)
+ {
+ }
+
+ public bool SkipChildren(INode node, INode parentNode)
+ {
+ var enode = node as ElementNode;
+ if (enode is null)
+ return false;
+ if ( parentNode is IElementNode
+ && typeof(ResourceDictionary).IsAssignableFrom(Context.Types[((IElementNode)parentNode)])
+ && !((IElementNode)parentNode).Properties.ContainsKey(XmlName.xKey))
+ return true;
+ if ( parentNode is ListNode
+ && typeof(ResourceDictionary).IsAssignableFrom(Context.Types[((IElementNode)parentNode.Parent)])
+ && !((IElementNode)parentNode.Parent).Properties.ContainsKey(XmlName.xKey))
+ return true;
+ return false;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+
+namespace Tizen.NUI.Xaml
+{
+ internal class HydrationContext
+ {
+ public HydrationContext()
+ {
+ Values = new Dictionary<INode, object>();
+ Types = new Dictionary<IElementNode, Type>();
+ }
+
+ public Dictionary<INode, object> Values { get; }
+ public Dictionary<IElementNode, Type> Types { get; }
+ public HydrationContext ParentContext { get; set; }
+ public Action<Exception> ExceptionHandler { get; set; }
+ public object RootElement { get; set; }
+ }
+}
--- /dev/null
+namespace Tizen.NUI.Xaml
+{
+ internal interface IConverterOptions
+ {
+ bool IgnoreCase { get; }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.Collections.Generic;
+
+namespace Tizen.NUI.Xaml
+{
+ internal static class IDictionaryExtensions
+ {
+ public static void AddRange<TKey, TValue>(this IDictionary<TKey, TValue> dictionary,
+ IEnumerable<KeyValuePair<TKey, TValue>> collection)
+ {
+ foreach (var kvp in collection)
+ dictionary.Add(kvp);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.Xaml
+{
+ internal interface IExpressionParser
+ {
+ object Parse(string match, ref string expression, IServiceProvider serviceProvider);
+ }
+
+ internal interface IExpressionParser<out T> : IExpressionParser
+ where T : class
+ {
+ new T Parse(string match, ref string expression, IServiceProvider serviceProvider);
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.Xaml.Internals
+{
+ internal interface INativeValueConverterService
+ {
+ bool ConvertTo(object value, Type toType, out object nativeValue);
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.Collections.Generic;
+
+namespace Tizen.NUI.Xaml
+{
+ internal interface IProvideParentValues : IProvideValueTarget
+ {
+ IEnumerable<object> ParentObjects { get; }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Reflection;
+using System.Xml;
+using System.IO;
+
+namespace Tizen.NUI
+{
+ internal interface IResourcesLoader
+ {
+ T CreateFromResource<T>(string resourcePath, Assembly assembly, IXmlLineInfo lineInfo) where T : new();
+ string GetResource(string resourcePath, Assembly assembly, IXmlLineInfo lineInfo);
+ }
+}
\ No newline at end of file
--- /dev/null
+namespace Tizen.NUI.Xaml
+{
+ internal interface IRootObjectProvider
+ {
+ object RootObject { get; }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Reflection;
+
+namespace Tizen.NUI.Xaml
+{
+ internal interface IValueConverterProvider
+ {
+ object Convert(object value, Type toType, Func<MemberInfo> minfoRetriever, IServiceProvider serviceProvider);
+ }
+}
\ No newline at end of file
--- /dev/null
+//
+// MarkupExpressionParser.cs
+//
+// This code is partly salvaged from moonlight. Following licence apply.
+//
+//
+// Author(s):
+// Moonlight List (moonlight-list@lists.ximian.com)
+// Stephane Delcroix (stephane@mi8.be)
+//
+// Copyright 2009 Novell, Inc.
+// Copyright 2013 Xamarin, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Text;
+
+namespace Tizen.NUI.Xaml
+{
+ internal abstract class MarkupExpressionParser
+ {
+ public object ParseExpression(ref string expression, IServiceProvider serviceProvider)
+ {
+ if (serviceProvider == null)
+ throw new ArgumentNullException(nameof(serviceProvider));
+ if (expression.StartsWith("{}", StringComparison.Ordinal))
+ return expression.Substring(2);
+
+ if (expression[expression.Length - 1] != '}')
+ throw new Exception("Expression must end with '}'");
+
+ int len;
+ string match;
+ if (!MatchMarkup(out match, expression, out len))
+ return false;
+ expression = expression.Substring(len).TrimStart();
+ if (expression.Length == 0)
+ throw new Exception("Expression did not end in '}'");
+
+ var parser = Activator.CreateInstance(GetType()) as IExpressionParser;
+ return parser?.Parse(match, ref expression, serviceProvider);
+ }
+
+ internal static bool MatchMarkup(out string match, string expression, out int end)
+ {
+ if (expression.Length < 2)
+ {
+ end = 1;
+ match = null;
+ return false;
+ }
+
+ if (expression[0] != '{')
+ {
+ end = 2;
+ match = null;
+ return false;
+ }
+
+ int i;
+ bool found = false;
+ for (i = 1; i < expression.Length; i++)
+ {
+ if (expression[i] == ' ')
+ continue;
+ found = true;
+ break;
+ }
+
+ if (!found)
+ {
+ end = 3;
+ match = null;
+ return false;
+ }
+
+ int c;
+ for (c = 0; c + i < expression.Length; c++)
+ {
+ if (expression[i + c] == ' ' || expression[i + c] == '}')
+ break;
+ }
+
+ if (i + c == expression.Length)
+ {
+ end = 6;
+ match = null;
+ return false;
+ }
+
+ end = i + c;
+ match = expression.Substring(i, c);
+ return true;
+ }
+
+ protected void HandleProperty(string prop, IServiceProvider serviceProvider, ref string remaining, bool isImplicit)
+ {
+ char next;
+ object value = null;
+ string str_value;
+
+ if (isImplicit)
+ {
+ SetPropertyValue(null, prop, null, serviceProvider);
+ return;
+ }
+ remaining = remaining.TrimStart();
+ if (remaining.StartsWith("{", StringComparison.Ordinal))
+ {
+ value = ParseExpression(ref remaining, serviceProvider);
+ remaining = remaining.TrimStart();
+
+ if (remaining.Length > 0 && remaining[0] == ',')
+ remaining = remaining.Substring(1);
+ else if (remaining.Length > 0 && remaining[0] == '}')
+ remaining = remaining.Substring(1);
+
+ str_value = value as string;
+ }
+ else
+ str_value = GetNextPiece(ref remaining, out next);
+
+ SetPropertyValue(prop, str_value, value, serviceProvider);
+ }
+
+ protected abstract void SetPropertyValue(string prop, string strValue, object value, IServiceProvider serviceProvider);
+
+ protected string GetNextPiece(ref string remaining, out char next)
+ {
+ bool inString = false;
+ int end = 0;
+ char stringTerminator = '\0';
+ remaining = remaining.TrimStart();
+ if (remaining.Length == 0)
+ {
+ next = Char.MaxValue;
+ return null;
+ }
+
+ var piece = new StringBuilder();
+ // If we're inside a quoted string we append all chars to our piece until we hit the ending quote.
+ while (end < remaining.Length &&
+ (inString || (remaining[end] != '}' && remaining[end] != ',' && remaining[end] != '=')))
+ {
+ if (inString)
+ {
+ if (remaining[end] == stringTerminator)
+ {
+ inString = false;
+ end ++;
+ break;
+ }
+ }
+ else
+ {
+ if (remaining[end] == '\'' || remaining[end] == '"')
+ {
+ inString = true;
+ stringTerminator = remaining[end];
+ end ++;
+ continue;
+ }
+ }
+
+ // If this is an escape char, consume it and append the next char to our piece.
+ if (remaining[end] == '\\')
+ {
+ end ++;
+ if (end == remaining.Length)
+ break;
+ }
+ piece.Append(remaining[end]);
+ end++;
+ }
+
+ if (inString && end == remaining.Length)
+ throw new Exception("Unterminated quoted string");
+
+ if (end == remaining.Length && !remaining.EndsWith("}", StringComparison.Ordinal))
+ throw new Exception("Expression did not end with '}'");
+
+ if (end == 0)
+ {
+ next = Char.MaxValue;
+ return null;
+ }
+
+ next = remaining[end];
+ remaining = remaining.Substring(end + 1);
+
+ // Whitespace is trimmed from the end of the piece before stripping
+ // quote chars from the start/end of the string.
+ while (piece.Length > 0 && char.IsWhiteSpace(piece[piece.Length - 1]))
+ piece.Length --;
+
+ if (piece.Length >= 2)
+ {
+ char first = piece[0];
+ char last = piece[piece.Length - 1];
+ if ((first == '\'' && last == '\'') || (first == '"' && last == '"'))
+ {
+ piece.Remove(piece.Length - 1, 1);
+ piece.Remove(0, 1);
+ }
+ }
+
+ return piece.ToString();
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Reflection;
+using Tizen.NUI.XamlBinding;
+
+namespace Tizen.NUI.Xaml
+{
+ internal sealed class MarkupExtensionParser : MarkupExpressionParser, IExpressionParser<object>
+ {
+ IMarkupExtension markupExtension;
+
+ public object Parse(string match, ref string remaining, IServiceProvider serviceProvider)
+ {
+ var typeResolver = serviceProvider.GetService(typeof (IXamlTypeResolver)) as IXamlTypeResolver;
+
+ //shortcut for Binding and StaticResource, to avoid too many reflection calls.
+ if (match == "Binding")
+ markupExtension = new BindingExtension();
+ else if (match == "TemplateBinding")
+ markupExtension = new TemplateBindingExtension();
+ else if (match == "StaticResource")
+ markupExtension = new StaticResourceExtension();
+ else
+ {
+ if (typeResolver == null)
+ return null;
+ Type type;
+
+ //The order of lookup is to look for the Extension-suffixed class name first and then look for the class name without the Extension suffix.
+ if (!typeResolver.TryResolve(match + "Extension", out type) && !typeResolver.TryResolve(match, out type))
+ {
+ var lineInfoProvider = serviceProvider.GetService(typeof (IXmlLineInfoProvider)) as IXmlLineInfoProvider;
+ var lineInfo = (lineInfoProvider != null) ? lineInfoProvider.XmlLineInfo : new XmlLineInfo();
+ throw new XamlParseException(String.Format("MarkupExtension not found for {0}", match), lineInfo);
+ }
+ markupExtension = Activator.CreateInstance(type) as IMarkupExtension;
+ }
+
+ if (markupExtension == null)
+ {
+ var lineInfoProvider = serviceProvider.GetService(typeof (IXmlLineInfoProvider)) as IXmlLineInfoProvider;
+ var lineInfo = (lineInfoProvider != null) ? lineInfoProvider.XmlLineInfo : new XmlLineInfo();
+ throw new XamlParseException(String.Format("Missing public default constructor for MarkupExtension {0}", match),
+ lineInfo);
+ }
+
+ char next;
+ if (remaining == "}")
+ return markupExtension.ProvideValue(serviceProvider);
+
+ string piece;
+ while ((piece = GetNextPiece(ref remaining, out next)) != null)
+ HandleProperty(piece, serviceProvider, ref remaining, next != '=');
+
+ return markupExtension.ProvideValue(serviceProvider);
+ }
+
+ protected override void SetPropertyValue(string prop, string strValue, object value, IServiceProvider serviceProvider)
+ {
+ MethodInfo setter;
+ if (prop == null)
+ {
+ //implicit property
+ var t = markupExtension.GetType();
+ prop = ApplyPropertiesVisitor.GetContentPropertyName(t.GetTypeInfo());
+ if (prop == null)
+ return;
+ setter = t.GetRuntimeProperty(prop)?.SetMethod;
+ }
+ else
+ setter = markupExtension.GetType().GetRuntimeProperty(prop)?.SetMethod;
+
+ if (value == null && strValue != null)
+ {
+ value = strValue.ConvertTo(markupExtension.GetType().GetRuntimeProperty(prop)?.PropertyType,
+ (Func<TypeConverter>)null, serviceProvider);
+ }
+
+ setter?.Invoke(markupExtension, new[] { value });
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.Collections.Generic;
+using Tizen.NUI.XamlBinding.Internals;
+
+namespace Tizen.NUI.Xaml
+{
+ internal class NamescopingVisitor : IXamlNodeVisitor
+ {
+ readonly Dictionary<INode, INameScope> scopes = new Dictionary<INode, INameScope>();
+
+ public NamescopingVisitor(HydrationContext context)
+ {
+ Values = context.Values;
+ }
+
+ Dictionary<INode, object> Values { get; set; }
+
+ public TreeVisitingMode VisitingMode => TreeVisitingMode.TopDown;
+ public bool StopOnDataTemplate => false;
+ 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)
+ {
+ scopes[node] = scopes[parentNode];
+ }
+
+ public void Visit(MarkupNode node, INode parentNode)
+ {
+ scopes[node] = scopes[parentNode];
+ }
+
+ public void Visit(ElementNode node, INode parentNode)
+ {
+ var ns = parentNode == null || IsDataTemplate(node, parentNode) || IsStyle(node, parentNode) || IsVisualStateGroupList(node)
+ ? new NameScope()
+ : scopes[parentNode];
+ node.Namescope = ns;
+ scopes[node] = ns;
+ }
+
+ public void Visit(RootNode node, INode parentNode)
+ {
+ var ns = new NameScope();
+ node.Namescope = ns;
+ scopes[node] = ns;
+ }
+
+ public void Visit(ListNode node, INode parentNode)
+ {
+ scopes[node] = scopes[parentNode];
+ }
+
+ static bool IsDataTemplate(INode node, INode parentNode)
+ {
+ var parentElement = parentNode as IElementNode;
+ INode createContent;
+ if (parentElement != null && parentElement.Properties.TryGetValue(XmlName._CreateContent, out createContent) &&
+ createContent == node)
+ return true;
+ return false;
+ }
+
+ static bool IsStyle(INode node, INode parentNode)
+ {
+ var pnode = parentNode as ElementNode;
+ return pnode != null && pnode.XmlType.Name == "Style";
+ }
+
+ static bool IsVisualStateGroupList(ElementNode node)
+ {
+ return node != null && node.XmlType.Name == "VisualStateGroup" && node.Parent is IListNode;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+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
--- /dev/null
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Tizen.NUI.Xaml
+{
+ internal class PruneIgnoredNodesVisitor : IXamlNodeVisitor
+ {
+ public TreeVisitingMode VisitingMode => TreeVisitingMode.TopDown;
+ public bool StopOnDataTemplate => false;
+ 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)
+ {
+ foreach (var propertyKvp in node.Properties)
+ {
+ var propertyName = propertyKvp.Key;
+ var propertyValue = (propertyKvp.Value as ValueNode)?.Value as string;
+ if (propertyValue == null)
+ continue;
+ if (!propertyName.Equals(XamlParser.McUri, "Ignorable"))
+ continue;
+ (parentNode.IgnorablePrefixes ?? (parentNode.IgnorablePrefixes = new List<string>())).AddRange(propertyValue.Split(','));
+ }
+
+ foreach (var propertyKvp in node.Properties.ToList())
+ {
+ // skip d:foo="bar"
+ var prefix = node.NamespaceResolver.LookupPrefix(propertyKvp.Key.NamespaceURI);
+ if (node.SkipPrefix(prefix))
+ node.Properties.Remove(propertyKvp.Key);
+ var propNs = (propertyKvp.Value as IElementNode)?.NamespaceURI ?? "";
+ var propPrefix = node.NamespaceResolver.LookupPrefix(propNs);
+ if (node.SkipPrefix(propPrefix))
+ node.Properties.Remove(propertyKvp.Key);
+ }
+
+ foreach (var prop in node.CollectionItems.ToList())
+ {
+ var propNs = (prop as IElementNode)?.NamespaceURI ?? "";
+ var propPrefix = node.NamespaceResolver.LookupPrefix(propNs);
+ if (node.SkipPrefix(propPrefix))
+ node.CollectionItems.Remove(prop);
+ }
+
+ if (node.SkipPrefix(node.NamespaceResolver.LookupPrefix(node.NamespaceURI)))
+ {
+ node.Properties.Clear();
+ node.CollectionItems.Clear();
+ }
+ }
+
+ public void Visit(RootNode node, INode parentNode)
+ {
+ Visit((ElementNode)node, node);
+ }
+
+ public void Visit(MarkupNode node, INode parentNode)
+ {
+ }
+
+ public void Visit(ListNode node, INode parentNode)
+ {
+ foreach (var prop in node.CollectionItems.ToList())
+ {
+ var propNs = (prop as IElementNode)?.NamespaceURI ?? "";
+ var propPrefix = node.NamespaceResolver.LookupPrefix(propNs);
+ if (node.SkipPrefix(propPrefix))
+ node.CollectionItems.Remove(prop);
+ }
+ }
+
+ public void Visit(ValueNode node, INode parentNode)
+ {
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Reflection;
+
+namespace Tizen.NUI.XamlBinding.Internals
+{
+ internal static class ReflectionExtensions
+ {
+ public static FieldInfo GetField(this Type type, Func<FieldInfo, bool> predicate)
+ {
+ return GetFields(type).FirstOrDefault(predicate);
+ }
+
+ public static FieldInfo GetField(this Type type, string name)
+ {
+ return type.GetField(fi => fi.Name == name);
+ }
+
+ public static IEnumerable<FieldInfo> GetFields(this Type type)
+ {
+ return GetParts(type, i => i.DeclaredFields);
+ }
+
+ public static IEnumerable<PropertyInfo> GetProperties(this Type type)
+ {
+ return GetParts(type, ti => ti.DeclaredProperties);
+ }
+
+ public static PropertyInfo GetProperty(this Type type, string name)
+ {
+ Type t = type;
+ while (t != null)
+ {
+ System.Reflection.TypeInfo ti = t.GetTypeInfo();
+ PropertyInfo property = ti.GetDeclaredProperty(name);
+ if (property != null)
+ return property;
+
+ t = ti.BaseType;
+ }
+
+ return null;
+ }
+
+ public static bool IsAssignableFrom(this Type self, Type c)
+ {
+ return self.GetTypeInfo().IsAssignableFrom(c.GetTypeInfo());
+ }
+
+ public static bool IsInstanceOfType(this Type self, object o)
+ {
+ return self.GetTypeInfo().IsAssignableFrom(o.GetType().GetTypeInfo());
+ }
+
+ static IEnumerable<T> GetParts<T>(Type type, Func<System.Reflection.TypeInfo, IEnumerable<T>> selector)
+ {
+ Type t = type;
+ while (t != null)
+ {
+ System.Reflection.TypeInfo ti = t.GetTypeInfo();
+ foreach (T f in selector(ti))
+ yield return f;
+ t = ti.BaseType;
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+using Tizen.NUI.XamlBinding;
+
+namespace Tizen.NUI.Xaml
+{
+ internal class RegisterXNamesVisitor : IXamlNodeVisitor
+ {
+ 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)
+ {
+ if (!IsXNameProperty(node, parentNode))
+ return;
+ try
+ {
+ ((IElementNode)parentNode).Namescope.RegisterName((string)node.Value, Values[parentNode]);
+ }
+ catch (ArgumentException ae)
+ {
+ if (ae.ParamName != "name")
+ throw ae;
+ throw new XamlParseException($"An element with the name \"{(string)node.Value}\" already exists in this NameScope", node);
+ }
+ var element = Values[parentNode] as Element;
+ if (element != null)
+ element.StyleId = element.StyleId ?? (string)node.Value;
+ }
+
+ public void Visit(MarkupNode node, INode parentNode)
+ {
+ }
+
+ public void Visit(ElementNode node, INode parentNode)
+ {
+ }
+
+ public void Visit(RootNode node, INode parentNode)
+ {
+ }
+
+ public void Visit(ListNode node, INode parentNode)
+ {
+ }
+
+ static bool IsXNameProperty(ValueNode node, INode parentNode)
+ {
+ var parentElement = parentNode as IElementNode;
+ INode xNameNode;
+ if (parentElement != null && parentElement.Properties.TryGetValue(XmlName.xName, out xNameNode) && xNameNode == node)
+ return true;
+ return false;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.IO;
+using System.Reflection;
+using System.Xml;
+using Tizen.NUI.XamlBinding.Internals;
+
+namespace Tizen.NUI.Xaml
+{
+ internal class ResourcesLoader : IResourcesLoader
+ {
+ public T CreateFromResource<T>(string resourcePath, Assembly assembly, IXmlLineInfo lineInfo) where T: new()
+ {
+ var alternateResource = ResourceLoader.ResourceProvider?.Invoke(assembly.GetName(), resourcePath);
+ if (alternateResource != null) {
+ var rd = new T();
+ rd.LoadFromXaml(alternateResource);
+ return rd;
+ }
+
+ var resourceId = XamlResourceIdAttribute.GetResourceIdForPath(assembly, resourcePath);
+ if (resourceId == null)
+ throw new XamlParseException($"Resource '{resourcePath}' not found.", lineInfo);
+
+ using (var stream = assembly.GetManifestResourceStream(resourceId)) {
+ if (stream == null)
+ throw new XamlParseException($"No resource found for '{resourceId}'.", lineInfo);
+ using (var reader = new StreamReader(stream)) {
+ var rd = new T();
+ rd.LoadFromXaml(reader.ReadToEnd());
+ return rd;
+ }
+ }
+ }
+
+ public string GetResource(string resourcePath, Assembly assembly, IXmlLineInfo lineInfo)
+ {
+ var alternateResource = ResourceLoader.ResourceProvider?.Invoke(assembly.GetName(), resourcePath);
+ if (alternateResource != null)
+ return alternateResource;
+
+ var resourceId = XamlResourceIdAttribute.GetResourceIdForPath(assembly, resourcePath);
+ if (resourceId == null)
+ throw new XamlParseException($"Resource '{resourcePath}' not found.", lineInfo);
+
+ using (var stream = assembly.GetManifestResourceStream(resourceId)) {
+ if (stream == null)
+ throw new XamlParseException($"No resource found for '{resourceId}'.", lineInfo);
+ using (var reader = new StreamReader(stream))
+ return reader.ReadToEnd();
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.Xaml
+{
+ [AttributeUsage(AttributeTargets.Class)]
+ internal sealed class RuntimeNamePropertyAttribute : Attribute
+ {
+ public RuntimeNamePropertyAttribute(string name)
+ {
+ Name = name;
+ }
+
+ public string Name { get; }
+ }
+}
\ No newline at end of file
--- /dev/null
+
+using System.Collections.Generic;
+using System.Xml;
+
+namespace Tizen.NUI.Xaml
+{
+ internal static class TypeArgumentsParser
+ {
+ public static IList<XmlType> ParseExpression(string expression, IXmlNamespaceResolver resolver, IXmlLineInfo lineInfo)
+ {
+ var typeList = new List<XmlType>();
+ while (!string.IsNullOrWhiteSpace(expression))
+ {
+ var match = expression;
+ typeList.Add(Parse(match, ref expression, resolver, lineInfo));
+ }
+ return typeList;
+ }
+
+ static XmlType Parse(string match, ref string remaining, IXmlNamespaceResolver resolver, IXmlLineInfo lineinfo)
+ {
+ remaining = null;
+ int parensCount = 0;
+ int pos = 0;
+ bool isGeneric = false;
+
+ for (pos = 0; pos < match.Length; pos++)
+ {
+ if (match[pos] == '(')
+ {
+ parensCount++;
+ isGeneric = true;
+ }
+ else if (match[pos] == ')')
+ parensCount--;
+ else if (match[pos] == ',' && parensCount == 0)
+ {
+ remaining = match.Substring(pos + 1);
+ break;
+ }
+ }
+ var type = match.Substring(0, pos).Trim();
+
+ IList<XmlType> typeArguments = null;
+ if (isGeneric)
+ {
+ typeArguments = ParseExpression(
+ type.Substring(type.IndexOf('(') + 1, type.LastIndexOf(')') - type.IndexOf('(') - 1), resolver, lineinfo);
+ type = type.Substring(0, type.IndexOf('('));
+ }
+
+ var split = type.Split(':');
+ if (split.Length > 2)
+ return null;
+
+ string prefix, name;
+ if (split.Length == 2) {
+ prefix = split [0];
+ name = split [1];
+ } else {
+ prefix = "";
+ name = split [0];
+ }
+
+ var namespaceuri = resolver.LookupNamespace(prefix);
+ if (namespaceuri == null)
+ throw new XamlParseException($"No xmlns declaration for prefix '{prefix}'.", lineinfo, null);
+ return new XmlType(namespaceuri, name, typeArguments);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.Xaml
+{
+ [System.AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
+ internal sealed class TypeConversionAttribute : Attribute
+ {
+ public Type TargetType { get; private set; }
+
+ public TypeConversionAttribute(Type targetType)
+ {
+ TargetType = targetType;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+//
+// TypeConversionExtensions.cs
+//
+// Author:
+// Stephane Delcroix <stephane@mi8.be>
+//
+// Copyright (c) 2013 Mobile Inception
+// Copyright (c) 2014 Xamarin, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Reflection;
+// using Tizen.NUI.XamlBinding.Internals;
+using Tizen.NUI.Xaml.Internals;
+using Tizen.NUI.XamlBinding;
+
+namespace Tizen.NUI.Xaml
+{
+ internal static class TypeConversionExtensions
+ {
+ internal static object ConvertTo(this object value, Type toType, Func<ParameterInfo> pinfoRetriever,
+ IServiceProvider serviceProvider)
+ {
+ Func<TypeConverter> getConverter = () =>
+ {
+ ParameterInfo pInfo;
+ if (pinfoRetriever == null || (pInfo = pinfoRetriever()) == null)
+ return null;
+
+ var converterTypeName = pInfo.CustomAttributes.GetTypeConverterTypeName();
+ if (converterTypeName == null)
+ return null;
+ var convertertype = Type.GetType(converterTypeName);
+ return (TypeConverter)Activator.CreateInstance(convertertype);
+ };
+
+ return ConvertTo(value, toType, getConverter, serviceProvider);
+ }
+
+ static private Assembly assemblyOfConverter = null;
+ static private string nameSpaceOfConverter = null;
+
+ static internal string GetConverterName(Type type)
+ {
+ if (null == TypeConversionExtensions.assemblyOfConverter)
+ {
+ Type position2DTypeConverterType = typeof(Position2DTypeConverter);
+ assemblyOfConverter = position2DTypeConverterType.Assembly;
+
+ nameSpaceOfConverter = position2DTypeConverterType.FullName;
+ nameSpaceOfConverter = nameSpaceOfConverter.Substring(0, nameSpaceOfConverter.LastIndexOf('.') + 1);
+ }
+
+ Type xamlToType = assemblyOfConverter.GetType(nameSpaceOfConverter + type.Name + "TypeConverter");
+
+ if (null == xamlToType)
+ {
+ return null;
+ }
+ else
+ {
+ return xamlToType.FullName;
+ }
+ }
+
+ internal static object ConvertTo(this object value, Type toType, Func<MemberInfo> minfoRetriever,
+ IServiceProvider serviceProvider)
+ {
+ Func<object> getConverter = () =>
+ {
+ var converterTypeName = GetConverterName(toType);
+
+ if (null == converterTypeName)
+ {
+ return null;
+ }
+
+ var convertertype = Type.GetType(converterTypeName);
+ return Activator.CreateInstance(convertertype);
+ };
+
+ return ConvertTo(value, toType, getConverter, serviceProvider);
+ }
+
+ static string GetTypeConverterTypeName(this IEnumerable<CustomAttributeData> attributes)
+ {
+ var converterAttribute =
+ attributes.FirstOrDefault(cad => TypeConverterAttribute.TypeConvertersType.Contains(cad.AttributeType.FullName));
+ if (converterAttribute == null)
+ return null;
+ if (converterAttribute.ConstructorArguments[0].ArgumentType == typeof (string))
+ return (string)converterAttribute.ConstructorArguments[0].Value;
+ if (converterAttribute.ConstructorArguments[0].ArgumentType == typeof (Type))
+ return ((Type)converterAttribute.ConstructorArguments[0].Value).AssemblyQualifiedName;
+ return null;
+ }
+
+ //Don't change the name or the signature of this, it's used by XamlC
+ public static object ConvertTo(this object value, Type toType, Type convertertype, IServiceProvider serviceProvider)
+ {
+ if (convertertype == null)
+ return value.ConvertTo(toType, (Func<object>)null, serviceProvider);
+ Func<object> getConverter = () => Activator.CreateInstance(convertertype);
+ ;
+ 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)
+ {
+ if (value == null)
+ return null;
+
+ var str = value as string;
+ if (str != null)
+ {
+ //If there's a [TypeConverter], use it
+ object converter = getConverter?.Invoke();
+ if (null != converter)
+ {
+ 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
+ if (toType.GetTypeInfo().IsGenericType && toType.GetGenericTypeDefinition() == typeof (Nullable<>))
+ toType = Nullable.GetUnderlyingType(toType);
+
+ //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))
+ return Int16.Parse(str, CultureInfo.InvariantCulture);
+ if (toType == typeof(Int32))
+ return Int32.Parse(str, CultureInfo.InvariantCulture);
+ if (toType == typeof(Int64))
+ return Int64.Parse(str, CultureInfo.InvariantCulture);
+ if (toType == typeof(Byte))
+ return Byte.Parse(str, CultureInfo.InvariantCulture);
+ if (toType == typeof(UInt16))
+ return UInt16.Parse(str, CultureInfo.InvariantCulture);
+ if (toType == typeof(UInt32))
+ return UInt32.Parse(str, CultureInfo.InvariantCulture);
+ if (toType == typeof(UInt64))
+ return UInt64.Parse(str, CultureInfo.InvariantCulture);
+ if (toType == typeof (Single))
+ return Single.Parse(str, CultureInfo.InvariantCulture);
+ if (toType == typeof (Double))
+ return Double.Parse(str, CultureInfo.InvariantCulture);
+ if (toType == typeof (Boolean))
+ return Boolean.Parse(str);
+ if (toType == typeof (TimeSpan))
+ return TimeSpan.Parse(str, CultureInfo.InvariantCulture);
+ if (toType == typeof (DateTime))
+ return DateTime.Parse(str, CultureInfo.InvariantCulture);
+ if (toType == typeof(Char)) {
+ char c = '\0';
+ Char.TryParse(str, out c);
+ return c;
+ }
+ if (toType == typeof (String) && str.StartsWith("{}", StringComparison.Ordinal))
+ return str.Substring(2);
+ if (toType == typeof (String))
+ return value;
+ if (toType == typeof(Decimal))
+ return Decimal.Parse(str, CultureInfo.InvariantCulture);
+ }
+
+ //if the value is not assignable and there's an implicit conversion, convert
+ if (value != null && !toType.IsAssignableFrom(value.GetType())) {
+ var opImplicit = value.GetType().GetImplicitConversionOperator(fromType: value.GetType(), toType: toType)
+ ?? toType.GetImplicitConversionOperator(fromType: value.GetType(), toType: toType);
+
+ if (opImplicit != null) {
+ value = opImplicit.Invoke(null, new[] { value });
+ return value;
+ }
+ }
+
+ var nativeValueConverterService = DependencyService.Get<INativeValueConverterService>();
+
+ object nativeValue = null;
+ if (nativeValueConverterService != null && nativeValueConverterService.ConvertTo(value, toType, out nativeValue))
+ return nativeValue;
+
+ return value;
+ }
+
+ internal static MethodInfo GetImplicitConversionOperator(this Type onType, Type fromType, Type toType)
+ {
+#if NETSTANDARD1_0
+ var mi = onType.GetRuntimeMethod("op_Implicit", new[] { fromType });
+#else
+ var bindingFlags = BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy;
+ var mi = onType.GetMethod("op_Implicit", bindingFlags, null, new[] { fromType }, null);
+#endif
+ if (mi == null) return null;
+ if (!mi.IsSpecialName) return null;
+ if (!mi.IsPublic) return null;
+ if (!mi.IsStatic) return null;
+ if (!toType.IsAssignableFrom(mi.ReturnType)) return null;
+
+ return mi;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Reflection;
+
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI.Xaml
+{
+ internal class ValueConverterProvider : IValueConverterProvider
+ {
+ public object Convert(object value, Type toType, Func<MemberInfo> minfoRetriever, IServiceProvider serviceProvider)
+ {
+ return value.ConvertTo(toType, minfoRetriever, serviceProvider);
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using Tizen.NUI.XamlBinding;
+
+namespace Tizen.NUI.Xaml
+{
+ internal static class VisualStateManager
+ {
+ internal class CommonStates
+ {
+ public const string Normal = "Normal";
+ public const string Disabled = "Disabled";
+ public const string Focused = "Focused";
+ }
+
+ public static readonly BindableProperty VisualStateGroupsProperty =
+ BindableProperty.CreateAttached("VisualStateGroups", typeof(VisualStateGroupList), typeof(Element),
+ defaultValue: null, propertyChanged: VisualStateGroupsPropertyChanged,
+ defaultValueCreator: bindable => new VisualStateGroupList());
+
+ static void VisualStateGroupsPropertyChanged(BindableObject bindable, object oldValue, object newValue)
+ {
+ GoToState((Element)bindable, CommonStates.Normal);
+ }
+
+ public static IList<VisualStateGroup> GetVisualStateGroups(Element visualElement)
+ {
+ return (IList<VisualStateGroup>)visualElement.GetValue(VisualStateGroupsProperty);
+ }
+
+ public static void SetVisualStateGroups(Element visualElement, VisualStateGroupList value)
+ {
+ visualElement.SetValue(VisualStateGroupsProperty, value);
+ }
+
+ public static bool GoToState(Element visualElement, string name)
+ {
+ if (!visualElement.IsSet(VisualStateGroupsProperty))
+ {
+ return false;
+ }
+
+ var groups = (IList<VisualStateGroup>)visualElement.GetValue(VisualStateGroupsProperty);
+
+ foreach (VisualStateGroup group in groups)
+ {
+ if (group.CurrentState?.Name == name)
+ {
+ // We're already in the target state; nothing else to do
+ return true;
+ }
+
+ // See if this group contains the new state
+ var target = group.GetState(name);
+ if (target == null)
+ {
+ continue;
+ }
+
+ // If we've got a new state to transition to, unapply the setters from the current state
+ if (group.CurrentState != null)
+ {
+ foreach (Setter setter in group.CurrentState.Setters)
+ {
+ setter.UnApply(visualElement);
+ }
+ }
+
+ // Update the current state
+ group.CurrentState = target;
+
+ // Apply the setters from the new state
+ foreach (Setter setter in target.Setters)
+ {
+ setter.Apply(visualElement);
+ }
+
+ return true;
+ }
+
+ return false;
+ }
+
+ public static bool HasVisualStateGroups(this Element element)
+ {
+ return element.IsSet(VisualStateGroupsProperty);
+ }
+ }
+
+ internal class VisualStateGroupList : IList<VisualStateGroup>
+ {
+ readonly IList<VisualStateGroup> _internalList;
+
+ void Validate(IList<VisualStateGroup> groups)
+ {
+ // If we have 1 group, no need to worry about duplicate group names
+ if (groups.Count > 1)
+ {
+ if (groups.GroupBy(vsg => vsg.Name).Any(g => g.Count() > 1))
+ {
+ throw new InvalidOperationException("VisualStateGroup Names must be unique");
+ }
+ }
+
+ // State names must be unique within this group list, so pull in all
+ // the states in all the groups, group them by name, and see if we have
+ // and duplicates
+ if (groups.SelectMany(group => group.States)
+ .GroupBy(state => state.Name)
+ .Any(g => g.Count() > 1))
+ {
+ throw new InvalidOperationException("VisualState Names must be unique");
+ }
+ }
+
+ public VisualStateGroupList()
+ {
+ _internalList = new WatchAddList<VisualStateGroup>(Validate);
+ }
+
+ void ValidateOnStatesChanged(object sender, EventArgs eventArgs)
+ {
+ Validate(_internalList);
+ }
+
+ public IEnumerator<VisualStateGroup> GetEnumerator()
+ {
+ return _internalList.GetEnumerator();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return ((IEnumerable)_internalList).GetEnumerator();
+ }
+
+ public void Add(VisualStateGroup item)
+ {
+ _internalList.Add(item);
+ item.StatesChanged += ValidateOnStatesChanged;
+ }
+
+ public void Clear()
+ {
+ foreach (var group in _internalList)
+ {
+ group.StatesChanged -= ValidateOnStatesChanged;
+ }
+
+ _internalList.Clear();
+ }
+
+ public bool Contains(VisualStateGroup item)
+ {
+ return _internalList.Contains(item);
+ }
+
+ public void CopyTo(VisualStateGroup[] array, int arrayIndex)
+ {
+ _internalList.CopyTo(array, arrayIndex);
+ }
+
+ public bool Remove(VisualStateGroup item)
+ {
+ item.StatesChanged -= ValidateOnStatesChanged;
+ return _internalList.Remove(item);
+ }
+
+ public int Count => _internalList.Count;
+
+ public bool IsReadOnly => false;
+
+ public int IndexOf(VisualStateGroup item)
+ {
+ return _internalList.IndexOf(item);
+ }
+
+ public void Insert(int index, VisualStateGroup item)
+ {
+ item.StatesChanged += ValidateOnStatesChanged;
+ _internalList.Insert(index, item);
+ }
+
+ public void RemoveAt(int index)
+ {
+ _internalList[index].StatesChanged -= ValidateOnStatesChanged;
+ _internalList.RemoveAt(index);
+ }
+
+ public VisualStateGroup this[int index]
+ {
+ get => _internalList[index];
+ set => _internalList[index] = value;
+ }
+ }
+
+ [RuntimeNameProperty(nameof(Name))]
+ [ContentProperty(nameof(States))]
+ internal sealed class VisualStateGroup
+ {
+ public VisualStateGroup()
+ {
+ States = new WatchAddList<VisualState>(OnStatesChanged);
+ }
+
+ public Type TargetType { get; set; }
+ public string Name { get; set; }
+ public IList<VisualState> States { get; }
+ public VisualState CurrentState { get; internal set; }
+
+ internal VisualState GetState(string name)
+ {
+ foreach (VisualState state in States)
+ {
+ if (string.CompareOrdinal(state.Name, name) == 0)
+ {
+ return state;
+ }
+ }
+
+ return null;
+ }
+
+ internal VisualStateGroup Clone()
+ {
+ var clone = new VisualStateGroup {TargetType = TargetType, Name = Name, CurrentState = CurrentState};
+ foreach (VisualState state in States)
+ {
+ clone.States.Add(state.Clone());
+ }
+
+ return clone;
+ }
+
+ internal event EventHandler StatesChanged;
+
+ void OnStatesChanged(IList<VisualState> list)
+ {
+ if (list.Any(state => string.IsNullOrEmpty(state.Name)))
+ {
+ throw new InvalidOperationException("State names may not be null or empty");
+ }
+
+ StatesChanged?.Invoke(this, EventArgs.Empty);
+ }
+ }
+
+ [RuntimeNameProperty(nameof(Name))]
+ internal sealed class VisualState
+ {
+ public VisualState()
+ {
+ Setters = new ObservableCollection<Setter>();
+ }
+
+ public string Name { get; set; }
+ public IList<Setter> Setters { get;}
+ public Type TargetType { get; set; }
+
+ internal VisualState Clone()
+ {
+ var clone = new VisualState { Name = Name, TargetType = TargetType };
+ foreach (var setter in Setters)
+ {
+ clone.Setters.Add(setter);
+ }
+
+ return clone;
+ }
+ }
+
+ internal static class VisualStateGroupListExtensions
+ {
+ internal static IList<VisualStateGroup> Clone(this IList<VisualStateGroup> groups)
+ {
+ var actual = new VisualStateGroupList();
+ foreach (var group in groups)
+ {
+ actual.Add(group.Clone());
+ }
+
+ return actual;
+ }
+ }
+
+ internal class WatchAddList<T> : IList<T>
+ {
+ readonly Action<List<T>> _onAdd;
+ readonly List<T> _internalList;
+
+ public WatchAddList(Action<List<T>> onAdd)
+ {
+ _onAdd = onAdd;
+ _internalList = new List<T>();
+ }
+
+ public IEnumerator<T> GetEnumerator()
+ {
+ return _internalList.GetEnumerator();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return ((IEnumerable)_internalList).GetEnumerator();
+ }
+
+ public void Add(T item)
+ {
+ _internalList.Add(item);
+ _onAdd(_internalList);
+ }
+
+ public void Clear()
+ {
+ _internalList.Clear();
+ }
+
+ public bool Contains(T item)
+ {
+ return _internalList.Contains(item);
+ }
+
+ public void CopyTo(T[] array, int arrayIndex)
+ {
+ _internalList.CopyTo(array, arrayIndex);
+ }
+
+ public bool Remove(T item)
+ {
+ return _internalList.Remove(item);
+ }
+
+ public int Count => _internalList.Count;
+
+ public bool IsReadOnly => false;
+
+ public int IndexOf(T item)
+ {
+ return _internalList.IndexOf(item);
+ }
+
+ public void Insert(int index, T item)
+ {
+ _internalList.Insert(index, item);
+ _onAdd(_internalList);
+ }
+
+ public void RemoveAt(int index)
+ {
+ _internalList.RemoveAt(index);
+ }
+
+ public T this[int index]
+ {
+ get => _internalList[index];
+ set => _internalList[index] = value;
+ }
+ }
+}
--- /dev/null
+//
+// XamlLoader.cs
+//
+// Author:
+// Stephane Delcroix <stephane@mi8.be>
+//
+// Copyright (c) 2018 Mobile Inception
+// Copyright (c) 2018-2014 Xamarin, Inc
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+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.Xaml.Forms.BaseComponents;
+using Tizen.NUI.XamlBinding;
+using Tizen.NUI.XamlBinding.Internals;
+using Tizen.NUI;
+
+namespace Tizen.NUI.Xaml.Internals
+{
+ [Obsolete ("Replaced by ResourceLoader")]
+ internal static class XamlLoader
+ {
+ static Func<Type, string> xamlFileProvider;
+
+ public static Func<Type, string> XamlFileProvider {
+ get { return xamlFileProvider; }
+ internal set {
+ xamlFileProvider = value;
+ Tizen.NUI.Xaml.DesignMode.IsDesignModeEnabled = true;
+ //¯\_(ツ)_/¯ the previewer forgot to set that bool
+ DoNotThrowOnExceptions = value != null;
+ }
+ }
+
+ internal static bool DoNotThrowOnExceptions { get; set; }
+ }
+}
+
+namespace Tizen.NUI.Xaml
+{
+ static internal class XamlLoader
+ {
+ public static void Load(object view, Type callingType)
+ {
+ try
+ {
+ string xaml = "";
+
+ var assembly = callingType.GetTypeInfo().Assembly;
+ var resourceId = XamlResourceIdAttribute.GetResourceIdForType(callingType);
+
+ if (resourceId == null)
+ {
+ xaml = LegacyGetXamlForType(callingType);
+ }
+ else
+ {
+ using (var stream = assembly.GetManifestResourceStream(resourceId))
+ {
+ if (stream != null)
+ using (var reader = new StreamReader(stream))
+ xaml = reader.ReadToEnd();
+ else
+ xaml = null;
+ }
+ }
+
+ if (string.IsNullOrEmpty(xaml))
+ {
+ 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);
+ }
+ }
+
+ public static T LoadObject<T>(string path)
+ {
+ var xaml = GetAnimationXaml(path);
+ if (string.IsNullOrEmpty(xaml))
+ 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))
+ {
+ 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), ret, (IXmlNamespaceResolver)reader);
+ XamlParser.ParseXaml(rootnode, reader);
+ Visit(rootnode, new HydrationContext
+ {
+ RootElement = ret,
+#pragma warning disable 0618
+ ExceptionHandler = ResourceLoader.ExceptionHandler ?? (Internals.XamlLoader.DoNotThrowOnExceptions ? e => { } : (Action<Exception>)null)
+#pragma warning restore 0618
+ });
+ break;
+ }
+ }
+
+ NameScopeExtensions.PopElement();
+ return ret;
+ }
+
+ public static void Load(object view, string xaml)
+ {
+ using (var textReader = new StringReader(xaml))
+ using (var reader = XmlReader.Create(textReader))
+ {
+ 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), view, (IXmlNamespaceResolver)reader);
+ XamlParser.ParseXaml (rootnode, reader);
+ Visit (rootnode, new HydrationContext {
+ RootElement = view,
+#pragma warning disable 0618
+ ExceptionHandler = ResourceLoader.ExceptionHandler ?? (Internals.XamlLoader.DoNotThrowOnExceptions ? e => { }: (Action<Exception>)null)
+#pragma warning restore 0618
+ });
+ break;
+ }
+ }
+ }
+
+ [Obsolete ("Use the XamlFileProvider to provide xaml files. We will remove this when Cycle 8 hits Stable.")]
+ public static object Create (string xaml, bool doNotThrow = false)
+ {
+ object inflatedView = null;
+ using (var textreader = new StringReader(xaml))
+ using (var reader = XmlReader.Create (textreader)) {
+ 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), null, (IXmlNamespaceResolver)reader);
+ XamlParser.ParseXaml (rootnode, reader);
+ var visitorContext = new HydrationContext {
+ ExceptionHandler = doNotThrow ? e => { } : (Action<Exception>)null,
+ };
+ var cvv = new CreateValuesVisitor (visitorContext);
+ cvv.Visit ((ElementNode)rootnode, null);
+ inflatedView = rootnode.Root = visitorContext.Values [rootnode];
+ visitorContext.RootElement = inflatedView as BindableObject;
+
+ Visit (rootnode, visitorContext);
+ break;
+ }
+ }
+ return inflatedView;
+ }
+
+ static void Visit (RootNode rootnode, HydrationContext visitorContext)
+ {
+ rootnode.Accept (new XamlNodeVisitor ((node, parent) => node.Parent = parent), null); //set parents for {StaticResource}
+ rootnode.Accept (new ExpandMarkupsVisitor (visitorContext), null);
+ rootnode.Accept (new PruneIgnoredNodesVisitor(), null);
+ rootnode.Accept (new NamescopingVisitor (visitorContext), null); //set namescopes for {x:Reference}
+ rootnode.Accept (new CreateValuesVisitor (visitorContext), null);
+ rootnode.Accept (new RegisterXNamesVisitor (visitorContext), null);
+ rootnode.Accept (new FillResourceDictionariesVisitor (visitorContext), null);
+ rootnode.Accept (new ApplyPropertiesVisitor (visitorContext, true), null);
+ }
+
+ static string GetAnimationXaml(string animationXamlPath)
+ {
+ string xaml;
+ if (File.Exists(animationXamlPath))
+ {
+ StreamReader reader = new StreamReader(animationXamlPath);
+ xaml = reader.ReadToEnd();
+ reader.Close();
+ reader.Dispose();
+ Tizen.Log.Fatal("NUI", "File is exist!, try with xaml: " + xaml);
+ return xaml;
+ }
+
+ return null;
+ }
+ static string GetXamlForType(Type type)
+ {
+ //the Previewer might want to provide it's own xaml for this... let them do that
+ //the check at the end is preferred (using ResourceLoader). keep this until all the previewers are updated
+
+ string xaml;
+ string resourceName = type.Name + ".xaml";
+ string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
+
+ Tizen.Log.Fatal("NUI", "the resource path: " + resource);
+ int windowWidth = Window.Instance.Size.Width;
+ int windowHeight = Window.Instance.Size.Height;
+
+ string likelyResourcePath = resource + "layout/" + windowWidth.ToString() + "x" + windowHeight.ToString() + "/" + resourceName;
+ Tizen.Log.Fatal("NUI", "the resource path: " + likelyResourcePath);
+
+ if (!File.Exists(likelyResourcePath))
+ {
+ likelyResourcePath = resource + "layout/" + resourceName;
+ }
+
+ //Find the xaml file in the layout folder
+ if (File.Exists(likelyResourcePath))
+ {
+ StreamReader reader = new StreamReader(likelyResourcePath);
+ xaml = reader.ReadToEnd();
+ reader.Close();
+ reader.Dispose();
+ Tizen.Log.Fatal("NUI", "File is exist!, try with xaml: " + xaml);
+ var pattern = String.Format("x:Class *= *\"{0}\"", type.FullName);
+ var regex = new Regex(pattern, RegexOptions.ECMAScript);
+ if (regex.IsMatch(xaml) || xaml.Contains(String.Format("x:Class=\"{0}\"", type.FullName)))
+ {
+ return xaml;
+ }
+ else
+ {
+ throw new XamlParseException(string.Format("Can't find type {0}", type.FullName), new XmlLineInfo());
+ }
+ }
+
+ return null;
+ }
+
+ //if the assembly was generated using a version of XamlG that doesn't outputs XamlResourceIdAttributes, we still need to find the resource, and load it
+ static readonly Dictionary<Type, string> XamlResources = new Dictionary<Type, string>();
+ static string LegacyGetXamlForType(Type type)
+ {
+ var assembly = type.GetTypeInfo().Assembly;
+
+ string resourceId;
+ if (XamlResources.TryGetValue(type, out resourceId)) {
+ var result = ReadResourceAsXaml(type, assembly, resourceId);
+ if (result != null)
+ return result;
+ }
+
+ var likelyResourceName = type.Name + ".xaml";
+ var resourceNames = assembly.GetManifestResourceNames();
+ string resourceName = null;
+
+ // first pass, pray to find it because the user named it correctly
+
+ foreach (var resource in resourceNames) {
+ if (ResourceMatchesFilename(assembly, resource, likelyResourceName)) {
+ resourceName = resource;
+ var xaml = ReadResourceAsXaml(type, assembly, resource);
+ if (xaml != null)
+ return xaml;
+ }
+ }
+
+ // okay maybe they at least named it .xaml
+
+ foreach (var resource in resourceNames) {
+ if (!resource.EndsWith(".xaml", StringComparison.OrdinalIgnoreCase))
+ continue;
+
+ resourceName = resource;
+ var xaml = ReadResourceAsXaml(type, assembly, resource);
+ if (xaml != null)
+ return xaml;
+ }
+
+ foreach (var resource in resourceNames) {
+ if (resource.EndsWith(".xaml", StringComparison.OrdinalIgnoreCase))
+ continue;
+
+ resourceName = resource;
+ var xaml = ReadResourceAsXaml(type, assembly, resource, true);
+ if (xaml != null)
+ return xaml;
+ }
+
+ return null;
+ }
+
+ //legacy...
+ static bool ResourceMatchesFilename(Assembly assembly, string resource, string filename)
+ {
+ try {
+ var info = assembly.GetManifestResourceInfo(resource);
+
+ if (!string.IsNullOrEmpty(info.FileName) &&
+ string.Compare(info.FileName, filename, StringComparison.OrdinalIgnoreCase) == 0)
+ return true;
+ }
+ catch (PlatformNotSupportedException) {
+ // Because Win10 + .NET Native
+ }
+
+ if (resource.EndsWith("." + filename, StringComparison.OrdinalIgnoreCase) ||
+ string.Compare(resource, filename, StringComparison.OrdinalIgnoreCase) == 0)
+ return true;
+
+ return false;
+ }
+
+ //part of the legacy as well...
+ static string ReadResourceAsXaml(Type type, Assembly assembly, string likelyTargetName, bool validate = false)
+ {
+ using (var stream = assembly.GetManifestResourceStream(likelyTargetName))
+ using (var reader = new StreamReader(stream)) {
+ if (validate) {
+ // terrible validation of XML. Unfortunately it will probably work most of the time since comments
+ // also start with a <. We can't bring in any real deps.
+
+ var firstNonWhitespace = (char)reader.Read();
+ while (char.IsWhiteSpace(firstNonWhitespace))
+ firstNonWhitespace = (char)reader.Read();
+
+ if (firstNonWhitespace != '<')
+ return null;
+
+ stream.Seek(0, SeekOrigin.Begin);
+ }
+
+ var xaml = reader.ReadToEnd();
+
+ var pattern = String.Format("x:Class *= *\"{0}\"", type.FullName);
+ var regex = new Regex(pattern, RegexOptions.ECMAScript);
+ if (regex.IsMatch(xaml) || xaml.Contains(String.Format("x:Class=\"{0}\"", type.FullName)))
+ return xaml;
+ }
+ return null;
+ }
+
+ public class RuntimeRootNode : RootNode
+ {
+ public RuntimeRootNode(XmlType xmlType, object root, IXmlNamespaceResolver resolver) : base (xmlType, resolver)
+ {
+ Root = root;
+ }
+
+ public object Root { get; internal set; }
+ }
+ }
+}
--- /dev/null
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Xml;
+using Tizen.NUI.XamlBinding;
+using Tizen.NUI.XamlBinding.Internals;
+
+namespace Tizen.NUI.Xaml
+{
+ internal interface INode
+ {
+ List<string> IgnorablePrefixes { get; set; }
+
+ IXmlNamespaceResolver NamespaceResolver { get; }
+
+ INode Parent { get; set; }
+
+ void Accept(IXamlNodeVisitor visitor, INode parentNode);
+ INode Clone();
+ }
+
+ internal interface IValueNode : INode
+ {
+ }
+
+ internal interface IElementNode : INode, IListNode
+ {
+ Dictionary<XmlName, INode> Properties { get; }
+ List<XmlName> SkipProperties { get; }
+ INameScope Namescope { get; }
+ XmlType XmlType { get; }
+ string NamespaceURI { get; }
+ }
+
+ internal interface IListNode : INode
+ {
+ List<INode> CollectionItems { get; }
+ }
+
+ [DebuggerDisplay("{NamespaceUri}:{Name}")]
+ internal class XmlType
+ {
+ public XmlType(string namespaceUri, string name, IList<XmlType> typeArguments)
+ {
+ NamespaceUri = namespaceUri;
+ Name = name;
+ TypeArguments = typeArguments;
+ }
+
+ public string NamespaceUri { get; }
+ public string Name { get; }
+ public IList<XmlType> TypeArguments { get; }
+ }
+
+ internal abstract class BaseNode : IXmlLineInfo, INode
+ {
+ protected BaseNode(IXmlNamespaceResolver namespaceResolver, int linenumber = -1, int lineposition = -1)
+ {
+ NamespaceResolver = namespaceResolver;
+ LineNumber = linenumber;
+ LinePosition = lineposition;
+ }
+
+ public IXmlNamespaceResolver NamespaceResolver { get; }
+ public INode Parent { get; set; }
+ public List<string> IgnorablePrefixes { get; set; }
+ public int LineNumber { get; set; }
+ public int LinePosition { get; set; }
+
+ public bool HasLineInfo() => LineNumber >= 0 && LinePosition >= 0;
+
+ public abstract void Accept(IXamlNodeVisitor visitor, INode parentNode);
+ public abstract INode Clone();
+ }
+
+ [DebuggerDisplay("{Value}")]
+ internal class ValueNode : BaseNode, IValueNode
+ {
+ public ValueNode(object value, IXmlNamespaceResolver namespaceResolver, int linenumber = -1, int lineposition = -1)
+ : base(namespaceResolver, linenumber, lineposition)
+ {
+ Value = value;
+ }
+
+ public object Value { get; set; }
+
+ public override void Accept(IXamlNodeVisitor visitor, INode parentNode)
+ {
+ visitor.Visit(this, parentNode);
+ }
+
+ public override INode Clone() => new ValueNode(Value, NamespaceResolver, LineNumber, LinePosition) {
+ IgnorablePrefixes = IgnorablePrefixes
+ };
+ }
+
+ [DebuggerDisplay("{MarkupString}")]
+ internal class MarkupNode : BaseNode, IValueNode
+ {
+ public MarkupNode(string markupString, IXmlNamespaceResolver namespaceResolver, int linenumber = -1, int lineposition = -1)
+ : base(namespaceResolver, linenumber, lineposition)
+ {
+ MarkupString = markupString;
+ }
+
+ public string MarkupString { get; }
+
+ public override void Accept(IXamlNodeVisitor visitor, INode parentNode)
+ {
+ visitor.Visit(this, parentNode);
+ }
+
+ public override INode Clone() => new MarkupNode(MarkupString, NamespaceResolver, LineNumber, LinePosition) {
+ IgnorablePrefixes = IgnorablePrefixes
+ };
+ }
+
+ [DebuggerDisplay("{XmlType.Name}")]
+ internal class ElementNode : BaseNode, IValueNode, IElementNode
+ {
+ public ElementNode(XmlType type, string namespaceURI, IXmlNamespaceResolver namespaceResolver, int linenumber = -1,
+ int lineposition = -1)
+ : base(namespaceResolver, linenumber, lineposition)
+ {
+ Properties = new Dictionary<XmlName, INode>();
+ SkipProperties = new List<XmlName>();
+ CollectionItems = new List<INode>();
+ XmlType = type;
+ NamespaceURI = namespaceURI;
+ }
+
+ public Dictionary<XmlName, INode> Properties { get; }
+ public List<XmlName> SkipProperties { get; }
+ public List<INode> CollectionItems { get; }
+ public XmlType XmlType { get; }
+ public string NamespaceURI { get; }
+ public INameScope Namescope { get; set; }
+
+ public override void Accept(IXamlNodeVisitor visitor, INode parentNode)
+ {
+ if (!SkipVisitNode(visitor, parentNode) && visitor.VisitingMode == TreeVisitingMode.TopDown)
+ visitor.Visit(this, parentNode);
+
+ if (!SkipChildren(visitor, this, parentNode)) {
+ foreach (var node in Properties.Values.ToList())
+ node.Accept(visitor, this);
+ foreach (var node in CollectionItems)
+ node.Accept(visitor, this);
+ }
+
+ if (!SkipVisitNode(visitor, parentNode) && visitor.VisitingMode == TreeVisitingMode.BottomUp)
+ visitor.Visit(this, parentNode);
+
+ }
+
+ bool IsDataTemplate(INode parentNode)
+ {
+ var parentElement = parentNode as IElementNode;
+ INode createContent;
+ if (parentElement != null &&
+ parentElement.Properties.TryGetValue(XmlName._CreateContent, out createContent) &&
+ createContent == this)
+ return true;
+ return false;
+ }
+
+ protected bool SkipChildren(IXamlNodeVisitor visitor, INode node, INode parentNode) =>
+ (visitor.StopOnDataTemplate && IsDataTemplate(parentNode))
+ || (visitor.StopOnResourceDictionary && visitor.IsResourceDictionary(this))
+ || visitor.SkipChildren(node, parentNode);
+
+ protected bool SkipVisitNode(IXamlNodeVisitor visitor, INode parentNode) =>
+ !visitor.VisitNodeOnDataTemplate && IsDataTemplate(parentNode);
+
+ public override INode Clone()
+ {
+ var clone = new ElementNode(XmlType, NamespaceURI, NamespaceResolver, LineNumber, LinePosition) {
+ IgnorablePrefixes = IgnorablePrefixes
+ };
+ foreach (var kvp in Properties)
+ clone.Properties.Add(kvp.Key, kvp.Value.Clone());
+ foreach (var p in SkipProperties)
+ clone.SkipProperties.Add(p);
+ foreach (var p in CollectionItems)
+ clone.CollectionItems.Add(p.Clone());
+ return clone;
+ }
+ }
+
+ internal abstract class RootNode : ElementNode
+ {
+ protected RootNode(XmlType xmlType, IXmlNamespaceResolver nsResolver) : base(xmlType, xmlType.NamespaceUri, nsResolver)
+ {
+ }
+
+ public override void Accept(IXamlNodeVisitor visitor, INode parentNode)
+ {
+ if (!SkipVisitNode(visitor, parentNode) && visitor.VisitingMode == TreeVisitingMode.TopDown)
+ visitor.Visit(this, parentNode);
+
+ if (!SkipChildren(visitor, this, parentNode)) {
+ foreach (var node in Properties.Values.ToList())
+ node.Accept(visitor, this);
+ foreach (var node in CollectionItems)
+ node.Accept(visitor, this);
+ }
+
+ if (!SkipVisitNode(visitor, parentNode) && visitor.VisitingMode == TreeVisitingMode.BottomUp)
+ visitor.Visit(this, parentNode);
+ }
+ }
+
+ internal class ListNode : BaseNode, IListNode, IValueNode
+ {
+ public ListNode(IList<INode> nodes, IXmlNamespaceResolver namespaceResolver, int linenumber = -1, int lineposition = -1)
+ : base(namespaceResolver, linenumber, lineposition)
+ {
+ CollectionItems = nodes.ToList();
+ }
+
+ public XmlName XmlName { get; set; }
+ public List<INode> CollectionItems { get; set; }
+
+ public override void Accept(IXamlNodeVisitor visitor, INode parentNode)
+ {
+ if (visitor.VisitingMode == TreeVisitingMode.TopDown)
+ visitor.Visit(this, parentNode);
+ foreach (var node in CollectionItems)
+ node.Accept(visitor, this);
+ if (visitor.VisitingMode == TreeVisitingMode.BottomUp)
+ visitor.Visit(this, parentNode);
+ }
+
+ public override INode Clone()
+ {
+ var items = new List<INode>();
+ foreach (var p in CollectionItems)
+ items.Add(p.Clone());
+ return new ListNode(items, NamespaceResolver, LineNumber, LinePosition) {
+ IgnorablePrefixes = IgnorablePrefixes
+ };
+ }
+ }
+
+ internal static class INodeExtensions
+ {
+ public static bool SkipPrefix(this INode node, string prefix)
+ {
+ do {
+ if (node.IgnorablePrefixes != null && node.IgnorablePrefixes.Contains(prefix))
+ return true;
+ node = node.Parent;
+ } while (node != null);
+ return false;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.Xaml
+{
+ internal interface IXamlNodeVisitor
+ {
+ TreeVisitingMode VisitingMode { get; }
+ bool StopOnDataTemplate { get; }
+ bool VisitNodeOnDataTemplate { get; }
+ bool StopOnResourceDictionary { get; }
+
+ void Visit(ValueNode node, INode parentNode);
+ void Visit(MarkupNode node, INode parentNode);
+ void Visit(ElementNode node, INode parentNode);
+ 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 {
+ TopDown,
+ BottomUp
+ }
+
+ internal class XamlNodeVisitor : IXamlNodeVisitor
+ {
+ readonly Action<INode, INode> action;
+
+ public XamlNodeVisitor(Action<INode, INode> action, TreeVisitingMode visitingMode = TreeVisitingMode.TopDown, bool stopOnDataTemplate = false, bool visitNodeOnDataTemplate = true)
+ {
+ this.action = action;
+ VisitingMode = visitingMode;
+ StopOnDataTemplate = stopOnDataTemplate;
+ VisitNodeOnDataTemplate = visitNodeOnDataTemplate;
+ }
+
+ public TreeVisitingMode VisitingMode { get; }
+ public bool StopOnDataTemplate { get; }
+ public bool StopOnResourceDictionary { get; }
+ public bool VisitNodeOnDataTemplate { get; }
+
+ public void Visit(ValueNode node, INode parentNode) => action(node, parentNode);
+ public void Visit(MarkupNode node, INode parentNode) => action(node, parentNode);
+ public void Visit(ElementNode node, INode parentNode) => action(node, parentNode);
+ 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
--- /dev/null
+using System;
+using System.Diagnostics;
+using System.Text;
+using System.Xml;
+
+namespace Tizen.NUI.Xaml
+{
+ internal class XamlParseException : Exception
+ {
+ readonly string _unformattedMessage;
+
+ static private StringBuilder GetStackInfo()
+ {
+ StringBuilder ret = new StringBuilder("\nStack:\n");
+
+ StackTrace st = new StackTrace(true);
+
+ 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;
+ }
+
+ public IXmlLineInfo XmlInfo { get; private set; }
+
+ internal string UnformattedMessage
+ {
+ get { return _unformattedMessage ?? Message; }
+ }
+
+ static string FormatMessage(string message, IXmlLineInfo xmlinfo)
+ {
+ if (xmlinfo == null || !xmlinfo.HasLineInfo())
+ return message;
+ return string.Format("Position {0}:{1}. {2}", xmlinfo.LineNumber, xmlinfo.LinePosition, message);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+//
+// XamlParser.cs
+//
+// Author:
+// Stephane Delcroix <stephane@mi8.be>
+//
+// Copyright (c) 2013 Mobile Inception
+// Copyright (c) 2013-2014 Xamarin, Inc
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Reflection;
+using System.Xml;
+using Tizen.NUI.XamlBinding;
+using Tizen.NUI.Xaml.Forms.BaseComponents;
+using Tizen.NUI.XamlBinding.Internals;
+
+namespace Tizen.NUI.Xaml
+{
+ internal static class XamlParser
+ {
+ 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";
+ public const string McUri = "http://schemas.openxmlformats.org/markup-compatibility/2006";
+
+ public static void ParseXaml(RootNode rootNode, XmlReader reader)
+ {
+ IList<KeyValuePair<string, string>> xmlns;
+ var attributes = ParseXamlAttributes(reader, out xmlns);
+ var prefixes = PrefixesToIgnore(xmlns);
+ (rootNode.IgnorablePrefixes ?? (rootNode.IgnorablePrefixes=new List<string>())).AddRange(prefixes);
+ rootNode.Properties.AddRange(attributes);
+ ParseXamlElementFor(rootNode, reader);
+ }
+
+ static void ParseXamlElementFor(IElementNode node, XmlReader reader)
+ {
+ Debug.Assert(reader.NodeType == XmlNodeType.Element);
+
+ var elementName = reader.Name;
+ var isEmpty = reader.IsEmptyElement;
+
+ if (isEmpty)
+ return;
+
+ while (reader.Read())
+ {
+ switch (reader.NodeType)
+ {
+ case XmlNodeType.EndElement:
+ Debug.Assert(reader.Name == elementName); //make sure we close the right element
+ return;
+ case XmlNodeType.Element:
+ // 1. Property Element.
+ if (reader.Name.Contains("."))
+ {
+ XmlName name;
+ if (reader.Name.StartsWith(elementName + ".", StringComparison.Ordinal))
+ name = new XmlName(reader.NamespaceURI, reader.Name.Substring(elementName.Length + 1));
+ else //Attached DP
+ name = new XmlName(reader.NamespaceURI, reader.LocalName);
+
+ var prop = ReadNode(reader);
+ if (prop != null)
+ node.Properties.Add(name, prop);
+ }
+ // 2. Xaml2009 primitives, x:Arguments, ...
+ else if (reader.NamespaceURI == X2009Uri && reader.LocalName == "Arguments")
+ {
+ var prop = ReadNode(reader);
+ if (prop != null)
+ node.Properties.Add(XmlName.xArguments, prop);
+ }
+ // 3. DataTemplate (should be handled by 4.)
+ else if ((node.XmlType.NamespaceUri == XFUri || node.XmlType.NamespaceUri == NUI2018Uri) &&
+ (node.XmlType.Name == "DataTemplate" || node.XmlType.Name == "ControlTemplate"))
+ {
+ var prop = ReadNode(reader, true);
+ if (prop != null)
+ node.Properties.Add(XmlName._CreateContent, prop);
+ }
+ // 4. Implicit content, implicit collection, or collection syntax. Add to CollectionItems, resolve case later.
+ else
+ {
+ var item = ReadNode(reader, true);
+ if (item != null)
+ node.CollectionItems.Add(item);
+ }
+ break;
+ case XmlNodeType.Whitespace:
+ break;
+ case XmlNodeType.Text:
+ case XmlNodeType.CDATA:
+ if (node.CollectionItems.Count == 1 && node.CollectionItems[0] is ValueNode)
+ ((ValueNode)node.CollectionItems[0]).Value += reader.Value.Trim();
+ else
+ node.CollectionItems.Add(new ValueNode(reader.Value.Trim(), (IXmlNamespaceResolver)reader));
+ break;
+ default:
+ Debug.WriteLine("Unhandled node {0} {1} {2}", reader.NodeType, reader.Name, reader.Value);
+ break;
+ }
+ }
+ }
+
+ static INode ReadNode(XmlReader reader, bool nested = false)
+ {
+ var skipFirstRead = nested;
+ Debug.Assert(reader.NodeType == XmlNodeType.Element);
+ var name = reader.Name;
+ List<INode> nodes = new List<INode>();
+ INode node = null;
+
+ while (skipFirstRead || reader.Read())
+ {
+ skipFirstRead = false;
+
+ switch (reader.NodeType)
+ {
+ case XmlNodeType.EndElement:
+ Debug.Assert(reader.Name == name);
+ if (nodes.Count == 0) //Empty element
+ return null;
+ if (nodes.Count == 1)
+ return nodes[0];
+ return new ListNode(nodes, (IXmlNamespaceResolver)reader, ((IXmlLineInfo)reader).LineNumber,
+ ((IXmlLineInfo)reader).LinePosition);
+ case XmlNodeType.Element:
+ var isEmpty = reader.IsEmptyElement && reader.Name == name;
+ var elementName = reader.Name;
+ var elementNsUri = reader.NamespaceURI;
+ var elementXmlInfo = (IXmlLineInfo)reader;
+ IList<KeyValuePair<string, string>> xmlns;
+
+ var attributes = ParseXamlAttributes(reader, out xmlns);
+ var prefixes = PrefixesToIgnore(xmlns);
+
+ IList<XmlType> typeArguments = null;
+ if (attributes.Any(kvp => kvp.Key == XmlName.xTypeArguments))
+ {
+ typeArguments =
+ ((ValueNode)attributes.First(kvp => kvp.Key == XmlName.xTypeArguments).Value).Value as IList<XmlType>;
+ }
+
+ node = new ElementNode(new XmlType(elementNsUri, elementName, typeArguments), elementNsUri,
+ reader as IXmlNamespaceResolver, elementXmlInfo.LineNumber, elementXmlInfo.LinePosition);
+ ((IElementNode)node).Properties.AddRange(attributes);
+ (node.IgnorablePrefixes ?? (node.IgnorablePrefixes = new List<string>()))?.AddRange(prefixes);
+
+ ParseXamlElementFor((IElementNode)node, reader);
+ nodes.Add(node);
+ if (isEmpty || nested)
+ return node;
+ break;
+ case XmlNodeType.Text:
+ node = new ValueNode(reader.Value.Trim(), (IXmlNamespaceResolver)reader, ((IXmlLineInfo)reader).LineNumber,
+ ((IXmlLineInfo)reader).LinePosition);
+ nodes.Add(node);
+ break;
+ case XmlNodeType.Whitespace:
+ break;
+ default:
+ Debug.WriteLine("Unhandled node {0} {1} {2}", reader.NodeType, reader.Name, reader.Value);
+ break;
+ }
+ }
+ throw new XamlParseException("Closing PropertyElement expected", (IXmlLineInfo)reader);
+ }
+
+ static IList<KeyValuePair<XmlName, INode>> ParseXamlAttributes(XmlReader reader, out IList<KeyValuePair<string,string>> xmlns)
+ {
+ Debug.Assert(reader.NodeType == XmlNodeType.Element);
+ var attributes = new List<KeyValuePair<XmlName, INode>>();
+ xmlns = new List<KeyValuePair<string, string>>();
+ for (var i = 0; i < reader.AttributeCount; i++)
+ {
+ reader.MoveToAttribute(i);
+
+ //skip xmlns
+ if (reader.NamespaceURI == "http://www.w3.org/2000/xmlns/") {
+ xmlns.Add(new KeyValuePair<string, string>(reader.LocalName, reader.Value));
+ continue;
+ }
+
+ var namespaceUri = reader.NamespaceURI;
+ if (reader.LocalName.Contains(".") && namespaceUri == "")
+ namespaceUri = ((IXmlNamespaceResolver)reader).LookupNamespace("");
+ var propertyName = new XmlName(namespaceUri, reader.LocalName);
+
+ object value = reader.Value;
+
+ if (reader.NamespaceURI == X2006Uri)
+ {
+ switch (reader.Name) {
+ case "x:Key":
+ propertyName = XmlName.xKey;
+ break;
+ case "x:Name":
+ propertyName = XmlName.xName;
+ break;
+ case "x:Class":
+ case "x:FieldModifier":
+ continue;
+ default:
+ Debug.WriteLine("Unhandled attribute {0}", reader.Name);
+ continue;
+ }
+ }
+
+ if (reader.NamespaceURI == X2009Uri)
+ {
+ switch (reader.Name) {
+ case "x:Key":
+ propertyName = XmlName.xKey;
+ break;
+ case "x:Name":
+ propertyName = XmlName.xName;
+ break;
+ case "x:TypeArguments":
+ propertyName = XmlName.xTypeArguments;
+ value = TypeArgumentsParser.ParseExpression((string)value, (IXmlNamespaceResolver)reader, (IXmlLineInfo)reader);
+ break;
+ case "x:DataType":
+ propertyName = XmlName.xDataType;
+ break;
+ case "x:Class":
+ case "x:FieldModifier":
+ continue;
+ case "x:FactoryMethod":
+ propertyName = XmlName.xFactoryMethod;
+ break;
+ case "x:Arguments":
+ propertyName = XmlName.xArguments;
+ break;
+ default:
+ Debug.WriteLine("Unhandled attribute {0}", reader.Name);
+ continue;
+ }
+ }
+
+ var propertyNode = GetValueNode(value, reader);
+ attributes.Add(new KeyValuePair<XmlName, INode>(propertyName, propertyNode));
+ }
+ reader.MoveToElement();
+ return attributes;
+ }
+
+ static IList<string> PrefixesToIgnore(IList<KeyValuePair<string, string>> xmlns)
+ {
+ var prefixes = new List<string>();
+ foreach (var kvp in xmlns) {
+ var prefix = kvp.Key;
+
+ string typeName = null, ns = null, asm = null, targetPlatform = null;
+ XmlnsHelper.ParseXmlns(kvp.Value, out typeName, out ns, out asm, out targetPlatform);
+ if (targetPlatform == null)
+ continue;
+ try {
+ if (targetPlatform != Device.RuntimePlatform)
+ {
+ // Special case for Windows backward compatibility
+ if (targetPlatform == "Windows" && Device.RuntimePlatform == Device.UWP)
+ continue;
+
+ prefixes.Add(prefix);
+ }
+ } catch (InvalidOperationException) {
+ prefixes.Add(prefix);
+ }
+ }
+ return prefixes;
+ }
+
+ static IValueNode GetValueNode(object value, XmlReader reader)
+ {
+ var valueString = value as string;
+ if (valueString != null && valueString.Trim().StartsWith("{}", StringComparison.Ordinal))
+ {
+ return new ValueNode(valueString.Substring(2), (IXmlNamespaceResolver)reader, ((IXmlLineInfo)reader).LineNumber,
+ ((IXmlLineInfo)reader).LinePosition);
+ }
+ if (valueString != null && valueString.Trim().StartsWith("{", StringComparison.Ordinal))
+ {
+ return new MarkupNode(valueString.Trim(), reader as IXmlNamespaceResolver, ((IXmlLineInfo)reader).LineNumber,
+ ((IXmlLineInfo)reader).LinePosition);
+ }
+ return new ValueNode(value, (IXmlNamespaceResolver)reader, ((IXmlLineInfo)reader).LineNumber,
+ ((IXmlLineInfo)reader).LinePosition);
+ }
+
+ static IList<XmlnsDefinitionAttribute> s_xmlnsDefinitions;
+ public static IList<Assembly> s_assemblies = new List<Assembly>();// = new Assembly[]{};
+
+ static void GatherXmlnsDefinitionAttributes()
+ {
+ //this could be extended to look for [XmlnsDefinition] in all assemblies
+ // var assemblies = new [] {
+ // typeof(View).GetTypeInfo().Assembly,
+ // //typeof(XamlLoader).GetTypeInfo().Assembly,
+ // };
+ // s_assemblies = new Assembly[]{typeof(View).GetTypeInfo().Assembly};
+ s_assemblies.Add(typeof(View).GetTypeInfo().Assembly);
+
+ s_xmlnsDefinitions = new List<XmlnsDefinitionAttribute>();
+
+ foreach (var assembly in s_assemblies)
+ foreach (XmlnsDefinitionAttribute attribute in assembly.GetCustomAttributes(typeof(XmlnsDefinitionAttribute))) {
+ s_xmlnsDefinitions.Add(attribute);
+ attribute.AssemblyName = attribute.AssemblyName ?? assembly.FullName;
+ }
+ }
+
+ public static Type GetElementType(XmlType xmlType, IXmlLineInfo xmlInfo, Assembly currentAssembly,
+ out XamlParseException exception)
+ {
+ if (s_xmlnsDefinitions == null)
+ GatherXmlnsDefinitionAttributes();
+
+ var namespaceURI = xmlType.NamespaceUri;
+ var elementName = xmlType.Name;
+ var typeArguments = xmlType.TypeArguments;
+ exception = null;
+
+ var lookupAssemblies = new List<XmlnsDefinitionAttribute>();
+ var lookupNames = new List<string>();
+
+ foreach (var xmlnsDef in s_xmlnsDefinitions) {
+ if (xmlnsDef.XmlNamespace != namespaceURI)
+ continue;
+ lookupAssemblies.Add(xmlnsDef);
+ }
+
+ if (lookupAssemblies.Count == 0) {
+ string ns, asmstring, _;
+ XmlnsHelper.ParseXmlns(namespaceURI, out _, out ns, out asmstring, out _);
+ lookupAssemblies.Add(new XmlnsDefinitionAttribute(namespaceURI, ns) {
+ AssemblyName = asmstring ?? currentAssembly.FullName
+ });
+ }
+
+ lookupNames.Add(elementName);
+ lookupNames.Add(elementName + "Extension");
+
+ for (var i = 0; i < lookupNames.Count; i++)
+ {
+ var name = lookupNames[i];
+ if (name.Contains(":"))
+ name = name.Substring(name.LastIndexOf(':') + 1);
+ if (typeArguments != null)
+ name += "`" + typeArguments.Count; //this will return an open generic Type
+ lookupNames[i] = name;
+ }
+
+ Type type = null;
+ foreach (var asm in lookupAssemblies) {
+ foreach (var name in lookupNames)
+ if ((type = Type.GetType($"{asm.ClrNamespace}.{name}, {asm.AssemblyName}")) != null)
+ break;
+ if (type != null)
+ break;
+ }
+
+ if (type != null && typeArguments != null)
+ {
+ XamlParseException innerexception = null;
+ var args = typeArguments.Select(delegate(XmlType xmltype)
+ {
+ XamlParseException xpe;
+ var t = GetElementType(xmltype, xmlInfo, currentAssembly, out xpe);
+ if (xpe != null)
+ {
+ innerexception = xpe;
+ return null;
+ }
+ return t;
+ }).ToArray();
+ if (innerexception != null)
+ {
+ exception = innerexception;
+ return null;
+ }
+ type = type.MakeGenericType(args);
+ }
+
+ if (type == null)
+ exception = new XamlParseException($"Type {elementName} not found in xmlns {namespaceURI}", xmlInfo);
+
+ return type;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.Diagnostics;
+
+namespace Tizen.NUI.Xaml
+{
+ [DebuggerDisplay("{NamespaceURI}:{LocalName}")]
+ internal struct XmlName
+ {
+ public static readonly XmlName _CreateContent = new XmlName("_", "CreateContent");
+ public static readonly XmlName xKey = new XmlName("x", "Key");
+ public static readonly XmlName xName = new XmlName("x", "Name");
+ public static readonly XmlName xTypeArguments = new XmlName("x", "TypeArguments");
+ public static readonly XmlName xArguments = new XmlName("x", "Arguments");
+ public static readonly XmlName xFactoryMethod = new XmlName("x", "FactoryMethod");
+ public static readonly XmlName xDataType = new XmlName("x", "DataType");
+ public static readonly XmlName Empty = new XmlName();
+
+ public string NamespaceURI { get; }
+ public string LocalName { get; }
+
+ public XmlName(string namespaceUri, string localName)
+ {
+ NamespaceURI = namespaceUri;
+ LocalName = localName;
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (obj == null)
+ return false;
+ if (obj.GetType() != typeof (XmlName))
+ return false;
+ var other = (XmlName)obj;
+ return NamespaceURI == other.NamespaceURI && LocalName == other.LocalName;
+ }
+
+ public bool Equals(string namespaceUri, string localName)
+ => Equals(new XmlName(namespaceUri, localName));
+
+ public override int GetHashCode()
+ {
+ unchecked
+ {
+ int hashCode = 0;
+ if (NamespaceURI != null)
+ hashCode = NamespaceURI.GetHashCode();
+ if (LocalName != null)
+ hashCode = (hashCode * 397) ^ LocalName.GetHashCode();
+ return hashCode;
+ }
+ }
+
+ public static bool operator ==(XmlName x1, XmlName x2)
+ => x1.NamespaceURI == x2.NamespaceURI && x1.LocalName == x2.LocalName;
+
+ public static bool operator !=(XmlName x1, XmlName x2)
+ => !(x1 == x2);
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.Xaml
+{
+ internal static class XmlnsHelper
+ {
+ public static string ParseNamespaceFromXmlns(string xmlns)
+ {
+ string typeName;
+ string ns;
+ string asm;
+ string targetPlatform;
+
+ ParseXmlns(xmlns, out typeName, out ns, out asm, out targetPlatform);
+
+ return ns;
+ }
+
+ public static void ParseXmlns(string xmlns, out string typeName, out string ns, out string asm, out string targetPlatform)
+ {
+ typeName = ns = asm = targetPlatform = null;
+
+ xmlns = xmlns.Trim();
+
+ if (xmlns.StartsWith("using:", StringComparison.Ordinal)) {
+ ParseUsing(xmlns, out typeName, out ns, out asm, out targetPlatform);
+ return;
+ }
+ ParseClrNamespace(xmlns, out typeName, out ns, out asm, out targetPlatform);
+ }
+
+ static void ParseClrNamespace(string xmlns, out string typeName, out string ns, out string asm, out string targetPlatform)
+ {
+ typeName = ns = asm = targetPlatform = null;
+
+ foreach (var decl in xmlns.Split(';'))
+ {
+ if (decl.StartsWith("clr-namespace:", StringComparison.Ordinal))
+ {
+ ns = decl.Substring(14, decl.Length - 14);
+ continue;
+ }
+ if (decl.StartsWith("assembly=", StringComparison.Ordinal))
+ {
+ asm = decl.Substring(9, decl.Length - 9);
+ continue;
+ }
+ if (decl.StartsWith("targetPlatform=", StringComparison.Ordinal)) {
+ targetPlatform = decl.Substring(15, decl.Length - 15);
+ continue;
+ }
+ var nsind = decl.LastIndexOf(".", StringComparison.Ordinal);
+ if (nsind > 0)
+ {
+ ns = decl.Substring(0, nsind);
+ typeName = decl.Substring(nsind + 1, decl.Length - nsind - 1);
+ }
+ else
+ typeName = decl;
+ }
+ }
+
+ static void ParseUsing(string xmlns, out string typeName, out string ns, out string asm, out string targetPlatform)
+ {
+ typeName = ns = asm = targetPlatform = null;
+
+ foreach (var decl in xmlns.Split(';')) {
+ if (decl.StartsWith("using:", StringComparison.Ordinal)) {
+ ns = decl.Substring(6, decl.Length - 6);
+ continue;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+
+namespace Tizen.NUI.XamlBinding
+{
+ [System.ComponentModel.TypeConverter(typeof(AcceleratorTypeConverter))]
+ internal class Accelerator
+ {
+ const char Separator = '+';
+ string _text;
+
+ internal Accelerator(string text)
+ {
+ if (string.IsNullOrEmpty(text))
+ throw new ArgumentNullException(nameof(text));
+ _text = text;
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public IEnumerable<string> Modifiers { get; set; }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public IEnumerable<string> Keys { get; set; }
+
+ public static Accelerator FromString(string text)
+ {
+ var accelarat = new Accelerator(text);
+
+ var acceleratorParts = text.Split(Separator);
+
+ if (acceleratorParts.Length > 1)
+ {
+ var modifiers = new List<string>();
+ for (int i = 0; i < acceleratorParts.Length; i++)
+ {
+ var modifierMask = acceleratorParts[i];
+ var modiferMaskLower = modifierMask.ToLower();
+ switch (modiferMaskLower)
+ {
+ case "ctrl":
+ case "cmd":
+ case "alt":
+ case "shift":
+ case "fn":
+ case "win":
+ modifiers.Add(modiferMaskLower);
+ text = text.Replace(modifierMask, "");
+ break;
+ }
+ }
+ accelarat.Modifiers = modifiers;
+
+ }
+
+ var keys = text.Split(new char[] { Separator }, StringSplitOptions.RemoveEmptyEntries);
+ accelarat.Keys = keys;
+ return accelarat;
+ }
+
+ public override string ToString()
+ {
+ return _text;
+ }
+
+ public override bool Equals(object obj)
+ {
+ return obj != null && obj is Accelerator && Equals((Accelerator)obj);
+ }
+
+ bool Equals(Accelerator other)
+ {
+ return other.ToString() == ToString();
+ }
+
+ public override int GetHashCode()
+ {
+ return ToString().GetHashCode();
+ }
+
+ public static implicit operator Accelerator(string accelerator)
+ {
+ return FromString(accelerator);
+ }
+ }
+}
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+ internal class AcceleratorTypeConverter : TypeConverter
+ {
+ public override object ConvertFromInvariantString(string value)
+ {
+ if (value == null)
+ return null;
+
+ return Accelerator.FromString(value);
+ }
+ }
+}
--- /dev/null
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal class ActionSheetArguments
+ {
+ public ActionSheetArguments(string title, string cancel, string destruction, IEnumerable<string> buttons)
+ {
+ Title = title;
+ Cancel = cancel;
+ Destruction = destruction;
+ Buttons = buttons;
+ Result = new TaskCompletionSource<string>();
+ }
+
+ /// <summary>
+ /// Gets titles of any buttons on the action sheet that aren't <see cref="Cancel" /> or <see cref="Destruction" />. Can
+ /// be <c>null</c>.
+ /// </summary>
+ public IEnumerable<string> Buttons { get; private set; }
+
+ /// <summary>
+ /// Gets the text for a cancel button. Can be null.
+ /// </summary>
+ public string Cancel { get; private set; }
+
+ /// <summary>
+ /// Gets the text for a destructive button. Can be null.
+ /// </summary>
+ public string Destruction { get; private set; }
+
+ public TaskCompletionSource<string> Result { get; }
+
+ /// <summary>
+ /// Gets the title for the action sheet. Can be null.
+ /// </summary>
+ public string Title { get; private set; }
+
+ public void SetResult(string result)
+ {
+ Result.TrySetResult(result);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.Threading.Tasks;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal class AlertArguments
+ {
+ public AlertArguments(string title, string message, string accept, string cancel)
+ {
+ Title = title;
+ Message = message;
+ Accept = accept;
+ Cancel = cancel;
+ Result = new TaskCompletionSource<bool>();
+ }
+
+ /// <summary>
+ /// Gets the text for the accept button. Can be null.
+ /// </summary>
+ public string Accept { get; private set; }
+
+ /// <summary>
+ /// Gets the text of the cancel button.
+ /// </summary>
+ public string Cancel { get; private set; }
+
+ /// <summary>
+ /// Gets the message for the alert. Can be null.
+ /// </summary>
+ public string Message { get; private set; }
+
+ public TaskCompletionSource<bool> Result { get; }
+
+ /// <summary>
+ /// Gets the title for the alert. Can be null.
+ /// </summary>
+ public string Title { get; private set; }
+
+ public void SetResult(bool result)
+ {
+ Result.TrySetResult(result);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+ internal abstract class BaseMenuItem : Element
+ {
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Linq.Expressions;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal static class BindableObjectExtensions
+ {
+ public static void SetBinding(this BindableObject self, BindableProperty targetProperty, string path, BindingMode mode = BindingMode.Default, IValueConverter converter = null,
+ string stringFormat = null)
+ {
+ if (self == null)
+ throw new ArgumentNullException("self");
+ if (targetProperty == null)
+ throw new ArgumentNullException("targetProperty");
+
+ var binding = new Binding(path, mode, converter, stringFormat: stringFormat);
+ self.SetBinding(targetProperty, binding);
+ }
+
+ [Obsolete]
+ public static void SetBinding<TSource>(this BindableObject self, BindableProperty targetProperty, Expression<Func<TSource, object>> sourceProperty, BindingMode mode = BindingMode.Default,
+ IValueConverter converter = null, string stringFormat = null)
+ {
+ if (self == null)
+ throw new ArgumentNullException("self");
+ if (targetProperty == null)
+ throw new ArgumentNullException("targetProperty");
+ if (sourceProperty == null)
+ throw new ArgumentNullException("sourceProperty");
+
+ Binding binding = Binding.Create(sourceProperty, mode, converter, stringFormat: stringFormat);
+ self.SetBinding(targetProperty, binding);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal static class BindingBaseExtensions
+ {
+ public static BindingMode GetRealizedMode(this BindingBase self, BindableProperty property)
+ {
+ return self.Mode != BindingMode.Default ? self.Mode : property.DefaultBindingMode;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Globalization;
+using System.Linq;
+using System.Reflection;
+using Tizen.NUI.XamlBinding.Internals;
+using System.Runtime.CompilerServices;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal class BindingExpression
+ {
+ internal const string PropertyNotFoundErrorMessage = "'{0}' property not found on '{1}', target property: '{2}.{3}'";
+
+ readonly List<BindingExpressionPart> _parts = new List<BindingExpressionPart>();
+
+ BindableProperty _targetProperty;
+ WeakReference<object> _weakSource;
+ WeakReference<BindableObject> _weakTarget;
+
+ internal BindingExpression(BindingBase binding, string path)
+ {
+ if (binding == null)
+ throw new ArgumentNullException(nameof(binding));
+ if (path == null)
+ throw new ArgumentNullException(nameof(path));
+
+ Binding = binding;
+ Path = path;
+
+ ParsePath();
+ }
+
+ internal BindingBase Binding { get; }
+
+ internal string Path { get; }
+
+ /// <summary>
+ /// Applies the binding expression to a previously set source and target.
+ /// </summary>
+ internal void Apply(bool fromTarget = false)
+ {
+ if (_weakSource == null || _weakTarget == null)
+ return;
+
+ BindableObject target;
+ if (!_weakTarget.TryGetTarget(out target))
+ {
+ Unapply();
+ return;
+ }
+
+ object source;
+ if (_weakSource.TryGetTarget(out source) && _targetProperty != null)
+ ApplyCore(source, target, _targetProperty, fromTarget);
+ }
+
+ /// <summary>
+ /// Applies the binding expression to a new source or target.
+ /// </summary>
+ internal void Apply(object sourceObject, BindableObject target, BindableProperty property)
+ {
+ _targetProperty = property;
+
+ BindableObject prevTarget;
+ if (_weakTarget != null && _weakTarget.TryGetTarget(out prevTarget) && !ReferenceEquals(prevTarget, target))
+ throw new InvalidOperationException("Binding instances can not be reused");
+
+ object previousSource;
+ if (_weakSource != null && _weakSource.TryGetTarget(out previousSource) && !ReferenceEquals(previousSource, sourceObject))
+ throw new InvalidOperationException("Binding instances can not be reused");
+
+ _weakSource = new WeakReference<object>(sourceObject);
+ _weakTarget = new WeakReference<BindableObject>(target);
+
+ ApplyCore(sourceObject, target, property);
+ }
+
+ internal void Unapply()
+ {
+ object sourceObject;
+ if (_weakSource != null && _weakSource.TryGetTarget(out sourceObject))
+ {
+ for (var i = 0; i < _parts.Count - 1; i++)
+ {
+ BindingExpressionPart part = _parts[i];
+
+ if (!part.IsSelf)
+ {
+ part.TryGetValue(sourceObject, out sourceObject);
+ }
+
+ part.Unsubscribe();
+ }
+ }
+
+ _weakSource = null;
+ _weakTarget = null;
+ }
+
+ /// <summary>
+ /// Applies the binding expression to a previously set source or target.
+ /// </summary>
+ void ApplyCore(object sourceObject, BindableObject target, BindableProperty property, bool fromTarget = false)
+ {
+ BindingMode mode = Binding.GetRealizedMode(_targetProperty);
+ if ((mode == BindingMode.OneWay || mode == BindingMode.OneTime) && fromTarget)
+ return;
+
+ bool needsGetter = (mode == BindingMode.TwoWay && !fromTarget) || mode == BindingMode.OneWay || mode == BindingMode.OneTime;
+ bool needsSetter = !needsGetter && ((mode == BindingMode.TwoWay && fromTarget) || mode == BindingMode.OneWayToSource);
+
+ object current = sourceObject;
+ object previous = null;
+ BindingExpressionPart part = null;
+
+ for (var i = 0; i < _parts.Count; i++)
+ {
+ part = _parts[i];
+ bool isLast = i + 1 == _parts.Count;
+
+ if (!part.IsSelf && current != null)
+ {
+ // Allow the object instance itself to provide its own TypeInfo
+ var reflectable = current as IReflectableType;
+ System.Reflection.TypeInfo currentType = reflectable != null ? reflectable.GetTypeInfo() : current.GetType().GetTypeInfo();
+ if (part.LastGetter == null || !part.LastGetter.DeclaringType.GetTypeInfo().IsAssignableFrom(currentType))
+ SetupPart(currentType, part);
+
+ if (!isLast)
+ part.TryGetValue(current, out current);
+ }
+
+ if (!part.IsSelf && current != null)
+ {
+ if ((needsGetter && part.LastGetter == null) || (needsSetter && part.NextPart == null && part.LastSetter == null))
+ {
+ Console.WriteLine("Binding", PropertyNotFoundErrorMessage, part.Content, current, target.GetType(), property.PropertyName);
+ break;
+ }
+ }
+
+ if (mode == BindingMode.OneWay || mode == BindingMode.TwoWay)
+ {
+ var inpc = current as INotifyPropertyChanged;
+ if (inpc != null && !ReferenceEquals(current, previous))
+ part.Subscribe(inpc);
+ }
+
+ previous = current;
+ }
+
+ Debug.Assert(part != null, "There should always be at least the self part in the expression.");
+
+ if (needsGetter)
+ {
+ object value = property.DefaultValue;
+ if (part.TryGetValue(current, out value) || part.IsSelf)
+ {
+ value = Binding.GetSourceValue(value, property.ReturnType);
+ }
+ else
+ value = property.DefaultValue;
+
+ if (!TryConvert(part, ref value, property.ReturnType, true))
+ {
+ Console.WriteLine("Binding", "{0} can not be converted to type '{1}'", value, property.ReturnType);
+ return;
+ }
+
+ target.SetValueCore(property, value, SetValueFlags.ClearDynamicResource, BindableObject.SetValuePrivateFlags.Default | BindableObject.SetValuePrivateFlags.Converted);
+ }
+ else if (needsSetter && part.LastSetter != null && current != null)
+ {
+ object value = Binding.GetTargetValue(target.GetValue(property), part.SetterType);
+
+ if (!TryConvert(part, ref value, part.SetterType, false))
+ {
+ Console.WriteLine("Binding", "{0} can not be converted to type '{1}'", value, part.SetterType);
+ return;
+ }
+
+ object[] args;
+ if (part.IsIndexer)
+ {
+ args = new object[part.Arguments.Length + 1];
+ part.Arguments.CopyTo(args, 0);
+ args[args.Length - 1] = value;
+ }
+ else if (part.IsBindablePropertySetter)
+ {
+ args = new[] { part.BindablePropertyField, value };
+ }
+ else
+ {
+ args = new[] { value };
+ }
+
+ part.LastSetter.Invoke(current, args);
+ }
+ }
+
+ IEnumerable<BindingExpressionPart> GetPart(string part)
+ {
+ part = part.Trim();
+ if (part == string.Empty)
+ throw new FormatException("Path contains an empty part");
+
+ BindingExpressionPart indexer = null;
+
+ int lbIndex = part.IndexOf('[');
+ if (lbIndex != -1)
+ {
+ int rbIndex = part.LastIndexOf(']');
+ if (rbIndex == -1)
+ throw new FormatException("Indexer did not contain closing bracket");
+
+ int argLength = rbIndex - lbIndex - 1;
+ if (argLength == 0)
+ throw new FormatException("Indexer did not contain arguments");
+
+ string argString = part.Substring(lbIndex + 1, argLength);
+ indexer = new BindingExpressionPart(this, argString, true);
+
+ part = part.Substring(0, lbIndex);
+ part = part.Trim();
+ }
+
+ if (part.Length > 0)
+ yield return new BindingExpressionPart(this, part);
+ if (indexer != null)
+ yield return indexer;
+ }
+
+ void ParsePath()
+ {
+ string p = Path.Trim();
+
+ var last = new BindingExpressionPart(this, ".");
+ _parts.Add(last);
+
+ if (p[0] == '.')
+ {
+ if (p.Length == 1)
+ return;
+
+ p = p.Substring(1);
+ }
+
+ string[] pathParts = p.Split('.');
+ for (var i = 0; i < pathParts.Length; i++)
+ {
+ foreach (BindingExpressionPart part in GetPart(pathParts[i]))
+ {
+ last.NextPart = part;
+ _parts.Add(part);
+ last = part;
+ }
+ }
+ }
+
+ void SetupPart(System.Reflection.TypeInfo sourceType, BindingExpressionPart part)
+ {
+ part.Arguments = null;
+ part.LastGetter = null;
+ part.LastSetter = null;
+
+ PropertyInfo property = null;
+ if (part.IsIndexer)
+ {
+ if (sourceType.IsArray)
+ {
+ int index;
+ if (!int.TryParse(part.Content, out index))
+ Console.WriteLine("Binding", "{0} could not be parsed as an index for a {1}", part.Content, sourceType);
+ else
+ part.Arguments = new object[] { index };
+
+ part.LastGetter = sourceType.GetDeclaredMethod("Get");
+ part.LastSetter = sourceType.GetDeclaredMethod("Set");
+ part.SetterType = sourceType.GetElementType();
+ }
+
+ DefaultMemberAttribute defaultMember = sourceType.GetCustomAttributes(typeof(DefaultMemberAttribute), true).OfType<DefaultMemberAttribute>().FirstOrDefault();
+ string indexerName = defaultMember != null ? defaultMember.MemberName : "Item";
+
+ part.IndexerName = indexerName;
+
+#if NETSTANDARD2_0
+ try {
+ property = sourceType.GetDeclaredProperty(indexerName);
+ }
+ catch (AmbiguousMatchException) {
+ // Get most derived instance of property
+ foreach (var p in sourceType.GetProperties().Where(prop => prop.Name == indexerName)) {
+ if (property == null || property.DeclaringType.IsAssignableFrom(property.DeclaringType))
+ property = p;
+ }
+ }
+#else
+ property = sourceType.GetDeclaredProperty(indexerName);
+#endif
+
+ if (property == null) //is the indexer defined on the base class?
+ property = sourceType.BaseType.GetProperty(indexerName);
+ if (property == null) //is the indexer defined on implemented interface ?
+ {
+ foreach (var implementedInterface in sourceType.ImplementedInterfaces)
+ {
+ property = implementedInterface.GetProperty(indexerName);
+ if (property != null)
+ break;
+ }
+ }
+
+ if (property != null)
+ {
+ ParameterInfo parameter = property.GetIndexParameters().FirstOrDefault();
+ if (parameter != null)
+ {
+ try
+ {
+ object arg = Convert.ChangeType(part.Content, parameter.ParameterType, CultureInfo.InvariantCulture);
+ part.Arguments = new[] { arg };
+ }
+ catch (FormatException)
+ {
+ }
+ catch (InvalidCastException)
+ {
+ }
+ catch (OverflowException)
+ {
+ }
+ }
+ }
+ }
+ else
+ property = sourceType.GetDeclaredProperty(part.Content) ?? sourceType.BaseType?.GetProperty(part.Content);
+
+ if (property != null)
+ {
+ if (property.CanRead && property.GetMethod.IsPublic && !property.GetMethod.IsStatic)
+ part.LastGetter = property.GetMethod;
+ if (property.CanWrite && property.SetMethod.IsPublic && !property.SetMethod.IsStatic)
+ {
+ part.LastSetter = property.SetMethod;
+ part.SetterType = part.LastSetter.GetParameters().Last().ParameterType;
+
+ if (Binding.AllowChaining)
+ {
+ FieldInfo bindablePropertyField = sourceType.GetDeclaredField(part.Content + "Property");
+ if (bindablePropertyField != null && bindablePropertyField.FieldType == typeof(BindableProperty) && sourceType.ImplementedInterfaces.Contains(typeof(IElementController)))
+ {
+ MethodInfo setValueMethod = null;
+#if NETSTANDARD1_0
+ foreach (MethodInfo m in sourceType.AsType().GetRuntimeMethods())
+ {
+ if (m.Name.EndsWith("IElementController.SetValueFromRenderer"))
+ {
+ ParameterInfo[] parameters = m.GetParameters();
+ if (parameters.Length == 2 && parameters[0].ParameterType == typeof(BindableProperty))
+ {
+ setValueMethod = m;
+ break;
+ }
+ }
+ }
+#else
+ setValueMethod = typeof(IElementController).GetMethod("SetValueFromRenderer", new[] { typeof(BindableProperty), typeof(object) });
+#endif
+ if (setValueMethod != null)
+ {
+ part.LastSetter = setValueMethod;
+ part.IsBindablePropertySetter = true;
+ part.BindablePropertyField = bindablePropertyField.GetValue(null);
+ }
+ }
+ }
+ }
+#if !NETSTANDARD1_0
+ //TupleElementNamesAttribute tupleEltNames;
+ //if (property != null
+ // && part.NextPart != null
+ // && property.PropertyType.IsGenericType
+ // && (property.PropertyType.GetGenericTypeDefinition() == typeof(ValueTuple<>)
+ // || property.PropertyType.GetGenericTypeDefinition() == typeof(ValueTuple<,>)
+ // || property.PropertyType.GetGenericTypeDefinition() == typeof(ValueTuple<,,>)
+ // || property.PropertyType.GetGenericTypeDefinition() == typeof(ValueTuple<,,,>)
+ // || property.PropertyType.GetGenericTypeDefinition() == typeof(ValueTuple<,,,,>)
+ // || property.PropertyType.GetGenericTypeDefinition() == typeof(ValueTuple<,,,,,>)
+ // || property.PropertyType.GetGenericTypeDefinition() == typeof(ValueTuple<,,,,,,>)
+ // || property.PropertyType.GetGenericTypeDefinition() == typeof(ValueTuple<,,,,,,,>))
+ // && (tupleEltNames = property.GetCustomAttribute(typeof(TupleElementNamesAttribute)) as TupleElementNamesAttribute) != null)
+ //{
+ // // modify the nextPart to access the tuple item via the ITuple indexer
+ // var nextPart = part.NextPart;
+ // var name = nextPart.Content;
+ // var index = tupleEltNames.TransformNames.IndexOf(name);
+ // if (index >= 0)
+ // {
+ // nextPart.IsIndexer = true;
+ // nextPart.Content = index.ToString();
+ // }
+ //}
+#endif
+ }
+
+ }
+ static Type[] DecimalTypes = new[] { typeof(float), typeof(decimal), typeof(double) };
+
+ bool TryConvert(BindingExpressionPart part, ref object value, Type convertTo, bool toTarget)
+ {
+ if (value == null)
+ return true;
+ if ((toTarget && _targetProperty.TryConvert(ref value)) || (!toTarget && convertTo.IsInstanceOfType(value)))
+ return true;
+
+ object original = value;
+ try
+ {
+ var stringValue = value as string ?? string.Empty;
+ // see: https://bugzilla.xamarin.com/show_bug.cgi?id=32871
+ // do not canonicalize "*.[.]"; "1." should not update bound BindableProperty
+ if (stringValue.EndsWith(".") && DecimalTypes.Contains(convertTo))
+ throw new FormatException();
+
+ // do not canonicalize "-0"; user will likely enter a period after "-0"
+ if (stringValue == "-0" && DecimalTypes.Contains(convertTo))
+ throw new FormatException();
+
+ value = Convert.ChangeType(value, convertTo, CultureInfo.InvariantCulture);
+ return true;
+ }
+ catch (InvalidCastException)
+ {
+ value = original;
+ return false;
+ }
+ catch (FormatException)
+ {
+ value = original;
+ return false;
+ }
+ catch (OverflowException)
+ {
+ value = original;
+ return false;
+ }
+ }
+
+ class BindingPair
+ {
+ public BindingPair(BindingExpressionPart part, object source, bool isLast)
+ {
+ Part = part;
+ Source = source;
+ IsLast = isLast;
+ }
+
+ public bool IsLast { get; set; }
+
+ public BindingExpressionPart Part { get; private set; }
+
+ public object Source { get; private set; }
+ }
+
+ internal class WeakPropertyChangedProxy
+ {
+ readonly WeakReference<INotifyPropertyChanged> _source = new WeakReference<INotifyPropertyChanged>(null);
+ readonly WeakReference<PropertyChangedEventHandler> _listener = new WeakReference<PropertyChangedEventHandler>(null);
+ readonly PropertyChangedEventHandler _handler;
+ readonly EventHandler _bchandler;
+ internal WeakReference<INotifyPropertyChanged> Source => _source;
+
+ public WeakPropertyChangedProxy()
+ {
+ _handler = new PropertyChangedEventHandler(OnPropertyChanged);
+ _bchandler = new EventHandler(OnBCChanged);
+ }
+
+ public WeakPropertyChangedProxy(INotifyPropertyChanged source, PropertyChangedEventHandler listener) : this()
+ {
+ SubscribeTo(source, listener);
+ }
+
+ public void SubscribeTo(INotifyPropertyChanged source, PropertyChangedEventHandler listener)
+ {
+ source.PropertyChanged += _handler;
+ var bo = source as BindableObject;
+ if (bo != null)
+ bo.BindingContextChanged += _bchandler;
+ _source.SetTarget(source);
+ _listener.SetTarget(listener);
+ }
+
+ public void Unsubscribe()
+ {
+ INotifyPropertyChanged source;
+ if (_source.TryGetTarget(out source) && source != null)
+ source.PropertyChanged -= _handler;
+ var bo = source as BindableObject;
+ if (bo != null)
+ bo.BindingContextChanged -= _bchandler;
+
+ _source.SetTarget(null);
+ _listener.SetTarget(null);
+ }
+
+ void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
+ {
+ PropertyChangedEventHandler handler;
+ if (_listener.TryGetTarget(out handler) && handler != null)
+ handler(sender, e);
+ else
+ Unsubscribe();
+ }
+
+ void OnBCChanged(object sender, EventArgs e)
+ {
+ OnPropertyChanged(sender, new PropertyChangedEventArgs("BindingContext"));
+ }
+ }
+
+ class BindingExpressionPart
+ {
+ readonly BindingExpression _expression;
+ readonly PropertyChangedEventHandler _changeHandler;
+ WeakPropertyChangedProxy _listener;
+
+ public BindingExpressionPart(BindingExpression expression, string content, bool isIndexer = false)
+ {
+ _expression = expression;
+ IsSelf = content == Tizen.NUI.XamlBinding.Binding.SelfPath;
+ Content = content;
+ IsIndexer = isIndexer;
+
+ _changeHandler = PropertyChanged;
+ }
+
+ public void Subscribe(INotifyPropertyChanged handler)
+ {
+ INotifyPropertyChanged source;
+ if (_listener != null && _listener.Source.TryGetTarget(out source) && ReferenceEquals(handler, source))
+ // Already subscribed
+ return;
+
+ // Clear out the old subscription if necessary
+ Unsubscribe();
+
+ _listener = new WeakPropertyChangedProxy(handler, _changeHandler);
+ }
+
+ public void Unsubscribe()
+ {
+ var listener = _listener;
+ if (listener != null)
+ {
+ listener.Unsubscribe();
+ _listener = null;
+ }
+ }
+
+ public object[] Arguments { get; set; }
+
+ public object BindablePropertyField { get; set; }
+
+ public string Content { get; internal set; }
+
+ public string IndexerName { get; set; }
+
+ public bool IsBindablePropertySetter { get; set; }
+
+ public bool IsIndexer { get; internal set; }
+
+ public bool IsSelf { get; }
+
+ public MethodInfo LastGetter { get; set; }
+
+ public MethodInfo LastSetter { get; set; }
+
+ public BindingExpressionPart NextPart { get; set; }
+
+ public Type SetterType { get; set; }
+
+ public void PropertyChanged(object sender, PropertyChangedEventArgs args)
+ {
+ BindingExpressionPart part = NextPart ?? this;
+
+ string name = args.PropertyName;
+
+ if (!string.IsNullOrEmpty(name))
+ {
+ if (part.IsIndexer)
+ {
+ if (name.Contains("["))
+ {
+ if (name != string.Format("{0}[{1}]", part.IndexerName, part.Content))
+ return;
+ }
+ else if (name != part.IndexerName)
+ return;
+ }
+ else if (name != part.Content)
+ {
+ return;
+ }
+ }
+
+ _expression.Apply();
+ // Device.BeginInvokeOnMainThread(() => _expression.Apply());
+ }
+
+ public bool TryGetValue(object source, out object value)
+ {
+ value = source;
+
+ if (LastGetter != null && value != null)
+ {
+ if (IsIndexer)
+ {
+ try
+ {
+ value = LastGetter.Invoke(value, Arguments);
+ }
+ catch (TargetInvocationException ex)
+ {
+ if (!(ex.InnerException is KeyNotFoundException))
+ throw;
+ value = null;
+ }
+ return true;
+ }
+ value = LastGetter.Invoke(value, Arguments);
+ return true;
+ }
+
+ return false;
+ }
+ }
+ }
+}
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+ [Xaml.ProvideCompiled("Tizen.NUI.Xaml.Forms.XamlC.BindingTypeConverter")]
+ [Xaml.TypeConversion(typeof(Binding))]
+ internal sealed class BindingTypeConverter : TypeConverter
+ {
+ public override object ConvertFromInvariantString(string value)
+ {
+ return new Binding(value);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal sealed class CollectionSynchronizationContext
+ {
+ internal CollectionSynchronizationContext(object context, CollectionSynchronizationCallback callback)
+ {
+ ContextReference = new WeakReference(context);
+ Callback = callback;
+ }
+
+ internal CollectionSynchronizationCallback Callback { get; private set; }
+
+ internal object Context
+ {
+ get { return ContextReference != null ? ContextReference.Target : null; }
+ }
+
+ internal WeakReference ContextReference { get; }
+ }
+}
\ No newline at end of file
--- /dev/null
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal class Configuration<TPlatform, TElement> : IPlatformElementConfiguration<TPlatform, TElement>
+ where TPlatform : IConfigPlatform
+ where TElement : Element
+
+ {
+ public Configuration(TElement element)
+ {
+ Element = element;
+ }
+
+ public TElement Element { get; }
+
+ public static Configuration<TPlatform, TElement> Create(TElement element)
+ {
+ return new Configuration<TPlatform, TElement>(element);
+ }
+ }
+}
--- /dev/null
+//
+// ContentPropertyAttribute.cs
+//
+// Author:
+// Stephane Delcroix <stephane@delcroix.org>
+//
+// Copyright (c) 2013 S. Delcroix
+//
+
+using System;
+
+namespace Tizen.NUI.XamlBinding
+{
+ [AttributeUsage(AttributeTargets.Class)]
+ internal sealed class ContentPropertyAttribute : Attribute
+ {
+ internal static string[] ContentPropertyTypes = { "Tizen.NUI.XamlBinding.ContentPropertyAttribute", "System.Windows.Markup.ContentPropertyAttribute" };
+
+ public ContentPropertyAttribute(string name)
+ {
+ Name = name;
+ }
+
+ public string Name { get; private set; }
+ }
+}
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// <summary>
+ /// Template that specifies a group of styles and effects for controls.
+ /// </summary>
+ internal class ControlTemplate : ElementTemplate
+ {
+ /// <summary>
+ /// For internal use only.
+ /// </summary>
+ public ControlTemplate()
+ {
+ }
+
+ /// <summary>
+ /// Creates a new control template for the specified control type.
+ /// </summary>
+ /// <param name="type">The type of control for which to create a template.</param>
+ public ControlTemplate(Type type) : base(type)
+ {
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal class DataTemplate : ElementTemplate
+ {
+ public DataTemplate()
+ {
+ }
+
+ public DataTemplate(Type type) : base(type)
+ {
+ }
+
+ public DataTemplate(Func<object> loadTemplate) : base(loadTemplate)
+ {
+ }
+
+ public IDictionary<BindableProperty, BindingBase> Bindings { get; } = new Dictionary<BindableProperty, BindingBase>();
+
+ public IDictionary<BindableProperty, object> Values { get; } = new Dictionary<BindableProperty, object>();
+
+ public void SetBinding(BindableProperty property, BindingBase binding)
+ {
+ if (property == null)
+ throw new ArgumentNullException("property");
+ if (binding == null)
+ throw new ArgumentNullException("binding");
+
+ Values.Remove(property);
+ Bindings[property] = binding;
+ }
+
+ public void SetValue(BindableProperty property, object value)
+ {
+ if (property == null)
+ throw new ArgumentNullException("property");
+
+ Bindings.Remove(property);
+ Values[property] = value;
+ }
+
+ internal override void SetupContent(object item)
+ {
+ ApplyBindings(item);
+ ApplyValues(item);
+ }
+
+ void ApplyBindings(object item)
+ {
+ if (Bindings == null)
+ return;
+
+ var bindable = item as BindableObject;
+ if (bindable == null)
+ return;
+
+ foreach (KeyValuePair<BindableProperty, BindingBase> kvp in Bindings)
+ {
+ if (Values.ContainsKey(kvp.Key))
+ throw new InvalidOperationException("Binding and Value found for " + kvp.Key.PropertyName);
+
+ bindable.SetBinding(kvp.Key, kvp.Value.Clone());
+ }
+ }
+
+ void ApplyValues(object item)
+ {
+ if (Values == null)
+ return;
+
+ var bindable = item as BindableObject;
+ if (bindable == null)
+ return;
+ foreach (KeyValuePair<BindableProperty, object> kvp in Values)
+ bindable.SetValue(kvp.Key, kvp.Value);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+ internal static class DataTemplateExtensions
+ {
+ public static DataTemplate SelectDataTemplate(this DataTemplate self, object item, BindableObject container)
+ {
+ var selector = self as DataTemplateSelector;
+ if (selector == null)
+ return self;
+
+ return selector.SelectTemplate(item, container);
+ }
+
+ public static object CreateContent(this DataTemplate self, object item, BindableObject container)
+ {
+ return self.SelectDataTemplate(item, container).CreateContent();
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal abstract class DataTemplateSelector : DataTemplate
+ {
+ Dictionary<Type, DataTemplate> _dataTemplates = new Dictionary<Type, DataTemplate>();
+
+ public DataTemplate SelectTemplate(object item, BindableObject container)
+ {
+ DataTemplate dataTemplate = null;
+
+ dataTemplate = OnSelectTemplate(item, container);
+ if (dataTemplate is DataTemplateSelector)
+ throw new NotSupportedException(
+ "DataTemplateSelector.OnSelectTemplate must not return another DataTemplateSelector");
+
+ return dataTemplate;
+ }
+
+ protected abstract DataTemplate OnSelectTemplate(object item, BindableObject container);
+ }
+}
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding
+{
+ [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
+ internal class DependencyAttribute : Attribute
+ {
+ public DependencyAttribute(Type implementorType)
+ {
+ Implementor = implementorType;
+ }
+
+ internal Type Implementor { get; private set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+ internal enum DependencyFetchTarget
+ {
+ GlobalInstance,
+ NewInstance
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Linq;
+using System.Reflection;
+using Tizen.NUI.XamlBinding;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal static class DependencyResolver
+ {
+ static Func<Type, object[], object> Resolver { get; set; }
+
+ public static void ResolveUsing(Func<Type, object[], object> resolver)
+ {
+ Resolver = resolver;
+ }
+
+ public static void ResolveUsing(Func<Type, object> resolver)
+ {
+ Resolver = (type, objects) => resolver.Invoke(type);
+ }
+
+ internal static object Resolve(Type type, params object[] args)
+ {
+ var result = Resolver?.Invoke(type, args);
+
+ if (result != null)
+ {
+ if (!type.IsInstanceOfType(result))
+ {
+ throw new InvalidCastException("Resolved instance is not of the correct type.");
+ }
+ }
+
+ return result;
+ }
+
+ internal static object ResolveOrCreate(Type type, params object[] args)
+ {
+ var result = Resolve(type, args);
+
+ if (result != null) return result;
+
+ if (args.Length > 0)
+ {
+ // This is by no means a general solution to matching with the correct constructor, but it'll
+ // do for finding Android renderers which need Context (vs older custom renderers which may still use
+ // parameterless constructors)
+ if (type.GetTypeInfo().DeclaredConstructors.Any(info => info.GetParameters().Length == args.Length))
+ {
+ return Activator.CreateInstance(type, args);
+ }
+ }
+
+ return Activator.CreateInstance(type);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using Tizen.NUI.XamlBinding.Internals;
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal static class DependencyService
+ {
+ static bool s_initialized;
+
+ static readonly List<Type> DependencyTypes = new List<Type>();
+ static readonly Dictionary<Type, DependencyData> DependencyImplementations = new Dictionary<Type, DependencyData>();
+
+ public static T Resolve<T>(DependencyFetchTarget fallbackFetchTarget = DependencyFetchTarget.GlobalInstance) where T : class
+ {
+ var result = DependencyResolver.Resolve(typeof(T)) as T;
+
+ return result ?? Get<T>(fallbackFetchTarget);
+ }
+
+ public static T Get<T>(DependencyFetchTarget fetchTarget = DependencyFetchTarget.GlobalInstance) where T : class
+ {
+ Initialize();
+
+ Type targetType = typeof(T);
+
+ if (!DependencyImplementations.ContainsKey(targetType))
+ {
+ Type implementor = FindImplementor(targetType);
+ DependencyImplementations[targetType] = implementor != null ? new DependencyData { ImplementorType = implementor } : null;
+ }
+
+ DependencyData dependencyImplementation = DependencyImplementations[targetType];
+ if (dependencyImplementation == null)
+ return null;
+
+ if (fetchTarget == DependencyFetchTarget.GlobalInstance)
+ {
+ if (dependencyImplementation.GlobalInstance == null)
+ {
+ dependencyImplementation.GlobalInstance = Activator.CreateInstance(dependencyImplementation.ImplementorType);
+ }
+ return (T)dependencyImplementation.GlobalInstance;
+ }
+ return (T)Activator.CreateInstance(dependencyImplementation.ImplementorType);
+ }
+
+ public static void Register<T>() where T : class
+ {
+ Type type = typeof(T);
+ if (!DependencyTypes.Contains(type))
+ DependencyTypes.Add(type);
+ }
+
+ public static void Register<T, TImpl>() where T : class where TImpl : class, T
+ {
+ Type targetType = typeof(T);
+ Type implementorType = typeof(TImpl);
+ if (!DependencyTypes.Contains(targetType))
+ DependencyTypes.Add(targetType);
+
+ DependencyImplementations[targetType] = new DependencyData { ImplementorType = implementorType };
+ }
+
+ static Type FindImplementor(Type target)
+ {
+ return DependencyTypes.FirstOrDefault(t => target.IsAssignableFrom(t));
+ }
+
+ static void Initialize()
+ {
+ if (s_initialized)
+ {
+ return;
+ }
+
+ Assembly[] assemblies = Device.GetAssemblies();
+ if (Tizen.NUI.XamlBinding.Internals.Registrar.ExtraAssemblies != null)
+ {
+ assemblies = assemblies.Union(Tizen.NUI.XamlBinding.Internals.Registrar.ExtraAssemblies).ToArray();
+ }
+
+ Initialize(assemblies);
+ }
+
+ internal static void Initialize(Assembly[] assemblies)
+ {
+ if (s_initialized || assemblies == null)
+ {
+ return;
+ }
+ DependencyService.Register<IValueConverterProvider, ValueConverterProvider>();
+
+ Type targetAttrType = typeof(DependencyAttribute);
+
+ // Don't use LINQ for performance reasons
+ // Naive implementation can easily take over a second to run
+ foreach (Assembly assembly in assemblies)
+ {
+ Attribute[] attributes;
+ try
+ {
+ attributes = assembly.GetCustomAttributes(targetAttrType).ToArray();
+ }
+ catch (System.IO.FileNotFoundException)
+ {
+ // Sometimes the previewer doesn't actually have everything required for these loads to work
+ Console.WriteLine(nameof(Registrar), "Could not load assembly: {0} for Attibute {1} | Some renderers may not be loaded", assembly.FullName, targetAttrType.FullName);
+ continue;
+ }
+
+ if (attributes.Length == 0)
+ continue;
+
+ foreach (DependencyAttribute attribute in attributes)
+ {
+ if (!DependencyTypes.Contains(attribute.Implementor))
+ {
+ DependencyTypes.Add(attribute.Implementor);
+ }
+ }
+ }
+
+ s_initialized = true;
+ }
+
+ class DependencyData
+ {
+ public object GlobalInstance { get; set; }
+
+ public Type ImplementorType { get; set; }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.IO;
+using System.Reflection;
+using System.Threading;
+using System.Threading.Tasks;
+using Tizen.NUI.XamlBinding.Internals;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal static class Device
+ {
+ public const string iOS = "iOS";
+ public const string Android = "Android";
+ public const string UWP = "UWP";
+ public const string macOS = "macOS";
+ public const string GTK = "GTK";
+ public const string Tizen = "Tizen";
+ public const string WPF = "WPF";
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static DeviceInfo info;
+
+ static IPlatformServices s_platformServices;
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static void SetIdiom(TargetIdiom value) => Idiom = value;
+ public static TargetIdiom Idiom { get; internal set; }
+
+ //TODO: Why are there two of these? This is never used...?
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static void SetTargetIdiom(TargetIdiom value) => Idiom = value;
+
+ [Obsolete("TargetPlatform is obsolete as of version 2.3.4. Please use RuntimePlatform instead.")]
+#pragma warning disable 0618
+ public static TargetPlatform OS
+ {
+ get
+ {
+ TargetPlatform platform;
+ if (Enum.TryParse(RuntimePlatform, out platform))
+ return platform;
+
+ // In the old TargetPlatform, there was no distinction between WinRT/UWP
+ if (RuntimePlatform == UWP)
+ {
+ return TargetPlatform.Windows;
+ }
+
+ return TargetPlatform.Other;
+ }
+ }
+#pragma warning restore 0618
+
+ public static string RuntimePlatform => PlatformServices?.RuntimePlatform;
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static DeviceInfo Info
+ {
+ get
+ {
+ // if (info == null)
+ // throw new InvalidOperationException("You MUST call Tizen.NUI.Xaml.Init(); prior to using it.");
+ return info;
+ }
+ set { info = value; }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static void SetFlowDirection(FlowDirection value) => FlowDirection = value;
+ public static FlowDirection FlowDirection { get; internal set; }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static bool IsInvokeRequired
+ {
+ get { return PlatformServices.IsInvokeRequired; }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static IPlatformServices PlatformServices
+ {
+ get
+ {
+ if (s_platformServices == null)
+ {
+ s_platformServices = new TizenPlatformServices();
+ }
+ return s_platformServices;
+ }
+ set
+ {
+ s_platformServices = value;
+ Console.WriteLine("Device s_platformServices : " + s_platformServices );
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static IReadOnlyList<string> Flags { get; private set; }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static void SetFlags(IReadOnlyList<string> flags)
+ {
+ Flags = flags;
+ }
+
+ public static void BeginInvokeOnMainThread(Action action)
+ {
+ PlatformServices?.BeginInvokeOnMainThread(action);
+ action();
+ Console.WriteLine("Device BeginInvokeOnMainThread action called");
+ }
+
+ // public static double GetNamedSize(NamedSize size, Element targetElement)
+ // {
+ // return GetNamedSize(size, targetElement.GetType());
+ // }
+
+ // public static double GetNamedSize(NamedSize size, Type targetElementType)
+ // {
+ // return GetNamedSize(size, targetElementType, false);
+ // }
+
+ [Obsolete("OnPlatform is obsolete as of version 2.3.4. Please use switch(RuntimePlatform) instead.")]
+ public static void OnPlatform(Action iOS = null, Action Android = null, Action WinPhone = null, Action Default = null)
+ {
+ switch (OS)
+ {
+ case TargetPlatform.iOS:
+ if (iOS != null)
+ iOS();
+ else if (Default != null)
+ Default();
+ break;
+ case TargetPlatform.Android:
+ if (Android != null)
+ Android();
+ else if (Default != null)
+ Default();
+ break;
+ case TargetPlatform.Windows:
+ case TargetPlatform.WinPhone:
+ if (WinPhone != null)
+ WinPhone();
+ else if (Default != null)
+ Default();
+ break;
+ case TargetPlatform.Other:
+ if (Default != null)
+ Default();
+ break;
+ }
+ }
+
+ [Obsolete("OnPlatform<> (generic) is obsolete as of version 2.3.4. Please use switch(RuntimePlatform) instead.")]
+ public static T OnPlatform<T>(T iOS, T Android, T WinPhone)
+ {
+ switch (OS)
+ {
+ case TargetPlatform.iOS:
+ return iOS;
+ case TargetPlatform.Android:
+ return Android;
+ case TargetPlatform.Windows:
+ case TargetPlatform.WinPhone:
+ return WinPhone;
+ }
+
+ return iOS;
+ }
+
+ public static void OpenUri(Uri uri)
+ {
+ // PlatformServices?.OpenUriAction(uri);
+ }
+
+ public static void StartTimer(TimeSpan interval, Func<bool> callback)
+ {
+ PlatformServices.StartTimer(interval, callback);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static Assembly[] GetAssemblies()
+ {
+ return PlatformServices?.GetAssemblies();
+ }
+
+ // [EditorBrowsable(EditorBrowsableState.Never)]
+ // public static double GetNamedSize(NamedSize size, Type targetElementType, bool useOldSizes)
+ // {
+ // return PlatformServices.GetNamedSize(size, targetElementType, useOldSizes);
+ // }
+
+ internal static Task<Stream> GetStreamAsync(Uri uri, CancellationToken cancellationToken)
+ {
+ return PlatformServices?.GetStreamAsync(uri, cancellationToken);
+ }
+
+ public static class Styles
+ {
+ public static readonly string TitleStyleKey = "TitleStyle";
+
+ public static readonly string SubtitleStyleKey = "SubtitleStyle";
+
+ public static readonly string BodyStyleKey = "BodyStyle";
+
+ public static readonly string ListItemTextStyleKey = "ListItemTextStyle";
+
+ public static readonly string ListItemDetailTextStyleKey = "ListItemDetailTextStyle";
+
+ public static readonly string CaptionStyleKey = "CaptionStyle";
+
+ public static readonly Style TitleStyle = new Style(typeof(Tizen.NUI.Xaml.Forms.BaseComponents.TextLabel)) { BaseResourceKey = TitleStyleKey };
+
+ public static readonly Style SubtitleStyle = new Style(typeof(Tizen.NUI.Xaml.Forms.BaseComponents.TextLabel)) { BaseResourceKey = SubtitleStyleKey };
+
+ public static readonly Style BodyStyle = new Style(typeof(Tizen.NUI.Xaml.Forms.BaseComponents.TextLabel)) { BaseResourceKey = BodyStyleKey };
+
+ public static readonly Style ListItemTextStyle = new Style(typeof(Tizen.NUI.Xaml.Forms.BaseComponents.TextLabel)) { BaseResourceKey = ListItemTextStyleKey };
+
+ public static readonly Style ListItemDetailTextStyle = new Style(typeof(Tizen.NUI.Xaml.Forms.BaseComponents.TextLabel)) { BaseResourceKey = ListItemDetailTextStyleKey };
+
+ public static readonly Style CaptionStyle = new Style(typeof(Tizen.NUI.Xaml.Forms.BaseComponents.TextLabel)) { BaseResourceKey = CaptionStyleKey };
+ }
+ }
+}
--- /dev/null
+using System;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal abstract class DeviceInfo : INotifyPropertyChanged, IDisposable
+ {
+ DeviceOrientation _currentOrientation;
+ bool _disposed;
+
+ public DeviceOrientation CurrentOrientation
+ {
+ get { return _currentOrientation; }
+ set
+ {
+ if (Equals(_currentOrientation, value))
+ return;
+ _currentOrientation = value;
+ OnPropertyChanged();
+ }
+ }
+
+ public virtual double DisplayRound(double value) =>
+ Math.Round(value);
+
+ public void Dispose()
+ {
+ Dispose(true);
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (_disposed)
+ return;
+ _disposed = true;
+ }
+
+ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+}
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+ internal enum DeviceOrientation
+ {
+ Portrait,
+ Landscape,
+ PortraitUp,
+ PortraitDown,
+ LandscapeLeft,
+ LandscapeRight,
+ Other
+ }
+}
--- /dev/null
+using System;
+using System.ComponentModel;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// <summary>
+ /// A collection of styles and properties that can be added to an element at run time.
+ /// </summary>
+ internal abstract class Effect
+ {
+ internal Effect()
+ {
+ }
+
+ /// <summary>
+ /// Gets the element to which the style is attached.
+ /// </summary>
+ public Element Element { get; internal set; }
+
+ /// <summary>
+ /// Gets a value that tells whether the effect is attached to an element.
+ /// </summary>
+ public bool IsAttached { get; private set; }
+
+ /// <summary>
+ /// Gets the ID that is used to resolve this effect at runtime.
+ /// </summary>
+ public string ResolveId { get; internal set; }
+
+ #region Statics
+ /// <summary>
+ /// Returns an Effect for the specified name, which is of the form ResolutionGroupName.ExportEffect.
+ /// </summary>
+ /// <param name="name">The name of the effect to get.</param>
+ /// <returns>The uniquely identified effect.</returns>
+ public static Effect Resolve(string name)
+ {
+ Effect result = null;
+ if (Tizen.NUI.XamlBinding.Internals.Registrar.Effects.TryGetValue(name, out Type effectType))
+ {
+ result = (Effect)DependencyResolver.ResolveOrCreate(effectType);
+ }
+
+ if (result == null)
+ result = new NullEffect();
+ result.ResolveId = name;
+ return result;
+ }
+
+ #endregion
+
+ /// <summary>
+ /// Method that is called after the effect is attached and made valid.
+ /// </summary>
+ protected abstract void OnAttached();
+
+ /// <summary>
+ /// Method that is called after the effect is detached and invalidated.
+ /// </summary>
+ protected abstract void OnDetached();
+
+ internal virtual void ClearEffect()
+ {
+ if (IsAttached)
+ SendDetached();
+ Element = null;
+ }
+
+ internal virtual void SendAttached()
+ {
+ if (IsAttached)
+ return;
+ OnAttached();
+ IsAttached = true;
+ }
+
+ internal virtual void SendDetached()
+ {
+ if (!IsAttached)
+ return;
+ OnDetached();
+ IsAttached = false;
+ }
+
+ internal virtual void SendOnElementPropertyChanged(PropertyChangedEventArgs args)
+ {
+ }
+ }
+}
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding
+{
+ [Flags]
+ internal enum EffectiveFlowDirection
+ {
+ RightToLeft = 1 << 0,
+ Explicit = 1 << 1,
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal static class EffectiveFlowDirectionExtensions
+ {
+ internal static EffectiveFlowDirection ToEffectiveFlowDirection(this FlowDirection self, bool isExplicit = false)
+ {
+ switch (self)
+ {
+ case FlowDirection.MatchParent:
+ return default(EffectiveFlowDirection);
+
+
+ case FlowDirection.LeftToRight:
+ if (isExplicit)
+ {
+ return EffectiveFlowDirection.Explicit;
+ }
+ else
+ {
+ return default(EffectiveFlowDirection);
+ }
+
+ case FlowDirection.RightToLeft:
+ if (isExplicit)
+ {
+ return EffectiveFlowDirection.RightToLeft | EffectiveFlowDirection.Explicit;
+ }
+ else
+ {
+ return EffectiveFlowDirection.RightToLeft;
+ }
+
+ default:
+ throw new InvalidOperationException($"Cannot convert {self} to {nameof(EffectiveFlowDirection)}.");
+ }
+ }
+
+ internal static FlowDirection ToFlowDirection(this EffectiveFlowDirection self)
+ {
+ if (self.IsLeftToRight())
+ return FlowDirection.LeftToRight;
+ else
+ return FlowDirection.RightToLeft;
+
+ throw new InvalidOperationException($"Cannot convert {self} to {nameof(FlowDirection)}.");
+ }
+
+ public static bool IsRightToLeft(this EffectiveFlowDirection self)
+ {
+ return (self & EffectiveFlowDirection.RightToLeft) == EffectiveFlowDirection.RightToLeft;
+ }
+
+ public static bool IsLeftToRight(this EffectiveFlowDirection self)
+ {
+ return (self & EffectiveFlowDirection.RightToLeft) != EffectiveFlowDirection.RightToLeft;
+ }
+
+ public static bool IsImplicit(this EffectiveFlowDirection self)
+ {
+ return (self & EffectiveFlowDirection.Explicit) != EffectiveFlowDirection.Explicit;
+ }
+
+ public static bool IsExplicit(this EffectiveFlowDirection self)
+ {
+ return (self & EffectiveFlowDirection.Explicit) == EffectiveFlowDirection.Explicit;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.Collections.ObjectModel;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal class ElementCollection<T> : ObservableWrapper<Element, T> where T : Element
+ {
+ public ElementCollection(ObservableCollection<Element> list) : base(list)
+ {
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal class ElementEventArgs : EventArgs
+ {
+ public ElementEventArgs(Element element)
+ {
+ if (element == null)
+ throw new ArgumentNullException("element");
+
+ Element = element;
+ }
+
+ public Element Element { get; private set; }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using Tizen.NUI.XamlBinding.Internals;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// <summary>
+ /// Base class for DataTemplate and ControlTemplate classes.
+ /// </summary>
+ internal class ElementTemplate : IElement, IDataTemplate
+ {
+ List<Action<object, ResourcesChangedEventArgs>> _changeHandlers;
+ Element _parent;
+ bool _canRecycle; // aka IsDeclarative
+
+ internal ElementTemplate()
+ {
+ }
+
+ internal ElementTemplate(Type type) : this()
+ {
+ if (type == null)
+ throw new ArgumentNullException("type");
+
+ _canRecycle = true;
+
+ LoadTemplate = () => Activator.CreateInstance(type);
+ }
+
+ internal ElementTemplate(Func<object> loadTemplate) : this()
+ {
+ if (loadTemplate == null)
+ throw new ArgumentNullException("loadTemplate");
+
+ LoadTemplate = loadTemplate;
+ }
+
+ Func<object> LoadTemplate { get; set; }
+
+#pragma warning disable 0612
+ Func<object> IDataTemplate.LoadTemplate
+ {
+ get { return LoadTemplate; }
+ set { LoadTemplate = value; }
+ }
+#pragma warning restore 0612
+
+ void IElement.AddResourcesChangedListener(Action<object, ResourcesChangedEventArgs> onchanged)
+ {
+ _changeHandlers = _changeHandlers ?? new List<Action<object, ResourcesChangedEventArgs>>(1);
+ _changeHandlers.Add(onchanged);
+ }
+
+ internal bool CanRecycle => _canRecycle;
+ Element IElement.Parent
+ {
+ get { return _parent; }
+ set
+ {
+ if (_parent == value)
+ return;
+ if (_parent != null)
+ ((IElement)_parent).RemoveResourcesChangedListener(OnResourcesChanged);
+ _parent = value;
+ if (_parent != null)
+ ((IElement)_parent).AddResourcesChangedListener(OnResourcesChanged);
+ }
+ }
+
+ void IElement.RemoveResourcesChangedListener(Action<object, ResourcesChangedEventArgs> onchanged)
+ {
+ if (_changeHandlers == null)
+ return;
+ _changeHandlers.Remove(onchanged);
+ }
+
+ /// <summary>
+ /// Used by the XAML infrastructure to load data templates and set up the content of the resulting UI.
+ /// </summary>
+ /// <returns></returns>
+ public object CreateContent()
+ {
+ if (LoadTemplate == null)
+ throw new InvalidOperationException("LoadTemplate should not be null");
+ if (this is DataTemplateSelector)
+ throw new InvalidOperationException("Cannot call CreateContent directly on a DataTemplateSelector");
+
+ object item = LoadTemplate();
+ SetupContent(item);
+
+ return item;
+ }
+
+ internal virtual void SetupContent(object item)
+ {
+ }
+
+ void OnResourcesChanged(object sender, ResourcesChangedEventArgs e)
+ {
+ if (_changeHandlers == null)
+ return;
+ foreach (Action<object, ResourcesChangedEventArgs> handler in _changeHandlers)
+ handler(this, e);
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal static class EnumerableExtensions
+ {
+ public static IEnumerable<T> GetGesturesFor<T>(this IEnumerable<IGestureRecognizer> gestures, Func<T, bool> predicate = null) where T : GestureRecognizer
+ {
+ if (gestures == null)
+ yield break;
+
+ if (predicate == null)
+ predicate = x => true;
+
+ foreach (IGestureRecognizer item in gestures)
+ {
+ var gesture = item as T;
+ if (gesture != null && predicate(gesture))
+ {
+ yield return gesture;
+ }
+ }
+ }
+
+ internal static IEnumerable<T> Append<T>(this IEnumerable<T> enumerable, T item)
+ {
+ foreach (T x in enumerable)
+ yield return x;
+
+ yield return item;
+ }
+
+ public static void ForEach<T>(this IEnumerable<T> enumeration, Action<T> action)
+ {
+ foreach (T item in enumeration)
+ {
+ action(item);
+ }
+ }
+
+ public static int IndexOf<T>(this IEnumerable<T> enumerable, T item)
+ {
+ if (enumerable == null)
+ throw new ArgumentNullException("enumerable");
+
+ var i = 0;
+ foreach (T element in enumerable)
+ {
+ if (Equals(element, item))
+ return i;
+
+ i++;
+ }
+
+ return -1;
+ }
+
+ public static int IndexOf<T>(this IEnumerable<T> enumerable, Func<T, bool> predicate)
+ {
+ var i = 0;
+ foreach (T element in enumerable)
+ {
+ if (predicate(element))
+ return i;
+
+ i++;
+ }
+
+ return -1;
+ }
+
+ public static IEnumerable<T> Prepend<T>(this IEnumerable<T> enumerable, T item)
+ {
+ yield return item;
+
+ foreach (T x in enumerable)
+ yield return x;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal class EventArg<T> : EventArgs
+ {
+ // Property variable
+
+ // Constructor
+ public EventArg(T data)
+ {
+ Data = data;
+ }
+
+ // Property for EventArgs argument
+ public T Data { get; }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding
+{
+ [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
+ internal class ExportEffectAttribute : Attribute
+ {
+ public ExportEffectAttribute(Type effectType, string uniqueName)
+ {
+ if (uniqueName.Contains("."))
+ throw new ArgumentException("uniqueName must not contain a .");
+ Type = effectType;
+ Id = uniqueName;
+ }
+
+ internal string Id { get; private set; }
+
+ internal Type Type { get; private set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Globalization;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal class ExtentsTypeConverter : TypeConverter
+ {
+ public override object ConvertFromInvariantString(string value)
+ {
+ if (value != null)
+ {
+ string[] parts = value.Split(',');
+ if (parts.Length == 4)
+ {
+ 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));
+ }
+ }
+
+ throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(Extents)}");
+ }
+ }
+}
--- /dev/null
+using System.Threading.Tasks;
+
+namespace Tizen.NUI.XamlBinding
+{
+ [TypeConverter(typeof(FileImageSourceConverter))]
+ internal sealed class FileImageSource : ImageSource
+ {
+ public static readonly BindableProperty FileProperty = BindableProperty.Create("File", typeof(string), typeof(FileImageSource), default(string));
+
+ public string File
+ {
+ get { return (string)GetValue(FileProperty); }
+ set { SetValue(FileProperty, value); }
+ }
+
+ public override Task<bool> Cancel()
+ {
+ return Task.FromResult(false);
+ }
+
+ public override string ToString()
+ {
+ return $"File: {File}";
+ }
+
+ public static implicit operator FileImageSource(string file)
+ {
+ return (FileImageSource)FromFile(file);
+ }
+
+ public static implicit operator string(FileImageSource file)
+ {
+ return file != null ? file.File : null;
+ }
+
+ protected override void OnPropertyChanged(string propertyName = null)
+ {
+ if (propertyName == FileProperty.PropertyName)
+ OnSourceChanged();
+ base.OnPropertyChanged(propertyName);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding
+{
+ [Xaml.TypeConversion(typeof(FileImageSource))]
+ internal sealed class FileImageSourceConverter : TypeConverter
+ {
+ public override object ConvertFromInvariantString(string value)
+ {
+ if (value != null)
+ return (FileImageSource)ImageSource.FromFile(value);
+
+ throw new InvalidOperationException(string.Format("Cannot convert \"{0}\" into {1}", value, typeof(FileImageSource)));
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding
+{
+ [TypeConverter(typeof(FlowDirectionConverter))]
+ internal enum FlowDirection
+ {
+ MatchParent = 0,
+ LeftToRight = 1,
+ RightToLeft = 2,
+ }
+
+ [Xaml.TypeConversion(typeof(FlowDirection))]
+ internal class FlowDirectionConverter : TypeConverter
+ {
+ public override object ConvertFromInvariantString(string value)
+ {
+ if (value != null) {
+ if (Enum.TryParse(value, out FlowDirection direction))
+ return direction;
+
+ if (value.Equals("ltr", StringComparison.OrdinalIgnoreCase))
+ return FlowDirection.LeftToRight;
+ if (value.Equals("rtl", StringComparison.OrdinalIgnoreCase))
+ return FlowDirection.RightToLeft;
+ if (value.Equals("inherit", StringComparison.OrdinalIgnoreCase))
+ return FlowDirection.MatchParent;
+ }
+ throw new InvalidOperationException(string.Format("Cannot convert \"{0}\" into {1}", value, typeof(FlowDirection)));
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+ internal class GestureRecognizer : Element, IGestureRecognizer
+ {
+ internal GestureRecognizer()
+ {
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding
+{
+ [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
+ internal abstract class HandlerAttribute : Attribute
+ {
+ protected HandlerAttribute(Type handler, Type target)
+ {
+ TargetType = target;
+ HandlerType = handler;
+ }
+
+ internal Type HandlerType { get; private set; }
+
+ internal Type TargetType { get; private set; }
+
+ public virtual bool ShouldRegister()
+ {
+ return true;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+ internal interface IAppIndexingProvider
+ {
+ IAppLinks AppLinks { get; }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal interface IAppLinkEntry
+ {
+ Uri AppLinkUri { get; set; }
+
+ string Description { get; set; }
+
+ bool IsLinkActive { get; set; }
+
+ IDictionary<string, string> KeyValues { get; }
+
+ ImageSource Thumbnail { get; set; }
+
+ string Title { get; set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal interface IAppLinks
+ {
+ void DeregisterLink(IAppLinkEntry appLink);
+ void DeregisterLink(Uri appLinkUri);
+ void RegisterLink(IAppLinkEntry appLink);
+ }
+}
\ No newline at end of file
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+ /// <summary>
+ /// This interface is for internal use by platform renderers.
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ internal interface IConfigElement<out T> where T : Element
+ {
+ /// <summary>
+ /// For internal use
+ /// </summary>
+ T Element { get; }
+ }
+}
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+ /// <summary>
+ /// Base interface for marker classes that identify target platforms for platform specific effects.
+ /// </summary>
+ internal interface IConfigPlatform { }
+}
--- /dev/null
+using System.Collections.Generic;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal interface IControlTemplated
+ {
+ // ControlTemplate ControlTemplate { get; set; }
+
+ IList<Element> InternalChildren { get; }
+
+ void OnControlTemplateChanged(ControlTemplate oldValue, ControlTemplate newValue);
+ }
+}
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+ /// <summary>
+ /// When implemented in a renderer, registers a platform-specific effect on an element.
+ /// </summary>
+ internal interface IEffectControlProvider
+ {
+ /// <summary>
+ /// Registers the effect with the element by establishing the parent-child relations needed for rendering on the specific platform.
+ /// </summary>
+ /// <param name="effect">The effect to register.</param>
+ void RegisterEffect(Effect effect);
+ }
+}
--- /dev/null
+using System;
+using Tizen.NUI.XamlBinding.Internals;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal interface IElement
+ {
+ Element Parent { get; set; }
+
+ //Use these 2 instead of an event to avoid cloning way too much multicastdelegates on mono
+ void AddResourcesChangedListener(Action<object, ResourcesChangedEventArgs> onchanged);
+ void RemoveResourcesChangedListener(Action<object, ResourcesChangedEventArgs> onchanged);
+ }
+}
\ No newline at end of file
--- /dev/null
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal interface IElementConfiguration<out TElement> where TElement : Element
+ {
+ // IPlatformElementConfiguration<T, TElement> On<T>() where T : IConfigPlatform;
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using Tizen.NUI.XamlBinding.Internals;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal interface IElementController
+ {
+ // IEffectControlProvider EffectControlProvider { get; set; }
+
+ // bool EffectIsAttached(string name);
+
+ // void SetValueFromRenderer(BindableProperty property, object value);
+ // void SetValueFromRenderer(BindablePropertyKey propertyKey, object value);
+ // ReadOnlyCollection<Element> LogicalChildren { get; }
+ // IPlatform Platform { get; set; }
+ // Element RealParent { get; }
+ // IEnumerable<Element> Descendants();
+ // event EventHandler PlatformSet;
+ }
+}
--- /dev/null
+using System.ComponentModel;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal interface IGestureRecognizer : INotifyPropertyChanged
+ {
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.IO;
+using System.Threading.Tasks;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal interface IIsolatedStorageFile
+ {
+ Task CreateDirectoryAsync(string path);
+ Task<bool> GetDirectoryExistsAsync(string path);
+ Task<bool> GetFileExistsAsync(string path);
+
+ Task<DateTimeOffset> GetLastWriteTimeAsync(string path);
+
+ Task<Stream> OpenFileAsync(string path, FileMode mode, FileAccess access);
+ Task<Stream> OpenFileAsync(string path, FileMode mode, FileAccess access, FileShare share);
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal interface ILayout
+ {
+ event EventHandler LayoutChanged;
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.Collections.Generic;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal interface ILayoutController
+ {
+ IReadOnlyList<Element> Children { get; }
+ }
+}
\ No newline at end of file
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+ internal interface IMenuItemController
+ {
+ bool IsEnabled { get; set; }
+ string IsEnabledPropertyName { get; }
+
+ void Activate();
+ }
+}
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+
+ internal interface INativeBindingService
+ {
+ bool TrySetBinding(object target, string propertyName, BindingBase binding);
+ bool TrySetBinding(object target, BindableProperty property, BindingBase binding);
+ bool TrySetValue(object target, BindableProperty property, object value);
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// <summary>
+ /// Interface abstracting platform-specific navigation.
+ /// </summary>
+ internal interface INavigation
+ {
+ /// <summary>
+ /// Gets the modal navigation stack.
+ /// </summary>
+ IReadOnlyList<Page> ModalStack { get; }
+
+ /// <summary>
+ /// Gets the stack of pages in the navigation.
+ /// </summary>
+ IReadOnlyList<Page> NavigationStack { get; }
+
+ /// <summary>
+ /// Inserts a page in the navigation stack before an existing page in the stack.
+ /// </summary>
+ /// <param name="page">The page to add.</param>
+ /// <param name="before">The existing page, before which page will be inserted.</param>
+ void InsertPageBefore(Page page, Page before);
+
+ /// <summary>
+ /// Asynchronously removes the most recent Page from the navigation stack.
+ /// </summary>
+ /// <returns>The Page that had been at the top of the navigation stack.</returns>
+ Task<Page> PopAsync();
+
+ /// <summary>
+ /// Asynchronously removes the most recent Page from the navigation stack, with optional animation.
+ /// </summary>
+ /// <param name="animated">Whether to animate the pop.</param>
+ /// <returns>The Page that had been at the top of the navigation stack.</returns>
+ Task<Page> PopAsync(bool animated);
+
+ /// <summary>
+ /// Asynchronously dismisses the most recent modally presented Page.
+ /// </summary>
+ /// <returns>An awaitable instance, indicating the PopModalAsync completion. The Task.Result is the Page that has been popped.</returns>
+ Task<Page> PopModalAsync();
+
+ /// <summary>
+ /// Asynchronously dismisses the most recent modally presented Page, with optional animation.
+ /// </summary>
+ /// <param name="animated">Whether to animate the pop.</param>
+ /// <returns>An awaitable, indicating the PopModalAsync completion. The Task.Result is the Page that has been popped.</returns>
+ Task<Page> PopModalAsync(bool animated);
+
+ /// <summary>
+ /// Pops all but the root Page off the navigation stack.
+ /// </summary>
+ /// <returns>A task representing the asynchronous dismiss operation.</returns>
+ Task PopToRootAsync();
+
+ /// <summary>
+ /// Pops all but the root Page off the navigation stack, with optional animation.
+ /// </summary>
+ /// <param name="animated">Whether to animate the pop.</param>
+ /// <returns>A task representing the asynchronous dismiss operation.</returns>
+ Task PopToRootAsync(bool animated);
+
+ /// <summary>
+ /// Asynchronously adds a Page to the top of the navigation stack.
+ /// </summary>
+ /// <param name="page">The Page to be pushed on top of the navigation stack.</param>
+ /// <returns>A task that represents the asynchronous push operation.</returns>
+ Task PushAsync(Page page);
+
+ /// <summary>
+ /// Asynchronously adds a Page to the top of the navigation stack, with optional animation.
+ /// </summary>
+ /// <param name="page">The page to push.</param>
+ /// <param name="animated">Whether to animate the push.</param>
+ /// <returns>A task that represents the asynchronous push operation.</returns>
+ Task PushAsync(Page page, bool animated);
+
+ /// <summary>
+ /// Presents a Page modally.
+ /// </summary>
+ /// <param name="page">The Page to present modally.</param>
+ /// <returns>An awaitable Task, indicating the PushModal completion.</returns>
+ Task PushModalAsync(Page page);
+
+ /// <summary>
+ /// Presents a Page modally, with optional animation.
+ /// </summary>
+ /// <param name="page">The page to push.</param>
+ /// <param name="animated">Whether to animate the push.</param>
+ /// <returns>An awaitable Task, indicating the PushModal completion.</returns>
+ Task PushModalAsync(Page page, bool animated);
+
+ /// <summary>
+ /// Removes the specified page from the navigation stack.
+ /// </summary>
+ /// <param name="page">The page to remove.</param>
+ void RemovePage(Page page);
+ }
+}
\ No newline at end of file
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+ internal interface INavigationMenuController : IViewController
+ {
+ void SendTargetSelected(Xaml.Page target);
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Tizen.NUI.XamlBinding.Internals;
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal interface INavigationPageController
+ {
+ Task<Page> RemoveAsyncInner(Page page, bool animated, bool fast);
+
+ Page Peek(int depth = 0);
+
+ IEnumerable<Page> Pages { get; }
+
+ int StackDepth { get; }
+
+ Task<Page> PopAsyncInner(bool animated, bool fast = false);
+
+ event EventHandler<NavigationRequestedEventArgs> InsertPageBeforeRequested;
+
+ event EventHandler<NavigationRequestedEventArgs> PopRequested;
+
+ event EventHandler<NavigationRequestedEventArgs> PopToRootRequested;
+
+ event EventHandler<NavigationRequestedEventArgs> PushRequested;
+
+ event EventHandler<NavigationRequestedEventArgs> RemovePageRequested;
+ }
+}
\ No newline at end of file
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+ interface IPaddingElement
+ {
+ //note to implementor: implement this property publicly
+ // Thickness Padding { get; }
+
+ //note to implementor: but implement this method explicitly
+ void OnPaddingPropertyChanged(Thickness oldValue, Thickness newValue);
+ Thickness PaddingDefaultValueCreator();
+ }
+}
\ No newline at end of file
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+ internal interface IPageContainer<out T> where T : Xaml.Page
+ {
+ T CurrentPage { get; }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.Collections.ObjectModel;
+using Tizen.NUI;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal interface IPageController
+ {
+ Rectangle ContainerArea { get; set; }
+
+ bool IgnoresContainerArea { get; set; }
+
+ ObservableCollection<Element> InternalChildren { get; }
+
+ void SendAppearing();
+
+ void SendDisappearing();
+ }
+}
\ No newline at end of file
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+ /// <summary>
+ /// For internal use.
+ /// </summary>
+ internal interface IPlatform
+ {
+ /// <summary>
+ /// Returns the native size.
+ /// </summary>
+ /// <param name="view">The view</param>
+ /// <param name="widthConstraint">The width constraint.</param>
+ /// <param name="heightConstraint">The height constraint.</param>
+ /// <returns>The native size.</returns>
+ SizeRequest GetNativeSize(BaseHandle view, double widthConstraint, double heightConstraint);
+ }
+}
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+ /// <summary>
+ /// Marker interface for returning platform-specific configuration elements.
+ /// </summary>
+ /// <typeparam name="TPlatform">The platform type.</typeparam>
+ /// <typeparam name="TElement">The element type.</typeparam>
+ internal interface IPlatformElementConfiguration<out TPlatform, out TElement> : IConfigElement<TElement>
+ where TPlatform : IConfigPlatform
+ where TElement : Element
+ {
+ }
+}
--- /dev/null
+using System;
+using System.IO;
+using System.Reflection;
+using System.Threading;
+using System.Threading.Tasks;
+using Tizen.NUI.XamlBinding.Internals;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal interface IPlatformServices
+ {
+ bool IsInvokeRequired { get; }
+
+ void BeginInvokeOnMainThread(Action action);
+
+ Ticker CreateTicker();
+
+ Assembly[] GetAssemblies();
+
+ string GetMD5Hash(string input);
+
+ // double GetNamedSize(NamedSize size, Type targetElementType, bool useOldSizes);
+
+ Task<Stream> GetStreamAsync(Uri uri, CancellationToken cancellationToken);
+
+ // IIsolatedStorageFile GetUserStoreForApplication();
+
+ // void OpenUriAction(Uri uri);
+
+ void StartTimer(TimeSpan interval, Func<bool> callback);
+
+ string RuntimePlatform { get; }
+
+ void QuitApplication();
+ }
+}
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+ internal interface IRegisterable
+ {
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal interface IResourceDictionary : IEnumerable<KeyValuePair<string, object>>
+ {
+ bool TryGetValue(string key, out object value);
+
+ event EventHandler<ResourcesChangedEventArgs> ValuesChanged;
+ }
+}
\ No newline at end of file
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+ internal interface ISystemResourcesProvider
+ {
+ IResourceDictionary GetSystemResources();
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding
+{
+ //this will go once Timer is included in Pcl profiles
+ internal interface ITimer
+ {
+ void Change(int dueTime, int period);
+ void Change(long dueTime, long period);
+ void Change(TimeSpan dueTime, TimeSpan period);
+ void Change(uint dueTime, uint period);
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.Collections.Generic;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal interface IViewContainer<T> where T : Element
+ {
+ IList<T> Children { get; }
+ }
+}
\ No newline at end of file
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+ internal interface IViewController : IVisualElementController
+ {
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using Tizen.NUI.XamlBinding.Internals;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal interface IVisualElementController : IElementController
+ {
+ void NativeSizeChanged();
+ void InvalidateMeasure(InvalidationTrigger trigger);
+ bool Batched { get; }
+ bool DisableLayout { get; set; }
+ EffectiveFlowDirection EffectiveFlowDirection { get; }
+ bool IsInNativeLayout { get; set; }
+ bool IsNativeStateConsistent { get; set; }
+ bool IsPlatformEnabled { get; set; }
+ NavigationProxy NavigationProxy { get; }
+ event EventHandler<EventArg<Element>> BatchCommitted;
+ event EventHandler<Tizen.NUI.BaseHandle.FocusRequestArgs> FocusChangeRequested;
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.IO;
+using System.Reflection;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Tizen.NUI.XamlBinding
+{
+ [TypeConverter(typeof(ImageSourceConverter))]
+ internal abstract class ImageSource : Element
+ {
+ readonly object _synchandle = new object();
+ CancellationTokenSource _cancellationTokenSource;
+
+ TaskCompletionSource<bool> _completionSource;
+
+ readonly WeakEventManager _weakEventManager = new WeakEventManager();
+
+ protected ImageSource()
+ {
+ }
+
+ protected CancellationTokenSource CancellationTokenSource
+ {
+ get { return _cancellationTokenSource; }
+ private set
+ {
+ if (_cancellationTokenSource == value)
+ return;
+ if (_cancellationTokenSource != null)
+ _cancellationTokenSource.Cancel();
+ _cancellationTokenSource = value;
+ }
+ }
+
+ bool IsLoading
+ {
+ get { return _cancellationTokenSource != null; }
+ }
+
+ public virtual Task<bool> Cancel()
+ {
+ if (!IsLoading)
+ return Task.FromResult(false);
+
+ var tcs = new TaskCompletionSource<bool>();
+ TaskCompletionSource<bool> original = Interlocked.CompareExchange(ref _completionSource, tcs, null);
+ if (original == null)
+ {
+ _cancellationTokenSource.Cancel();
+ }
+ else
+ tcs = original;
+
+ return tcs.Task;
+ }
+
+ public static ImageSource FromFile(string file)
+ {
+ return new FileImageSource { File = file };
+ }
+
+ public static ImageSource FromResource(string resource, Type resolvingType)
+ {
+ return FromResource(resource, resolvingType.GetTypeInfo().Assembly);
+ }
+
+ public static ImageSource FromResource(string resource, Assembly sourceAssembly = null)
+ {
+#if NETSTANDARD2_0
+ sourceAssembly = sourceAssembly ?? Assembly.GetCallingAssembly();
+#else
+ if (sourceAssembly == null)
+ {
+ MethodInfo callingAssemblyMethod = typeof(Assembly).GetTypeInfo().GetDeclaredMethod("GetCallingAssembly");
+ if (callingAssemblyMethod != null)
+ {
+ sourceAssembly = (Assembly)callingAssemblyMethod.Invoke(null, new object[0]);
+ }
+ else
+ {
+ Internals.Log.Warning("Warning", "Can not find CallingAssembly, pass resolvingType to FromResource to ensure proper resolution");
+ return null;
+ }
+ }
+#endif
+ return FromStream(() => sourceAssembly.GetManifestResourceStream(resource));
+ }
+
+ public static ImageSource FromStream(Func<Stream> stream)
+ {
+ // return new StreamImageSource { Stream = token => Task.Run(stream, token) };
+ return null;
+ }
+
+ public static ImageSource FromUri(Uri uri)
+ {
+ if (!uri.IsAbsoluteUri)
+ throw new ArgumentException("uri is relative");
+ // return new UriImageSource { Uri = uri };
+ return null;
+ }
+
+ public static implicit operator ImageSource(string source)
+ {
+ Uri uri;
+ return Uri.TryCreate(source, UriKind.Absolute, out uri) && uri.Scheme != "file" ? FromUri(uri) : FromFile(source);
+ }
+
+ public static implicit operator ImageSource(Uri uri)
+ {
+ if (!uri.IsAbsoluteUri)
+ throw new ArgumentException("uri is relative");
+ return FromUri(uri);
+ }
+
+ protected void OnLoadingCompleted(bool cancelled)
+ {
+ if (!IsLoading || _completionSource == null)
+ return;
+
+ TaskCompletionSource<bool> tcs = Interlocked.Exchange(ref _completionSource, null);
+ if (tcs != null)
+ tcs.SetResult(cancelled);
+
+ lock (_synchandle)
+ {
+ CancellationTokenSource = null;
+ }
+ }
+
+ protected void OnLoadingStarted()
+ {
+ lock (_synchandle)
+ {
+ CancellationTokenSource = new CancellationTokenSource();
+ }
+ }
+
+ protected void OnSourceChanged()
+ {
+ _weakEventManager.HandleEvent(this, EventArgs.Empty, nameof(SourceChanged));
+ }
+
+ internal event EventHandler SourceChanged
+ {
+ add { _weakEventManager.AddEventHandler(nameof(SourceChanged), value); }
+ remove { _weakEventManager.RemoveEventHandler(nameof(SourceChanged), value); }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding
+{
+ [Xaml.TypeConversion(typeof(ImageSource))]
+ internal sealed class ImageSourceConverter : TypeConverter
+ {
+ public override object ConvertFromInvariantString(string value)
+ {
+ if (value != null)
+ {
+ Uri uri;
+ return Uri.TryCreate(value, UriKind.Absolute, out uri) && uri.Scheme != "file" ? ImageSource.FromUri(uri) : ImageSource.FromFile(value);
+ }
+
+ throw new InvalidOperationException(string.Format("Cannot convert \"{0}\" into {1}", value, typeof(ImageSource)));
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal class AttachedCollection<T> : ObservableCollection<T>, ICollection<T>, IAttachedObject where T : BindableObject, IAttachedObject
+ {
+ readonly List<WeakReference> _associatedObjects = new List<WeakReference>();
+
+ public AttachedCollection()
+ {
+ }
+
+ public AttachedCollection(IEnumerable<T> collection) : base(collection)
+ {
+ }
+
+ public AttachedCollection(IList<T> list) : base(list)
+ {
+ }
+
+ public void AttachTo(BindableObject bindable)
+ {
+ if (bindable == null)
+ throw new ArgumentNullException("bindable");
+ OnAttachedTo(bindable);
+ }
+
+ public void DetachFrom(BindableObject bindable)
+ {
+ OnDetachingFrom(bindable);
+ }
+
+ protected override void ClearItems()
+ {
+ foreach (WeakReference weakbindable in _associatedObjects)
+ {
+ foreach (T item in this)
+ {
+ var bindable = weakbindable.Target as BindableObject;
+ if (bindable == null)
+ continue;
+ item?.DetachFrom(bindable);
+ }
+ }
+ base.ClearItems();
+ }
+
+ protected override void InsertItem(int index, T item)
+ {
+ base.InsertItem(index, item);
+ foreach (WeakReference weakbindable in _associatedObjects)
+ {
+ var bindable = weakbindable.Target as BindableObject;
+ if (bindable == null)
+ continue;
+ item?.AttachTo(bindable);
+ }
+ }
+
+ protected virtual void OnAttachedTo(BindableObject bindable)
+ {
+ lock (_associatedObjects)
+ {
+ _associatedObjects.Add(new WeakReference(bindable));
+ }
+ foreach (T item in this)
+ item?.AttachTo(bindable);
+ }
+
+ protected virtual void OnDetachingFrom(BindableObject bindable)
+ {
+ foreach (T item in this)
+ item?.DetachFrom(bindable);
+ lock (_associatedObjects)
+ {
+ for (var i = 0; i < _associatedObjects.Count; i++)
+ {
+ object target = _associatedObjects[i].Target;
+
+ if (target == null || target == bindable)
+ {
+ _associatedObjects.RemoveAt(i);
+ i--;
+ }
+ }
+ }
+ }
+
+ protected override void RemoveItem(int index)
+ {
+ T item = this[index];
+ foreach (WeakReference weakbindable in _associatedObjects)
+ {
+ var bindable = weakbindable.Target as BindableObject;
+ if (bindable == null)
+ continue;
+ item?.DetachFrom(bindable);
+ }
+
+ base.RemoveItem(index);
+ }
+
+ protected override void SetItem(int index, T item)
+ {
+ T old = this[index];
+ foreach (WeakReference weakbindable in _associatedObjects)
+ {
+ var bindable = weakbindable.Target as BindableObject;
+ if (bindable == null)
+ continue;
+ old?.DetachFrom(bindable);
+ }
+
+ base.SetItem(index, item);
+
+ foreach (WeakReference weakbindable in _associatedObjects)
+ {
+ var bindable = weakbindable.Target as BindableObject;
+ if (bindable == null)
+ continue;
+ item?.AttachTo(bindable);
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI.XamlBinding
+{
+ [ProvideCompiled("Tizen.NUI.Xaml.Forms.XamlC.PassthroughValueProvider")]
+ [AcceptEmptyServiceProvider]
+ internal sealed class BindingCondition : Condition, IValueProvider
+ {
+ readonly BindableProperty _boundProperty;
+
+ BindingBase _binding;
+ object _triggerValue;
+
+ public BindingCondition()
+ {
+ _boundProperty = BindableProperty.CreateAttached("Bound", typeof(object), typeof(BindingCondition), null, propertyChanged: OnBoundPropertyChanged);
+ }
+
+ public BindingBase Binding
+ {
+ get { return _binding; }
+ set
+ {
+ if (_binding == value)
+ return;
+ if (IsSealed)
+ throw new InvalidOperationException("Can not change Binding once the Condition has been applied.");
+ _binding = value;
+ }
+ }
+
+ public object Value
+ {
+ get { return _triggerValue; }
+ set
+ {
+ if (_triggerValue == value)
+ return;
+ if (IsSealed)
+ throw new InvalidOperationException("Can not change Value once the Condition has been applied.");
+ _triggerValue = value;
+ }
+ }
+
+ object IValueProvider.ProvideValue(IServiceProvider serviceProvider)
+ {
+ //This is no longer required
+ return this;
+ }
+
+ internal override bool GetState(BindableObject bindable)
+ {
+ object newValue = bindable.GetValue(_boundProperty);
+ return EqualsToValue(newValue);
+ }
+
+ internal override void SetUp(BindableObject bindable)
+ {
+ if (Binding != null)
+ bindable.SetBinding(_boundProperty, Binding.Clone());
+ }
+
+ internal override void TearDown(BindableObject bindable)
+ {
+ bindable.RemoveBinding(_boundProperty);
+ bindable.ClearValue(_boundProperty);
+ }
+
+ static IValueConverterProvider s_valueConverter = DependencyService.Get<IValueConverterProvider>();
+
+ bool EqualsToValue(object other)
+ {
+ if ((other == Value) || (other != null && other.Equals(Value)))
+ return true;
+
+ object converted = null;
+ if (s_valueConverter != null)
+ converted = s_valueConverter.Convert(Value, other != null ? other.GetType() : typeof(object), null, null);
+ else
+ return false;
+
+ return (other == converted) || (other != null && other.Equals(converted));
+ }
+
+ void OnBoundPropertyChanged(BindableObject bindable, object oldValue, object newValue)
+ {
+ bool oldState = EqualsToValue(oldValue);
+ bool newState = EqualsToValue(newValue);
+
+ if (newState == oldState)
+ return;
+
+ if (ConditionChanged != null)
+ ConditionChanged(bindable, oldState, newState);
+ }
+ }
+}
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal abstract class Condition
+ {
+ Action<BindableObject, bool, bool> _conditionChanged;
+
+ bool _isSealed;
+
+ internal Condition()
+ {
+ }
+
+ internal Action<BindableObject, bool, bool> ConditionChanged
+ {
+ get { return _conditionChanged; }
+ set
+ {
+ if (_conditionChanged == value)
+ return;
+ if (_conditionChanged != null)
+ throw new InvalidOperationException("The same condition instance can not be reused");
+ _conditionChanged = value;
+ }
+ }
+
+ internal bool IsSealed
+ {
+ get { return _isSealed; }
+ set
+ {
+ if (_isSealed == value)
+ return;
+ if (!value)
+ throw new InvalidOperationException("What is sealed can not be unsealed.");
+ _isSealed = value;
+ OnSealed();
+ }
+ }
+
+ internal abstract bool GetState(BindableObject bindable);
+
+ internal virtual void OnSealed()
+ {
+ }
+
+ internal abstract void SetUp(BindableObject bindable);
+ internal abstract void TearDown(BindableObject bindable);
+ }
+}
\ No newline at end of file
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+ internal interface IAttachedObject
+ {
+ void AttachTo(BindableObject bindable);
+ void DetachFrom(BindableObject bindable);
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.Collections.Generic;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal sealed class MultiCondition : Condition
+ {
+ readonly BindableProperty _aggregatedStateProperty;
+
+ public MultiCondition()
+ {
+ _aggregatedStateProperty = BindableProperty.CreateAttached("AggregatedState", typeof(bool), typeof(MultiCondition), false, propertyChanged: OnAggregatedStatePropertyChanged);
+ Conditions = new TriggerBase.SealedList<Condition>();
+ }
+
+ public IList<Condition> Conditions { get; }
+
+ internal override bool GetState(BindableObject bindable)
+ {
+ return (bool)bindable.GetValue(_aggregatedStateProperty);
+ }
+
+ internal override void OnSealed()
+ {
+ ((TriggerBase.SealedList<Condition>)Conditions).IsReadOnly = true;
+ foreach (Condition condition in Conditions)
+ condition.ConditionChanged = OnConditionChanged;
+ }
+
+ internal override void SetUp(BindableObject bindable)
+ {
+ foreach (Condition condition in Conditions)
+ condition.SetUp(bindable);
+ }
+
+ internal override void TearDown(BindableObject bindable)
+ {
+ foreach (Condition condition in Conditions)
+ condition.TearDown(bindable);
+ }
+
+ void OnAggregatedStatePropertyChanged(BindableObject bindable, object oldValue, object newValue)
+ {
+ if ((bool)oldValue == (bool)newValue)
+ return;
+
+ ConditionChanged?.Invoke(bindable, (bool)oldValue, (bool)newValue);
+ }
+
+ void OnConditionChanged(BindableObject bindable, bool oldValue, bool newValue)
+ {
+ var oldState = (bool)bindable.GetValue(_aggregatedStateProperty);
+ var newState = true;
+ foreach (Condition condition in Conditions)
+ {
+ if (!condition.GetState(bindable))
+ {
+ newState = false;
+ break;
+ }
+ }
+ if (newState != oldState)
+ bindable.SetValue(_aggregatedStateProperty, newState);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+
+namespace Tizen.NUI.XamlBinding
+{
+ [ContentProperty("Setters")]
+ internal sealed class MultiTrigger : TriggerBase
+ {
+ public MultiTrigger([TypeConverter(typeof(TypeTypeConverter))] [Parameter("TargetType")] Type targetType) : base(new MultiCondition(), targetType)
+ {
+ }
+
+ public IList<Condition> Conditions
+ {
+ get { return ((MultiCondition)Condition).Conditions; }
+ }
+
+ public new IList<Setter> Setters
+ {
+ get { return base.Setters; }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.ComponentModel;
+using System.Reflection;
+using Tizen.NUI.XamlBinding;
+
+namespace Tizen.NUI.Xaml
+{
+ [ProvideCompiled("Tizen.NUI.Xaml.Forms.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: this.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
--- /dev/null
+using System;
+using System.ComponentModel;
+using System.Reflection;
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI.XamlBinding
+{
+ [ProvideCompiled("Tizen.NUI.XamlC.PassthroughValueProvider")]
+ [AcceptEmptyServiceProvider]
+ internal sealed class XamlPropertyCondition : Condition, IValueProvider
+ {
+ readonly BindableProperty _stateProperty;
+
+ BindableProperty _property;
+ object _triggerValue;
+
+ public XamlPropertyCondition()
+ {
+ _stateProperty = BindableProperty.CreateAttached("State", typeof(bool), typeof(XamlPropertyCondition), 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);
+ _triggerValue = s_valueConverter.Convert(value, _property.ReturnType, minforetriever, null);
+ }
+ else
+ {
+ _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);
+ }
+ }
+}
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding.Internals
+{
+ internal interface IDataTemplate
+ {
+ Func<object> LoadTemplate { get; set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Tizen.NUI.XamlBinding.Internals
+{
+ internal interface IDeserializer
+ {
+ Task<IDictionary<string, object>> DeserializePropertiesAsync();
+ Task SerializePropertiesAsync(IDictionary<string, object> properties);
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding.Internals
+{
+ interface INameScopeProvider
+ {
+ INameScope NameScope { get; }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding.Internals
+{
+ [Flags]
+ internal enum InvalidationTrigger
+ {
+ Undefined = 0,
+ MeasureChanged = 1 << 0,
+ HorizontalOptionsChanged = 1 << 1,
+ VerticalOptionsChanged = 1 << 2,
+ SizeRequestChanged = 1 << 3,
+ RendererReady = 1 << 4,
+ MarginChanged = 1 << 5
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding.Internals
+{
+ internal static class NumericExtensions
+ {
+
+ public static double Clamp(this double self, double min, double max)
+ {
+ return Math.Min(max, Math.Max(self, min));
+ }
+
+ public static float Clamp(this float self, float min, float max)
+ {
+ return Math.Min(max, Math.Max(self, min));
+ }
+
+ public static int Clamp(this int self, int min, int max)
+ {
+ return Math.Min(max, Math.Max(self, min));
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+
+namespace Tizen.NUI.XamlBinding.Internals
+{
+ internal abstract class Ticker
+ {
+ static Ticker s_ticker;
+ readonly Stopwatch _stopwatch;
+ readonly List<Tuple<int, Func<long, bool>>> _timeouts;
+
+ int _count;
+ bool _enabled;
+
+ protected Ticker()
+ {
+ _count = 0;
+ _timeouts = new List<Tuple<int, Func<long, bool>>>();
+
+ _stopwatch = new Stopwatch();
+ }
+
+ public static void SetDefault(Ticker ticker) => Default = ticker;
+ public static Ticker Default
+ {
+ internal set { s_ticker = value; }
+ get { return s_ticker ?? (s_ticker = Device.PlatformServices.CreateTicker()); }
+ }
+
+ public virtual int Insert(Func<long, bool> timeout)
+ {
+ _count++;
+ _timeouts.Add(new Tuple<int, Func<long, bool>>(_count, timeout));
+
+ if (!_enabled)
+ {
+ _enabled = true;
+ Enable();
+ }
+
+ return _count;
+ }
+
+ public virtual void Remove(int handle)
+ {
+ Device.BeginInvokeOnMainThread(() =>
+ {
+ _timeouts.RemoveAll(t => t.Item1 == handle);
+
+ if (!_timeouts.Any())
+ {
+ _enabled = false;
+ Disable();
+ }
+ });
+ }
+
+ protected abstract void DisableTimer();
+
+ protected abstract void EnableTimer();
+
+ protected void SendSignals(int timestep = -1)
+ {
+ long step = timestep >= 0 ? timestep : _stopwatch.ElapsedMilliseconds;
+ _stopwatch.Reset();
+ _stopwatch.Start();
+
+ var localCopy = new List<Tuple<int, Func<long, bool>>>(_timeouts);
+ foreach (Tuple<int, Func<long, bool>> timeout in localCopy)
+ {
+ bool remove = !timeout.Item2(step);
+ if (remove)
+ _timeouts.RemoveAll(t => t.Item1 == timeout.Item1);
+ }
+
+ if (!_timeouts.Any())
+ {
+ _enabled = false;
+ Disable();
+ }
+ }
+
+ void Disable()
+ {
+ _stopwatch.Reset();
+ DisableTimer();
+ }
+
+ void Enable()
+ {
+ _stopwatch.Start();
+ EnableTimer();
+ }
+ }
+}
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal class InvalidNavigationException : Exception
+ {
+ public InvalidNavigationException(string message) : base(message)
+ {
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using Tizen.NUI.XamlBinding.Internals;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal class InvalidationEventArgs : EventArgs
+ {
+ public InvalidationEventArgs(InvalidationTrigger trigger)
+ {
+ Trigger = trigger;
+ }
+
+ public InvalidationTrigger Trigger { get; private set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding
+{
+ [Flags]
+ internal enum LayoutAlignment
+ {
+ Start = 0,
+ Center = 1,
+ End = 2,
+ Fill = 3
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding
+{
+ [Flags]
+ internal enum LayoutExpandFlag
+ {
+ Expand = 4
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding
+{
+ [TypeConverter(typeof(LayoutOptionsConverter))]
+ internal struct LayoutOptions
+ {
+ int _flags;
+
+ public static readonly LayoutOptions Start = new LayoutOptions(LayoutAlignment.Start, false);
+ public static readonly LayoutOptions Center = new LayoutOptions(LayoutAlignment.Center, false);
+ public static readonly LayoutOptions End = new LayoutOptions(LayoutAlignment.End, false);
+ public static readonly LayoutOptions Fill = new LayoutOptions(LayoutAlignment.Fill, false);
+ public static readonly LayoutOptions StartAndExpand = new LayoutOptions(LayoutAlignment.Start, true);
+ public static readonly LayoutOptions CenterAndExpand = new LayoutOptions(LayoutAlignment.Center, true);
+ public static readonly LayoutOptions EndAndExpand = new LayoutOptions(LayoutAlignment.End, true);
+ public static readonly LayoutOptions FillAndExpand = new LayoutOptions(LayoutAlignment.Fill, true);
+
+ public LayoutOptions(LayoutAlignment alignment, bool expands)
+ {
+ var a = (int)alignment;
+ if (a < 0 || a > 3)
+ throw new ArgumentOutOfRangeException();
+ _flags = (int)alignment | (expands ? (int)LayoutExpandFlag.Expand : 0);
+ }
+
+ public LayoutAlignment Alignment
+ {
+ get { return (LayoutAlignment)(_flags & 3); }
+ set { _flags = (_flags & ~3) | (int)value; }
+ }
+
+ public bool Expands
+ {
+ get { return (_flags & (int)LayoutExpandFlag.Expand) != 0; }
+ set { _flags = (_flags & 3) | (value ? (int)LayoutExpandFlag.Expand : 0); }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Linq;
+using System.Reflection;
+using Tizen.NUI.XamlBinding.Internals;
+
+namespace Tizen.NUI.XamlBinding
+{
+ [Xaml.ProvideCompiled("Tizen.NUI.Xaml.Forms.XamlC.LayoutOptionsConverter")]
+ [Xaml.TypeConversion(typeof(LayoutOptions))]
+ internal sealed class LayoutOptionsConverter : TypeConverter
+ {
+ public override object ConvertFromInvariantString(string value)
+ {
+ if (value != null) {
+ var parts = value.Split('.');
+ if (parts.Length > 2 || (parts.Length == 2 && parts [0] != "LayoutOptions"))
+ throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(LayoutOptions)}");
+ value = parts [parts.Length - 1];
+ switch (value) {
+ case "Start": return LayoutOptions.Start;
+ case "Center": return LayoutOptions.Center;
+ case "End": return LayoutOptions.End;
+ case "Fill": return LayoutOptions.Fill;
+ case "StartAndExpand": return LayoutOptions.StartAndExpand;
+ case "CenterAndExpand": return LayoutOptions.CenterAndExpand;
+ case "EndAndExpand": return LayoutOptions.EndAndExpand;
+ case "FillAndExpand": return LayoutOptions.FillAndExpand;
+ }
+ FieldInfo field = typeof(LayoutOptions).GetFields().FirstOrDefault(fi => fi.IsStatic && fi.Name == value);
+ if (field != null)
+ return (LayoutOptions)field.GetValue(null);
+ }
+
+ throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(LayoutOptions)}");
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Tizen.NUI.XamlBinding
+{
+ [Xaml.ProvideCompiled("Tizen.NUI.XamlC.ListStringTypeConverter")]
+ [Xaml.TypeConversion(typeof(List<string>))]
+ internal class ListStringTypeConverter : TypeConverter
+ {
+ public override object ConvertFromInvariantString(string value)
+ {
+ if (value == null)
+ return null;
+
+ return value.Split(new [] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(s => s.Trim()).ToList();
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Windows.Input;
+
+namespace Tizen.NUI.XamlBinding
+{
+
+ internal class MenuItem : BaseMenuItem, IMenuItemController
+ {
+ public static readonly BindableProperty AcceleratorProperty = BindableProperty.CreateAttached(nameof(Accelerator), typeof(Accelerator), typeof(MenuItem), null);
+
+ public static Accelerator GetAccelerator(BindableObject bindable) => (Accelerator)bindable.GetValue(AcceleratorProperty);
+
+ public static void SetAccelerator(BindableObject bindable, Accelerator value) => bindable.SetValue(AcceleratorProperty, value);
+
+ public static readonly BindableProperty TextProperty = BindableProperty.Create("Text", typeof(string), typeof(MenuItem), null);
+
+ public static readonly BindableProperty CommandProperty = BindableProperty.Create("Command", typeof(ICommand), typeof(MenuItem), null,
+ propertyChanging: (bo, o, n) => ((MenuItem)bo).OnCommandChanging(), propertyChanged: (bo, o, n) => ((MenuItem)bo).OnCommandChanged());
+
+ public static readonly BindableProperty CommandParameterProperty = BindableProperty.Create("CommandParameter", typeof(object), typeof(MenuItem), null,
+ propertyChanged: (bo, o, n) => ((MenuItem)bo).OnCommandParameterChanged());
+
+ public static readonly BindableProperty IsDestructiveProperty = BindableProperty.Create("IsDestructive", typeof(bool), typeof(MenuItem), false);
+
+ public static readonly BindableProperty IconProperty = BindableProperty.Create("Icon", typeof(FileImageSource), typeof(MenuItem), default(FileImageSource));
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty IsEnabledProperty = BindableProperty.Create("IsEnabled", typeof(bool), typeof(ToolbarItem), true);
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string IsEnabledPropertyName
+ {
+ get
+ {
+ return IsEnabledProperty.PropertyName;
+ }
+ }
+
+ public ICommand Command
+ {
+ get { return (ICommand)GetValue(CommandProperty); }
+ set { SetValue(CommandProperty, value); }
+ }
+
+ public object CommandParameter
+ {
+ get { return GetValue(CommandParameterProperty); }
+ set { SetValue(CommandParameterProperty, value); }
+ }
+
+ public FileImageSource Icon
+ {
+ get { return (FileImageSource)GetValue(IconProperty); }
+ set { SetValue(IconProperty, value); }
+ }
+
+ public bool IsDestructive
+ {
+ get { return (bool)GetValue(IsDestructiveProperty); }
+ set { SetValue(IsDestructiveProperty, value); }
+ }
+
+ public string Text
+ {
+ get { return (string)GetValue(TextProperty); }
+ set { SetValue(TextProperty, value); }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool IsEnabled
+ {
+ get { return (bool)GetValue(IsEnabledProperty); }
+ set { SetValue(IsEnabledProperty, value); }
+ }
+
+ bool IsEnabledCore
+ {
+ set { SetValueCore(IsEnabledProperty, value); }
+ }
+
+ public event EventHandler Clicked;
+
+ protected virtual void OnClicked()
+ => Clicked?.Invoke(this, EventArgs.Empty);
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Activate()
+ {
+ if (Command != null)
+ {
+ if (IsEnabled)
+ Command.Execute(CommandParameter);
+ }
+
+ OnClicked();
+ }
+
+ void OnCommandCanExecuteChanged(object sender, EventArgs eventArgs)
+ {
+ IsEnabledCore = Command.CanExecute(CommandParameter);
+ }
+
+ void OnCommandChanged()
+ {
+ if (Command == null)
+ {
+ IsEnabledCore = true;
+ return;
+ }
+
+ IsEnabledCore = Command.CanExecute(CommandParameter);
+
+ Command.CanExecuteChanged += OnCommandCanExecuteChanged;
+ }
+
+ void OnCommandChanging()
+ {
+ if (Command == null)
+ return;
+
+ Command.CanExecuteChanged -= OnCommandCanExecuteChanged;
+ }
+
+ void OnCommandParameterChanged()
+ {
+ if (Command == null)
+ return;
+
+ IsEnabledCore = Command.CanExecute(CommandParameter);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using Tizen.NUI.StyleSheets;
+using Tizen.NUI.Xaml.Forms.BaseComponents;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal sealed class MergedStyle : IStyle
+ {
+ ////If the base type is one of these, stop registering dynamic resources further
+ ////The last one (typeof(Element)) is a safety guard as we might be creating VisualElement directly in internal code
+ static readonly IList<Type> s_stopAtTypes = new List<Type> { typeof(View), typeof(Element) };
+
+ IList<BindableProperty> _classStyleProperties;
+
+ readonly List<BindableProperty> _implicitStyles = new List<BindableProperty>();
+
+ IList<Style> _classStyles;
+
+ IStyle _implicitStyle;
+
+ IStyle _style;
+
+ IList<string> _styleClass;
+
+ public MergedStyle(Type targetType, BindableObject target)
+ {
+ Target = target;
+ TargetType = targetType;
+ RegisterImplicitStyles();
+ Apply(Target);
+ }
+
+ public IStyle Style
+ {
+ get { return _style; }
+ set { SetStyle(ImplicitStyle, ClassStyles, value); }
+ }
+
+ public IList<string> StyleClass
+ {
+ get { return _styleClass; }
+ set
+ {
+ if (_styleClass == value)
+ return;
+
+ if (_styleClass != null && _classStyles != null)
+ foreach (var classStyleProperty in _classStyleProperties)
+ Target.RemoveDynamicResource(classStyleProperty);
+
+ _styleClass = value;
+
+ if (_styleClass != null) {
+ _classStyleProperties = new List<BindableProperty> ();
+ foreach (var styleClass in _styleClass) {
+ var classStyleProperty = BindableProperty.Create ("ClassStyle", typeof(IList<Style>), typeof(View), default(IList<Style>),
+ propertyChanged: (bindable, oldvalue, newvalue) => ((View)bindable).mergedStyle.OnClassStyleChanged());
+ _classStyleProperties.Add (classStyleProperty);
+ Target.OnSetDynamicResource (classStyleProperty, Tizen.NUI.XamlBinding.Style.StyleClassPrefix + styleClass);
+ }
+ }
+ }
+ }
+
+ public BindableObject Target { get; }
+
+ IList<Style> ClassStyles
+ {
+ get { return _classStyles; }
+ set { SetStyle(ImplicitStyle, value, Style); }
+ }
+
+ IStyle ImplicitStyle
+ {
+ get { return _implicitStyle; }
+ set { SetStyle(value, ClassStyles, Style); }
+ }
+
+ public void Apply(BindableObject bindable)
+ {
+ ImplicitStyle?.Apply(bindable);
+ if (ClassStyles != null)
+ foreach (var classStyle in ClassStyles)
+ ((IStyle)classStyle)?.Apply(bindable);
+ Style?.Apply(bindable);
+ }
+
+ public Type TargetType { get; }
+
+ public void UnApply(BindableObject bindable)
+ {
+ Style?.UnApply(bindable);
+ if (ClassStyles != null)
+ foreach (var classStyle in ClassStyles)
+ ((IStyle)classStyle)?.UnApply(bindable);
+ ImplicitStyle?.UnApply(bindable);
+ }
+
+ void OnClassStyleChanged()
+ {
+ ClassStyles = _classStyleProperties.Select (p => (Target.GetValue (p) as IList<Style>)?.FirstOrDefault (s => s.CanBeAppliedTo (TargetType))).ToList ();
+ }
+
+ void OnImplicitStyleChanged()
+ {
+ var first = true;
+ foreach (BindableProperty implicitStyleProperty in _implicitStyles)
+ {
+ var implicitStyle = (Style)Target.GetValue(implicitStyleProperty);
+ if (implicitStyle != null)
+ {
+ if (first || implicitStyle.ApplyToDerivedTypes)
+ {
+ ImplicitStyle = implicitStyle;
+ return;
+ }
+ }
+ first = false;
+ }
+ }
+
+ void RegisterImplicitStyles()
+ {
+ Type type = TargetType;
+ while (true) {
+ BindableProperty implicitStyleProperty = BindableProperty.Create("ImplicitStyle", typeof(Style), typeof(View), default(Style),
+ propertyChanged: (bindable, oldvalue, newvalue) => OnImplicitStyleChanged());
+ _implicitStyles.Add(implicitStyleProperty);
+ Target.SetDynamicResource(implicitStyleProperty, type.FullName);
+ type = type.GetTypeInfo().BaseType;
+ if (s_stopAtTypes.Contains(type))
+ return;
+ }
+ }
+
+ void SetStyle(IStyle implicitStyle, IList<Style> classStyles, IStyle style)
+ {
+ bool shouldReApplyStyle = implicitStyle != ImplicitStyle || classStyles != ClassStyles || Style != style;
+ bool shouldReApplyClassStyle = implicitStyle != ImplicitStyle || classStyles != ClassStyles;
+ bool shouldReApplyImplicitStyle = implicitStyle != ImplicitStyle && (Style as Style == null || ((Style)Style).CanCascade);
+
+ if (shouldReApplyStyle)
+ Style?.UnApply(Target);
+ if (shouldReApplyClassStyle && ClassStyles != null)
+ foreach (var classStyle in ClassStyles)
+ ((IStyle)classStyle)?.UnApply(Target);
+ if (shouldReApplyImplicitStyle)
+ ImplicitStyle?.UnApply(Target);
+
+ _implicitStyle = implicitStyle;
+ _classStyles = classStyles;
+ _style = style;
+
+ if (shouldReApplyImplicitStyle)
+ ImplicitStyle?.Apply(Target);
+ if (shouldReApplyClassStyle && ClassStyles != null)
+ foreach (var classStyle in ClassStyles)
+ ((IStyle)classStyle)?.Apply(Target);
+ if (shouldReApplyStyle)
+ Style?.Apply(Target);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal interface IMessagingCenter
+ {
+ void Send<TSender, TArgs>(TSender sender, string message, TArgs args) where TSender : class;
+
+ void Send<TSender>(TSender sender, string message) where TSender : class;
+
+ void Subscribe<TSender, TArgs>(object subscriber, string message, Action<TSender, TArgs> callback, TSender source = null) where TSender : class;
+
+ void Subscribe<TSender>(object subscriber, string message, Action<TSender> callback, TSender source = null) where TSender : class;
+
+ void Unsubscribe<TSender, TArgs>(object subscriber, string message) where TSender : class;
+
+ void Unsubscribe<TSender>(object subscriber, string message) where TSender : class;
+ }
+
+ internal class MessagingCenter : IMessagingCenter
+ {
+ public static IMessagingCenter Instance { get; } = new MessagingCenter();
+
+ class Sender : Tuple<string, Type, Type>
+ {
+ public Sender(string message, Type senderType, Type argType) : base(message, senderType, argType)
+ {
+ }
+ }
+
+ delegate bool Filter(object sender);
+
+ class MaybeWeakReference
+ {
+ WeakReference DelegateWeakReference { get; }
+ object DelegateStrongReference { get; }
+
+ readonly bool _isStrongReference;
+
+ public MaybeWeakReference(object subscriber, object delegateSource)
+ {
+ if (subscriber.Equals(delegateSource))
+ {
+ // The target is the subscriber; we can use a weakreference
+ DelegateWeakReference = new WeakReference(delegateSource);
+ _isStrongReference = false;
+ }
+ else
+ {
+ DelegateStrongReference = delegateSource;
+ _isStrongReference = true;
+ }
+ }
+
+ public object Target => _isStrongReference ? DelegateStrongReference : DelegateWeakReference.Target;
+ public bool IsAlive => _isStrongReference || DelegateWeakReference.IsAlive;
+ }
+
+ class Subscription : Tuple<WeakReference, MaybeWeakReference, MethodInfo, Filter>
+ {
+ public Subscription(object subscriber, object delegateSource, MethodInfo methodInfo, Filter filter)
+ : base(new WeakReference(subscriber), new MaybeWeakReference(subscriber, delegateSource), methodInfo, filter)
+ {
+ }
+
+ public WeakReference Subscriber => Item1;
+ MaybeWeakReference DelegateSource => Item2;
+ MethodInfo MethodInfo => Item3;
+ Filter Filter => Item4;
+
+ public void InvokeCallback(object sender, object args)
+ {
+ if (!Filter(sender))
+ {
+ return;
+ }
+
+ if (MethodInfo.IsStatic)
+ {
+ MethodInfo.Invoke(null, MethodInfo.GetParameters().Length == 1 ? new[] { sender } : new[] { sender, args });
+ return;
+ }
+
+ var target = DelegateSource.Target;
+
+ if (target == null)
+ {
+ return; // Collected
+ }
+
+ MethodInfo.Invoke(target, MethodInfo.GetParameters().Length == 1 ? new[] { sender } : new[] { sender, args });
+ }
+
+ public bool CanBeRemoved()
+ {
+ return !Subscriber.IsAlive || !DelegateSource.IsAlive;
+ }
+ }
+
+ readonly Dictionary<Sender, List<Subscription>> _subscriptions =
+ new Dictionary<Sender, List<Subscription>>();
+
+ public static void Send<TSender, TArgs>(TSender sender, string message, TArgs args) where TSender : class
+ {
+ Instance.Send(sender, message, args);
+ }
+
+ void IMessagingCenter.Send<TSender, TArgs>(TSender sender, string message, TArgs args)
+ {
+ if (sender == null)
+ throw new ArgumentNullException(nameof(sender));
+ InnerSend(message, typeof(TSender), typeof(TArgs), sender, args);
+ }
+
+ public static void Send<TSender>(TSender sender, string message) where TSender : class
+ {
+ Instance.Send(sender, message);
+ }
+
+ void IMessagingCenter.Send<TSender>(TSender sender, string message)
+ {
+ if (sender == null)
+ throw new ArgumentNullException(nameof(sender));
+ InnerSend(message, typeof(TSender), null, sender, null);
+ }
+
+ public static void Subscribe<TSender, TArgs>(object subscriber, string message, Action<TSender, TArgs> callback, TSender source = null) where TSender : class
+ {
+ Instance.Subscribe(subscriber, message, callback, source);
+ }
+
+ void IMessagingCenter.Subscribe<TSender, TArgs>(object subscriber, string message, Action<TSender, TArgs> callback, TSender source)
+ {
+ if (subscriber == null)
+ throw new ArgumentNullException(nameof(subscriber));
+ if (callback == null)
+ throw new ArgumentNullException(nameof(callback));
+
+ var target = callback.Target;
+
+ Filter filter = sender =>
+ {
+ var send = (TSender)sender;
+ return (source == null || send == source);
+ };
+
+ InnerSubscribe(subscriber, message, typeof(TSender), typeof(TArgs), target, callback.GetMethodInfo(), filter);
+ }
+
+ public static void Subscribe<TSender>(object subscriber, string message, Action<TSender> callback, TSender source = null) where TSender : class
+ {
+ Instance.Subscribe(subscriber, message, callback, source);
+ }
+
+ void IMessagingCenter.Subscribe<TSender>(object subscriber, string message, Action<TSender> callback, TSender source)
+ {
+ if (subscriber == null)
+ throw new ArgumentNullException(nameof(subscriber));
+ if (callback == null)
+ throw new ArgumentNullException(nameof(callback));
+
+ var target = callback.Target;
+
+ Filter filter = sender =>
+ {
+ var send = (TSender)sender;
+ return (source == null || send == source);
+ };
+
+ InnerSubscribe(subscriber, message, typeof(TSender), null, target, callback.GetMethodInfo(), filter);
+ }
+
+ public static void Unsubscribe<TSender, TArgs>(object subscriber, string message) where TSender : class
+ {
+ Instance.Unsubscribe<TSender, TArgs>(subscriber, message);
+ }
+
+ void IMessagingCenter.Unsubscribe<TSender, TArgs>(object subscriber, string message)
+ {
+ InnerUnsubscribe(message, typeof(TSender), typeof(TArgs), subscriber);
+ }
+
+ public static void Unsubscribe<TSender>(object subscriber, string message) where TSender : class
+ {
+ Instance.Unsubscribe<TSender>(subscriber, message);
+ }
+
+ void IMessagingCenter.Unsubscribe<TSender>(object subscriber, string message)
+ {
+ InnerUnsubscribe(message, typeof(TSender), null, subscriber);
+ }
+
+ void InnerSend(string message, Type senderType, Type argType, object sender, object args)
+ {
+ if (message == null)
+ throw new ArgumentNullException(nameof(message));
+ var key = new Sender(message, senderType, argType);
+ if (!_subscriptions.ContainsKey(key))
+ return;
+ List<Subscription> subcriptions = _subscriptions[key];
+ if (subcriptions == null || !subcriptions.Any())
+ return; // should not be reachable
+
+ // ok so this code looks a bit funky but here is the gist of the problem. It is possible that in the course
+ // of executing the callbacks for this message someone will subscribe/unsubscribe from the same message in
+ // the callback. This would invalidate the enumerator. To work around this we make a copy. However if you unsubscribe
+ // from a message you can fairly reasonably expect that you will therefor not receive a call. To fix this we then
+ // check that the item we are about to send the message to actually exists in the live list.
+ List<Subscription> subscriptionsCopy = subcriptions.ToList();
+ foreach (Subscription subscription in subscriptionsCopy)
+ {
+ if (subscription.Subscriber.Target != null && subcriptions.Contains(subscription))
+ {
+ subscription.InvokeCallback(sender, args);
+ }
+ }
+ }
+
+ void InnerSubscribe(object subscriber, string message, Type senderType, Type argType, object target, MethodInfo methodInfo, Filter filter)
+ {
+ if (message == null)
+ throw new ArgumentNullException(nameof(message));
+ var key = new Sender(message, senderType, argType);
+ var value = new Subscription(subscriber, target, methodInfo, filter);
+ if (_subscriptions.ContainsKey(key))
+ {
+ _subscriptions[key].Add(value);
+ }
+ else
+ {
+ var list = new List<Subscription> { value };
+ _subscriptions[key] = list;
+ }
+ }
+
+ void InnerUnsubscribe(string message, Type senderType, Type argType, object subscriber)
+ {
+ if (subscriber == null)
+ throw new ArgumentNullException(nameof(subscriber));
+ if (message == null)
+ throw new ArgumentNullException(nameof(message));
+
+ var key = new Sender(message, senderType, argType);
+ if (!_subscriptions.ContainsKey(key))
+ return;
+ _subscriptions[key].RemoveAll(sub => sub.CanBeRemoved() || sub.Subscriber.Target == subscriber);
+ if (!_subscriptions[key].Any())
+ _subscriptions.Remove(key);
+ }
+
+ // This is a bit gross; it only exists to support the unit tests in PageTests
+ // because the implementations of ActionSheet, Alert, and IsBusy are all very
+ // tightly coupled to the MessagingCenter singleton
+ internal static void ClearSubscribers()
+ {
+ (Instance as MessagingCenter)?._subscriptions.Clear();
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal abstract class ModalEventArgs : EventArgs
+ {
+ protected ModalEventArgs(Page modal)
+ {
+ Modal = modal;
+ }
+
+ public Page Modal { get; private set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+ internal class ModalPoppedEventArgs : ModalEventArgs
+ {
+ public ModalPoppedEventArgs(Xaml.Page modal) : base(modal)
+ {
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+ internal class ModalPoppingEventArgs : ModalEventArgs
+ {
+ public ModalPoppingEventArgs(Xaml.Page modal) : base(modal)
+ {
+ }
+
+ public bool Cancel { get; set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+ internal class ModalPushedEventArgs : ModalEventArgs
+ {
+ public ModalPushedEventArgs(Xaml.Page modal) : base(modal)
+ {
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+ internal class ModalPushingEventArgs : ModalEventArgs
+ {
+ public ModalPushingEventArgs(Xaml.Page modal) : base(modal)
+ {
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.Collections.Generic;
+using Tizen.NUI;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal static class VisualExtension
+ {
+ public static Dictionary<string, int> KeyDictionary = new Dictionary<string, int>()
+ {
+ // Visual.Property
+ { "Visual.Property.Type", Visual.Property.Type },
+ { "Visual.Property.Shader", Visual.Property.Shader },
+ { "Visual.Property.Transform", Visual.Property.Transform },
+ { "Visual.Property.PremultipliedAlpha", Visual.Property.PremultipliedAlpha },
+ { "Visual.Property.MixColor", Visual.Property.MixColor },
+ { "Visual.Property.Opacity", Visual.Property.Opacity },
+ // ShaderProperty
+ { "Visual.ShaderProperty.VertexShader", Visual.ShaderProperty.VertexShader },
+ { "Visual.ShaderProperty.FragmentShader", Visual.ShaderProperty.FragmentShader },
+ { "Visual.ShaderProperty.ShaderSubdivideGridX", Visual.ShaderProperty.ShaderSubdivideGridX },
+ { "Visual.ShaderProperty.ShaderSubdivideGridY", Visual.ShaderProperty.ShaderSubdivideGridY },
+ { "Visual.ShaderProperty.ShaderHints", Visual.ShaderProperty.ShaderHints },
+ // BorderVisualProperty
+ { "BorderVisualProperty.Color", BorderVisualProperty.Color },
+ { "BorderVisualProperty.Size", BorderVisualProperty.Size },
+ { "BorderVisualProperty.AntiAliasing", BorderVisualProperty.AntiAliasing },
+ // ColorVisualProperty
+ { "ColorVisualProperty.MixColor", ColorVisualProperty.MixColor},
+ // GradientVisualProperty
+ { "GradientVisualProperty.StartPosition", GradientVisualProperty.StartPosition },
+ { "GradientVisualProperty.EndPosition", GradientVisualProperty.EndPosition },
+ { "GradientVisualProperty.Center", GradientVisualProperty.Center },
+ { "GradientVisualProperty.Radius", GradientVisualProperty.Radius },
+ { "GradientVisualProperty.StopOffset", GradientVisualProperty.StopOffset },
+ { "GradientVisualProperty.StopColor", GradientVisualProperty.StopColor },
+ { "GradientVisualProperty.Units", GradientVisualProperty.Units },
+ { "GradientVisualProperty.SpreadMethod", GradientVisualProperty.SpreadMethod },
+ // ImageVisualProperty
+ { "ImageVisualProperty.URL", ImageVisualProperty.URL },
+ { "ImageVisualProperty.AlphaMaskURL", ImageVisualProperty.AlphaMaskURL },
+ { "ImageVisualProperty.FittingMode", ImageVisualProperty.FittingMode },
+ { "ImageVisualProperty.SamplingMode", ImageVisualProperty.SamplingMode },
+ { "ImageVisualProperty.DesiredWidth", ImageVisualProperty.DesiredWidth },
+ { "ImageVisualProperty.DesiredHeight", ImageVisualProperty.DesiredHeight },
+ { "ImageVisualProperty.SynchronousLoading", ImageVisualProperty.SynchronousLoading },
+ { "ImageVisualProperty.BorderOnly", ImageVisualProperty.BorderOnly },
+ { "ImageVisualProperty.PixelArea", ImageVisualProperty.PixelArea },
+ { "ImageVisualProperty.WrapModeU", ImageVisualProperty.WrapModeU },
+ { "ImageVisualProperty.WrapModeV", ImageVisualProperty.WrapModeV },
+ { "ImageVisualProperty.Border", ImageVisualProperty.Border },
+ { "ImageVisualProperty.MaskContentScale", ImageVisualProperty.MaskContentScale },
+ { "ImageVisualProperty.CropToMask", ImageVisualProperty.CropToMask },
+ { "ImageVisualProperty.BatchSize", ImageVisualProperty.BatchSize },
+ { "ImageVisualProperty.CacheSize", ImageVisualProperty.CacheSize },
+ { "ImageVisualProperty.FrameDelay", ImageVisualProperty.FrameDelay },
+ { "ImageVisualProperty.LoopCount", ImageVisualProperty.LoopCount },
+ { "ImageVisualProperty.ReleasePolicy", ImageVisualProperty.ReleasePolicy },
+ { "ImageVisualProperty.LoadPolicy", ImageVisualProperty.LoadPolicy },
+ { "ImageVisualProperty.OrientationCorrection", ImageVisualProperty.OrientationCorrection },
+ { "ImageVisualProperty.AuxiliaryImageURL", ImageVisualProperty.AuxiliaryImageURL },
+ { "ImageVisualProperty.AuxiliaryImageAlpha", ImageVisualProperty.AuxiliaryImageAlpha },
+ // MeshVisualProperty
+ { "MeshVisualProperty.ObjectURL", MeshVisualProperty.ObjectURL },
+ { "MeshVisualProperty.MaterialtURL", MeshVisualProperty.MaterialtURL },
+ { "MeshVisualProperty.TexturesPath", MeshVisualProperty.TexturesPath },
+ { "MeshVisualProperty.ShadingMode", MeshVisualProperty.ShadingMode },
+ { "MeshVisualProperty.UseMipmapping", MeshVisualProperty.UseMipmapping },
+ { "MeshVisualProperty.UseSoftNormals", MeshVisualProperty.UseSoftNormals },
+ { "MeshVisualProperty.LightPosition", MeshVisualProperty.LightPosition },
+ // PrimitiveVisualProperty
+ { "PrimitiveVisualProperty.Shape", PrimitiveVisualProperty.Shape },
+ { "PrimitiveVisualProperty.MixColor", PrimitiveVisualProperty.MixColor },
+ { "PrimitiveVisualProperty.Slices", PrimitiveVisualProperty.Slices },
+ { "PrimitiveVisualProperty.Stacks", PrimitiveVisualProperty.Stacks },
+ { "PrimitiveVisualProperty.ScaleTopRadius", PrimitiveVisualProperty.ScaleTopRadius },
+ { "PrimitiveVisualProperty.ScaleBottomRadius", PrimitiveVisualProperty.ScaleBottomRadius },
+ { "PrimitiveVisualProperty.ScaleHeight", PrimitiveVisualProperty.ScaleHeight },
+ { "PrimitiveVisualProperty.ScaleRadius", PrimitiveVisualProperty.ScaleRadius },
+ { "PrimitiveVisualProperty.ScaleDimensions", PrimitiveVisualProperty.ScaleDimensions },
+ { "PrimitiveVisualProperty.BevelPercentage", PrimitiveVisualProperty.BevelPercentage },
+ { "PrimitiveVisualProperty.BevelSmoothness", PrimitiveVisualProperty.BevelSmoothness },
+ { "PrimitiveVisualProperty.LightPosition", PrimitiveVisualProperty.LightPosition },
+ // TextVisualProperty
+ { "TextVisualProperty.Text", TextVisualProperty.Text },
+ { "TextVisualProperty.FontFamily", TextVisualProperty.FontFamily },
+ { "TextVisualProperty.FontStyle", TextVisualProperty.FontStyle },
+ { "TextVisualProperty.PointSize", TextVisualProperty.PointSize },
+ { "TextVisualProperty.MultiLine", TextVisualProperty.MultiLine },
+ { "TextVisualProperty.HorizontalAlignment", TextVisualProperty.HorizontalAlignment },
+ { "TextVisualProperty.VerticalAlignment", TextVisualProperty.VerticalAlignment },
+ { "TextVisualProperty.TextColor", TextVisualProperty.TextColor },
+ { "TextVisualProperty.EnableMarkup", TextVisualProperty.EnableMarkup },
+ // NpatchImageVisualProperty
+ { "NpatchImageVisualProperty.URL", NpatchImageVisualProperty.URL },
+ { "NpatchImageVisualProperty.FittingMode", NpatchImageVisualProperty.FittingMode },
+ { "NpatchImageVisualProperty.SamplingMode", NpatchImageVisualProperty.SamplingMode },
+ { "NpatchImageVisualProperty.DesiredWidth", NpatchImageVisualProperty.DesiredWidth },
+ { "NpatchImageVisualProperty.DesiredHeight", NpatchImageVisualProperty.DesiredHeight },
+ { "NpatchImageVisualProperty.SynchronousLoading", NpatchImageVisualProperty.SynchronousLoading },
+ { "NpatchImageVisualProperty.BorderOnly", NpatchImageVisualProperty.BorderOnly },
+ { "NpatchImageVisualProperty.PixelArea", NpatchImageVisualProperty.PixelArea },
+ { "NpatchImageVisualProperty.WrapModeU", NpatchImageVisualProperty.WrapModeU },
+ { "NpatchImageVisualProperty.WrapModeV", NpatchImageVisualProperty.WrapModeV },
+ { "NpatchImageVisualProperty.Border", NpatchImageVisualProperty.Border },
+ // HiddenInputProperty
+ { "HiddenInputProperty.Mode", HiddenInputProperty.Mode },
+ { "HiddenInputProperty.SubstituteCharacter", HiddenInputProperty.SubstituteCharacter },
+ { "HiddenInputProperty.SubstituteCount", HiddenInputProperty.SubstituteCount },
+ { "HiddenInputProperty.ShowLastCharacterDuration", HiddenInputProperty.ShowLastCharacterDuration },
+ };
+ }
+
+ internal enum VisualTypeExtension
+ {
+ Border = Visual.Type.Border,
+ Color = Visual.Type.Color,
+ Gradient = Visual.Type.Gradient,
+ Image = Visual.Type.Image,
+ Mesh = Visual.Type.Mesh,
+ Primitive = Visual.Type.Primitive,
+ Wireframe = Visual.Type.Wireframe,
+ Text = Visual.Type.Text,
+ NPatch = Visual.Type.NPatch,
+ SVG = Visual.Type.SVG,
+ AnimatedImage = Visual.Type.AnimatedImage
+ }
+
+ internal enum VisualAlignTypeExtension
+ {
+ TopBegin = Visual.AlignType.TopBegin,
+ TopCenter = Visual.AlignType.TopCenter,
+ TopEnd = Visual.AlignType.TopEnd,
+ CenterBegin = Visual.AlignType.CenterBegin,
+ Center = Visual.AlignType.Center,
+ CenterEnd = Visual.AlignType.CenterEnd,
+ BottomBegin = Visual.AlignType.BottomBegin,
+ BottomCenter = Visual.AlignType.BottomCenter,
+ BottomEnd = Visual.AlignType.BottomEnd
+ }
+}
\ No newline at end of file
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+ internal enum NamedSize
+ {
+ Default = 0,
+ Micro = 1,
+ Small = 2,
+ Medium = 3,
+ Large = 4
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// <summary>
+ /// EventArgs for the NavigationPage's navigation events.
+ /// </summary>
+ internal class NavigationEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Create a NavigationEventArgs instance.
+ /// </summary>
+ /// <param name="page">The page that was popped or is newly visible.</param>
+ public NavigationEventArgs(Xaml.Page page)
+ {
+ if (page == null)
+ throw new ArgumentNullException("page");
+
+ Page = page;
+ }
+
+ /// <summary>
+ /// Gets the page that was removed or is newly visible.
+ /// </summary>
+ public Xaml.Page Page { get; private set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Tizen.NUI.Xaml;
+using Tizen.NUI.Xaml.Forms.BaseComponents;
+
+namespace Tizen.NUI.XamlBinding
+{
+ // Mark as internal until renderers are ready for release after 1.0
+ // [RenderWith(typeof(_NavigationMenuRenderer))]
+ internal class NavigationMenu : View, /*INavigationMenuController,*/ IElementConfiguration<NavigationMenu>
+ {
+ readonly List<Page> _targets = new List<Page>();
+
+ readonly Lazy<PlatformConfigurationRegistry<NavigationMenu>> _platformConfigurationRegistry;
+
+ public NavigationMenu()
+ {
+ _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<NavigationMenu>>(() => new PlatformConfigurationRegistry<NavigationMenu>(this));
+ }
+
+ public IEnumerable<Page> Targets
+ {
+ get { return _targets; }
+ set
+ {
+ if (_targets.AsEnumerable().SequenceEqual(value))
+ return;
+
+ foreach (Page page in value)
+ {
+ VerifyTarget(page);
+ }
+
+ OnPropertyChanging();
+ _targets.Clear();
+ _targets.AddRange(value);
+ OnPropertyChanged();
+ }
+ }
+
+ public void Add(Page target)
+ {
+ if (_targets.Contains(target))
+ return;
+ VerifyTarget(target);
+
+ OnPropertyChanging("Targets");
+ _targets.Add(target);
+ OnPropertyChanged("Targets");
+ }
+
+ public void Remove(Page target)
+ {
+ if (_targets.Contains(target))
+ {
+ OnPropertyChanging("Targets");
+ if (_targets.Remove(target))
+ OnPropertyChanged("Targets");
+ }
+ }
+
+ public IPlatformElementConfiguration<T, NavigationMenu> On<T>() where T : IConfigPlatform
+ {
+ return _platformConfigurationRegistry.Value.On<T>();
+ }
+
+ public void SendTargetSelected(Page target)
+ {
+ //Navigation.PushAsync(target);
+ }
+
+ void VerifyTarget(Page target)
+ {
+ if (target.Icon == null || string.IsNullOrWhiteSpace(target.Icon.File))
+ throw new Exception("Icon must be set for each page before adding them to a Navigation Menu");
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal class NavigationModel
+ {
+ readonly List<Page> _modalStack = new List<Page>();
+ readonly List<List<Page>> _navTree = new List<List<Page>>();
+
+ public Page CurrentPage
+ {
+ get
+ {
+ if (_navTree.Any())
+ return _navTree.Last().Last();
+ return null;
+ }
+ }
+
+ public IEnumerable<Page> Modals
+ {
+ get { return _modalStack; }
+ }
+
+ public IEnumerable<Page> Roots
+ {
+ get
+ {
+ foreach (List<Page> list in _navTree)
+ {
+ yield return list[0];
+ }
+ }
+ }
+
+ public IReadOnlyList<IReadOnlyList<Page>> Tree
+ {
+ get { return _navTree; }
+ }
+
+ public void Clear()
+ {
+ _navTree.Clear();
+ _modalStack.Clear();
+ }
+
+ public void InsertPageBefore(Page page, Page before)
+ {
+ List<Page> currentStack = _navTree.Last();
+ int index = currentStack.IndexOf(before);
+
+ if (index == -1)
+ throw new ArgumentException("before must be in the current navigation context");
+
+ currentStack.Insert(index, page);
+ }
+
+ public Page Pop(Page ancestralNav)
+ {
+ ancestralNav = AncestorToRoot(ancestralNav);
+ foreach (List<Page> stack in _navTree)
+ {
+ if (stack.Contains(ancestralNav))
+ {
+ if (stack.Count <= 1)
+ throw new InvalidNavigationException("Can not pop final item in stack");
+ Page result = stack.Last();
+ stack.Remove(result);
+ return result;
+ }
+ }
+
+ throw new InvalidNavigationException("Popped from unpushed item?");
+ }
+
+ public Page PopModal()
+ {
+ if (_navTree.Count <= 1)
+ throw new InvalidNavigationException("Can't pop modal without any modals pushed");
+ Page modal = _navTree.Last().First();
+ _modalStack.Remove(modal);
+ _navTree.Remove(_navTree.Last());
+ return modal;
+ }
+
+ public Page PopTopPage()
+ {
+ Page itemToRemove;
+ if (_navTree.Count == 1)
+ {
+ if (_navTree[0].Count > 1)
+ {
+ itemToRemove = _navTree[0].Last();
+ _navTree[0].Remove(itemToRemove);
+ return itemToRemove;
+ }
+ return null;
+ }
+ itemToRemove = _navTree.Last().Last();
+ _navTree.Last().Remove(itemToRemove);
+ if (!_navTree.Last().Any())
+ {
+ _navTree.RemoveAt(_navTree.Count - 1);
+ }
+ return itemToRemove;
+ }
+
+ public void PopToRoot(Page ancestralNav)
+ {
+ ancestralNav = AncestorToRoot(ancestralNav);
+ foreach (List<Page> stack in _navTree)
+ {
+ if (stack.Contains(ancestralNav))
+ {
+ if (stack.Count <= 1)
+ throw new InvalidNavigationException("Can not pop final item in stack");
+ stack.RemoveRange(1, stack.Count - 1);
+ return;
+ }
+ }
+
+ throw new InvalidNavigationException("Popped from unpushed item?");
+ }
+
+ public void Push(Page page, Page ancestralNav)
+ {
+ if (ancestralNav == null)
+ {
+ if (_navTree.Any())
+ throw new InvalidNavigationException("Ancestor must be provided for all pushes except first");
+ _navTree.Add(new List<Page> { page });
+ return;
+ }
+
+ ancestralNav = AncestorToRoot(ancestralNav);
+
+ foreach (List<Page> stack in _navTree)
+ {
+ if (stack.Contains(ancestralNav))
+ {
+ stack.Add(page);
+ return;
+ }
+ }
+
+ throw new InvalidNavigationException("Invalid ancestor passed");
+ }
+
+ public void PushModal(Page page)
+ {
+ _navTree.Add(new List<Page> { page });
+ _modalStack.Add(page);
+ }
+
+ public bool RemovePage(Page page)
+ {
+ bool found;
+ List<Page> currentStack = _navTree.Last();
+ var i = 0;
+ while (!(found = currentStack.Remove(page)) && i < _navTree.Count - 1)
+ {
+ currentStack = _navTree[i++];
+ }
+
+ return found;
+ }
+
+ Page AncestorToRoot(Page ancestor)
+ {
+ Page result = ancestor;
+ // while (!Application.IsApplicationOrNull(result.RealParent))
+ result = (Page)result.RealParent;
+ return result;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// <summary>
+ /// For internal use.
+ /// </summary>
+ internal class NavigationProxy : INavigation
+ {
+ INavigation _inner;
+ Lazy<List<Page>> _modalStack = new Lazy<List<Page>>(() => new List<Page>());
+
+ Lazy<List<Page>> _pushStack = new Lazy<List<Page>>(() => new List<Page>());
+
+ internal INavigation Inner
+ {
+ get { return _inner; }
+ set
+ {
+ if (_inner == value)
+ return;
+ _inner = value;
+ // reverse so that things go into the new stack in the same order
+ // null out to release memory that will likely never be needed again
+
+ if (ReferenceEquals(_inner, null))
+ {
+ _pushStack = new Lazy<List<Page>>(() => new List<Page>());
+ _modalStack = new Lazy<List<Page>>(() => new List<Page>());
+ }
+ else
+ {
+ if (_pushStack != null && _pushStack.IsValueCreated)
+ {
+ foreach (Page page in _pushStack.Value)
+ {
+ _inner.PushAsync(page);
+ }
+ }
+
+ if (_modalStack != null && _modalStack.IsValueCreated)
+ {
+ foreach (Page page in _modalStack.Value)
+ {
+ _inner.PushModalAsync(page);
+ }
+ }
+
+ _pushStack = null;
+ _modalStack = null;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Inserts a page in the navigation stack before an existing page in the stack.
+ /// </summary>
+ /// <param name="page">The page to add.</param>
+ /// <param name="before">The existing page, before which page will be inserted.</param>
+ public void InsertPageBefore(Page page, Page before)
+ {
+ OnInsertPageBefore(page, before);
+ }
+
+ /// <summary>
+ /// Gets the modal navigation stack.
+ /// </summary>
+ public IReadOnlyList<Page> ModalStack
+ {
+ get { return GetModalStack(); }
+ }
+
+ /// <summary>
+ /// Gets the stack of pages in the navigation.
+ /// </summary>
+ public IReadOnlyList<Page> NavigationStack
+ {
+ get { return GetNavigationStack(); }
+ }
+
+ /// <summary>
+ /// Asynchronously removes the most recent Page from the navigation stack.
+ /// </summary>
+ /// <returns>The Page that had been at the top of the navigation stack.</returns>
+ public Task<Page> PopAsync()
+ {
+ return OnPopAsync(true);
+ }
+
+ /// <summary>
+ /// Asynchronously removes the top Page from the navigation stack, with optional animation.
+ /// </summary>
+ /// <param name="animated">Whether to animate the pop.</param>
+ /// <returns>The Page that had been at the top of the navigation stack.</returns>
+ public Task<Page> PopAsync(bool animated)
+ {
+ return OnPopAsync(animated);
+ }
+
+ /// <summary>
+ /// Asynchronously dismisses the most recent modally presented Page.
+ /// </summary>
+ /// <returns>An awaitable instance, indicating the PopModalAsync completion. The Task.Result is the Page that has been popped.</returns>
+ public Task<Page> PopModalAsync()
+ {
+ return OnPopModal(true);
+ }
+
+ /// <summary>
+ /// Asynchronously removes the top Page from the navigation stack, with optional animation.
+ /// </summary>
+ /// <param name="animated">Whether to animate the pop.</param>
+ /// <returns>The Page that had been at the top of the navigation stack.</returns>
+ public Task<Page> PopModalAsync(bool animated)
+ {
+ return OnPopModal(animated);
+ }
+
+ /// <summary>
+ /// Pops all but the root Page off the navigation stack.
+ /// </summary>
+ /// <returns>A task representing the asynchronous dismiss operation.</returns>
+ public Task PopToRootAsync()
+ {
+ return OnPopToRootAsync(true);
+ }
+
+ /// <summary>
+ /// Pops all but the root Page off the navigation stack, with optional animation.
+ /// </summary>
+ /// <param name="animated">Whether to animate the pop.</param>
+ /// <returns>A task representing the asynchronous dismiss operation.</returns>
+ public Task PopToRootAsync(bool animated)
+ {
+ return OnPopToRootAsync(animated);
+ }
+
+ /// <summary>
+ /// Asynchronously adds a Page to the top of the navigation stack.
+ /// </summary>
+ /// <param name="root">The Page to be pushed on top of the navigation stack.</param>
+ /// <returns>A task that represents the asynchronous push operation.</returns>
+ public Task PushAsync(Page root)
+ {
+ return PushAsync(root, true);
+ }
+
+ /// <summary>
+ /// Asynchronously adds a Page to the top of the navigation stack, with optional animation.
+ /// </summary>
+ /// <param name="root">The page to push.</param>
+ /// <param name="animated">Whether to animate the push.</param>
+ /// <returns>A task that represents the asynchronous push operation.</returns>
+ public Task PushAsync(Page root, bool animated)
+ {
+ if (root.RealParent != null)
+ throw new InvalidOperationException("Page must not already have a parent.");
+ return OnPushAsync(root, animated);
+ }
+
+ /// <summary>
+ /// Presents a Page modally.
+ /// </summary>
+ /// <param name="modal">The Page to present modally.</param>
+ /// <returns>An awaitable Task, indicating the PushModal completion.</returns>
+ public Task PushModalAsync(Page modal)
+ {
+ return PushModalAsync(modal, true);
+ }
+
+ /// <summary>
+ /// Presents a Page modally, with optional animation.
+ /// </summary>
+ /// <param name="modal">The page to push.</param>
+ /// <param name="animated">Whether to animate the push.</param>
+ /// <returns>An awaitable Task, indicating the PushModal completion.</returns>
+ public Task PushModalAsync(Page modal, bool animated)
+ {
+ if (modal.RealParent != null)
+ throw new InvalidOperationException("Page must not already have a parent.");
+ return OnPushModal(modal, animated);
+ }
+
+ /// <summary>
+ /// Removes the specified page from the navigation stack.
+ /// </summary>
+ /// <param name="page">The page to remove.</param>
+ public void RemovePage(Page page)
+ {
+ OnRemovePage(page);
+ }
+
+ /// <summary>
+ /// For internal use. Returns the modal navigation stack.
+ /// </summary>
+ /// <returns>The modal navigation stack.</returns>
+ protected virtual IReadOnlyList<Page> GetModalStack()
+ {
+ INavigation currentInner = Inner;
+ return currentInner == null ? _modalStack.Value : currentInner.ModalStack;
+ }
+
+ /// <summary>
+ /// For internal use. Returns the stack of pages in the navigation.
+ /// </summary>
+ /// <returns>The stack of pages in the navigation.</returns>
+ protected virtual IReadOnlyList<Page> GetNavigationStack()
+ {
+ INavigation currentInner = Inner;
+ return currentInner == null ? _pushStack.Value : currentInner.NavigationStack;
+ }
+
+ /// <summary>
+ /// The method called when insert a page in the navigation stack before an existing page in the stack.
+ /// </summary>
+ /// <param name="page">The page to add.</param>
+ /// <param name="before">The existing page, before which page will be inserted.</param>
+ protected virtual void OnInsertPageBefore(Page page, Page before)
+ {
+ INavigation currentInner = Inner;
+ if (currentInner == null)
+ {
+ int index = _pushStack.Value.IndexOf(before);
+ if (index == -1)
+ throw new ArgumentException("before must be in the pushed stack of the current context");
+ _pushStack.Value.Insert(index, page);
+ }
+ else
+ {
+ currentInner.InsertPageBefore(page, before);
+ }
+ }
+
+ /// <summary>
+ /// This method calls when removes the top Page from the navigation stack
+ /// </summary>
+ /// <param name="animated">Whether to animate the pop.</param>
+ /// <returns></returns>
+ protected virtual Task<Page> OnPopAsync(bool animated)
+ {
+ INavigation inner = Inner;
+ return inner == null ? Task.FromResult(Pop()) : inner.PopAsync(animated);
+ }
+
+ /// <summary>
+ /// This method calls when removes the top Page from the navigation stack
+ /// </summary>
+ /// <param name="animated">Whether to animate the pop.</param>
+ /// <returns>An awaitable instance, indicating the PopModalAsync completion</returns>
+ protected virtual Task<Page> OnPopModal(bool animated)
+ {
+ INavigation innerNav = Inner;
+ return innerNav == null ? Task.FromResult(PopModal()) : innerNav.PopModalAsync(animated);
+ }
+
+ /// <summary>
+ /// This method calls when Pops all but the root Page off the navigation stack.
+ /// </summary>
+ /// <param name="animated">Whether to animate the pop.</param>
+ /// <returns>A task representing the asynchronous dismiss operation.</returns>
+ protected virtual Task OnPopToRootAsync(bool animated)
+ {
+ INavigation currentInner = Inner;
+ if (currentInner == null)
+ {
+ Page root = _pushStack.Value.Last();
+ _pushStack.Value.Clear();
+ _pushStack.Value.Add(root);
+ return Task.FromResult(root);
+ }
+ return currentInner.PopToRootAsync(animated);
+ }
+
+ /// <summary>
+ /// This method calls when adds a Page to the top of the navigation stack, with optional animation.
+ /// </summary>
+ /// <param name="page">The page to add</param>
+ /// <param name="animated">Whether to animate the pop.</param>
+ /// <returns>A task that represents the asynchronous push operation.</returns>
+ protected virtual Task OnPushAsync(Page page, bool animated)
+ {
+ INavigation currentInner = Inner;
+ if (currentInner == null)
+ {
+ _pushStack.Value.Add(page);
+ return Task.FromResult(page);
+ }
+ return currentInner.PushAsync(page, animated);
+ }
+
+ /// <summary>
+ /// This method calls when Presents a Page modally, with optional animation.
+ /// </summary>
+ /// <param name="modal">The page to push.</param>
+ /// <param name="animated">Whether to animate the pop.</param>
+ /// <returns>An awaitable Task, indicating the PushModal completion.</returns>
+ protected virtual Task OnPushModal(Page modal, bool animated)
+ {
+ INavigation currentInner = Inner;
+ if (currentInner == null)
+ {
+ _modalStack.Value.Add(modal);
+ return Task.FromResult<object>(null);
+ }
+ return currentInner.PushModalAsync(modal, animated);
+ }
+
+ /// <summary>
+ /// This method calls when Removes the specified page from the navigation stack.
+ /// </summary>
+ /// <param name="page">The page to add.</param>
+ protected virtual void OnRemovePage(Page page)
+ {
+ INavigation currentInner = Inner;
+ if (currentInner == null)
+ {
+ _pushStack.Value.Remove(page);
+ }
+ else
+ {
+ currentInner.RemovePage(page);
+ }
+ }
+
+ Page Pop()
+ {
+ List<Page> list = _pushStack.Value;
+ Page result = list[list.Count - 1];
+ list.RemoveAt(list.Count - 1);
+ return result;
+ }
+
+ Page PopModal()
+ {
+ List<Page> list = _modalStack.Value;
+ Page result = list[list.Count - 1];
+ list.RemoveAt(list.Count - 1);
+ return result;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.Threading.Tasks;
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// <summary>
+ /// For internal use.
+ /// </summary>
+ internal class NavigationRequestedEventArgs : NavigationEventArgs
+ {
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ /// <param name="page"></param>
+ /// <param name="animated"></param>
+ /// <param name="realize"></param>
+ public NavigationRequestedEventArgs(Page page, bool animated, bool realize = true) : base(page)
+ {
+ Animated = animated;
+ Realize = realize;
+ }
+
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ /// <param name="page"></param>
+ /// <param name="before"></param>
+ /// <param name="animated"></param>
+ public NavigationRequestedEventArgs(Page page, Page before, bool animated) : this(page, animated)
+ {
+ BeforePage = before;
+ }
+
+ /// <summary>
+ /// Gets or Sets the whether animate.
+ /// </summary>
+ public bool Animated { get; set; }
+
+ /// <summary>
+ /// Gets or Sets the before page.
+ /// </summary>
+ public Page BeforePage { get; set; }
+
+ /// <summary>
+ /// Gets or Sets the realize.
+ /// </summary>
+ public bool Realize { get; set; }
+
+ /// <summary>
+ /// Gets or Sets the Task.
+ /// </summary>
+ public Task<bool> Task { get; set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+ internal class NullEffect : Effect
+ {
+ protected override void OnAttached()
+ {
+ }
+
+ protected override void OnDetached()
+ {
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Collections.Specialized;
+using System.Linq;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal class ObservableWrapper<TTrack, TRestrict> : IList<TRestrict>, INotifyCollectionChanged where TTrack : Element where TRestrict : TTrack
+ {
+ readonly ObservableCollection<TTrack> _list;
+
+ public ObservableWrapper(ObservableCollection<TTrack> list)
+ {
+ if (list == null)
+ throw new ArgumentNullException("list");
+
+ _list = list;
+
+ list.CollectionChanged += ListOnCollectionChanged;
+ }
+
+ public void Add(TRestrict item)
+ {
+ if (item == null)
+ throw new ArgumentNullException("item");
+ if (IsReadOnly)
+ throw new NotSupportedException("The collection is read-only.");
+
+ if (_list.Contains(item))
+ return;
+
+ item.Owned = true;
+ _list.Add(item);
+ }
+
+ public void Clear()
+ {
+ if (IsReadOnly)
+ throw new NotSupportedException("The collection is read-only.");
+
+ foreach (TRestrict item in _list.OfType<TRestrict>().ToArray())
+ {
+ _list.Remove(item);
+ item.Owned = false;
+ }
+ }
+
+ public bool Contains(TRestrict item)
+ {
+ return item.Owned && _list.Contains(item);
+ }
+
+ public void CopyTo(TRestrict[] array, int destIndex)
+ {
+ if (array.Length - destIndex < Count)
+ throw new ArgumentException("Destination array was not long enough. Check destIndex and length, and the array's lower bounds.");
+ foreach (TRestrict item in this)
+ {
+ array[destIndex] = item;
+ destIndex++;
+ }
+ }
+
+ public int Count
+ {
+ get { return _list.Where(i => i.Owned).OfType<TRestrict>().Count(); }
+ }
+
+ public bool IsReadOnly { get; internal set; }
+
+ public bool Remove(TRestrict item)
+ {
+ if (item == null)
+ throw new ArgumentNullException("item");
+ if (IsReadOnly)
+ throw new NotSupportedException("The collection is read-only.");
+
+ if (!item.Owned)
+ return false;
+
+ if (_list.Remove(item))
+ {
+ item.Owned = false;
+ return true;
+ }
+ return false;
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+
+ public IEnumerator<TRestrict> GetEnumerator()
+ {
+ return _list.Where(i => i.Owned).OfType<TRestrict>().GetEnumerator();
+ }
+
+ public int IndexOf(TRestrict value)
+ {
+ int innerIndex = _list.IndexOf(value);
+ if (innerIndex == -1)
+ return -1;
+ return ToOuterIndex(innerIndex);
+ }
+
+ public void Insert(int index, TRestrict item)
+ {
+ if (item == null)
+ throw new ArgumentNullException("item");
+ if (IsReadOnly)
+ throw new NotSupportedException("The collection is read-only.");
+
+ item.Owned = true;
+ _list.Insert(ToInnerIndex(index), item);
+ }
+
+ public TRestrict this[int index]
+ {
+ get { return (TRestrict)_list[ToInnerIndex(index)]; }
+ set
+ {
+ int innerIndex = ToInnerIndex(index);
+ if (value != null)
+ value.Owned = true;
+ TTrack old = _list[innerIndex];
+ _list[innerIndex] = value;
+
+ if (old != null)
+ old.Owned = false;
+ }
+ }
+
+ public void RemoveAt(int index)
+ {
+ if (IsReadOnly)
+ throw new NotSupportedException("The collection is read-only");
+ int innerIndex = ToInnerIndex(index);
+ TTrack item = _list[innerIndex];
+ if (item != null && item.Owned)
+ {
+ _list.RemoveAt(innerIndex);
+ item.Owned = false;
+ }
+ }
+
+ public event NotifyCollectionChangedEventHandler CollectionChanged;
+
+ void ListOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
+ {
+ NotifyCollectionChangedEventHandler handler = CollectionChanged;
+ if (handler == null)
+ return;
+
+ switch (e.Action)
+ {
+ case NotifyCollectionChangedAction.Add:
+ if (e.NewStartingIndex == -1 || e.NewItems?.Count > 1)
+ goto case NotifyCollectionChangedAction.Reset;
+
+ var newItem = e.NewItems[0] as TRestrict;
+ if (newItem == null || !newItem.Owned)
+ break;
+
+ int outerIndex = ToOuterIndex(e.NewStartingIndex);
+ handler(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, e.NewItems, outerIndex));
+ break;
+ case NotifyCollectionChangedAction.Move:
+ if (e.NewStartingIndex == -1 || e.OldStartingIndex == -1 || e.NewItems?.Count > 1)
+ goto case NotifyCollectionChangedAction.Reset;
+
+ var movedItem = e.NewItems[0] as TRestrict;
+ if (movedItem == null || !movedItem.Owned)
+ break;
+
+ int outerOldIndex = ToOuterIndex(e.OldStartingIndex);
+ int outerNewIndex = ToOuterIndex(e.NewStartingIndex);
+ handler(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Move, e.NewItems, outerNewIndex, outerOldIndex));
+ break;
+ case NotifyCollectionChangedAction.Remove:
+ if (e.OldStartingIndex == -1 || e.OldItems?.Count > 1)
+ goto case NotifyCollectionChangedAction.Reset;
+
+ var removedItem = e.OldItems[0] as TRestrict;
+ if (removedItem == null || !removedItem.Owned)
+ break;
+
+ int outerRemovedIndex = ToOuterIndex(e.OldStartingIndex);
+ var args = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, removedItem, outerRemovedIndex);
+ handler(this, args);
+ break;
+ case NotifyCollectionChangedAction.Replace:
+ if (e.NewStartingIndex == -1 || e.OldStartingIndex == -1 || e.NewItems?.Count > 1)
+ goto case NotifyCollectionChangedAction.Reset;
+
+ var newReplaceItem = e.NewItems[0] as TRestrict;
+ var oldReplaceItem = e.OldItems?[0] as TRestrict;
+
+ if ((newReplaceItem == null || !newReplaceItem.Owned) && (oldReplaceItem == null || !oldReplaceItem.Owned))
+ {
+ break;
+ }
+ if (newReplaceItem == null || !newReplaceItem.Owned || oldReplaceItem == null || !oldReplaceItem.Owned)
+ {
+ goto case NotifyCollectionChangedAction.Reset;
+ }
+
+ int index = ToOuterIndex(e.NewStartingIndex);
+
+ var replaceArgs = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, newReplaceItem, oldReplaceItem, index);
+ handler(this, replaceArgs);
+ break;
+ case NotifyCollectionChangedAction.Reset:
+ handler(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
+ break;
+ default:
+ throw new ArgumentOutOfRangeException();
+ }
+ }
+
+ int ToInnerIndex(int outterIndex)
+ {
+ var outerIndex = 0;
+ int innerIndex;
+ for (innerIndex = 0; innerIndex < _list.Count; innerIndex++)
+ {
+ TTrack item = _list[innerIndex];
+ if (item is TRestrict && item.Owned)
+ {
+ if (outerIndex == outterIndex)
+ return innerIndex;
+ outerIndex++;
+ }
+ }
+
+ return innerIndex;
+ }
+
+ int ToOuterIndex(int innerIndex)
+ {
+ var outerIndex = 0;
+ for (var index = 0; index < innerIndex; index++)
+ {
+ TTrack item = _list[index];
+ if (item is TRestrict && item.Owned)
+ {
+ outerIndex++;
+ }
+ }
+
+ return outerIndex;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using Tizen.NUI.XamlBinding.Internals;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal class OnIdiom<T>
+ {
+ public T Phone { get; set; }
+
+ public T Tablet { get; set; }
+
+ public T Desktop { get; set; }
+
+ public T TV { get; set; }
+
+ public T Watch { get; set; }
+
+ public static implicit operator T(OnIdiom<T> onIdiom)
+ {
+ switch (Device.Idiom)
+ {
+ default:
+ case TargetIdiom.Phone:
+ return onIdiom.Phone;
+ case TargetIdiom.Tablet:
+ return onIdiom.Tablet;
+ case TargetIdiom.Desktop:
+ return onIdiom.Desktop;
+ case TargetIdiom.TV:
+ return onIdiom.TV;
+ case TargetIdiom.Watch:
+ return onIdiom.Watch;
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI.XamlBinding
+{
+ [ContentProperty("Platforms")]
+ internal class OnPlatform<T>
+ {
+ public OnPlatform()
+ {
+ Platforms = new List<On>();
+ }
+
+ bool useLegacyFallback;
+ T android;
+ [Obsolete]
+ public T Android {
+ get { return android; }
+ set {
+ useLegacyFallback = true;
+ android = value;
+ }
+ }
+
+ T ios;
+ [Obsolete]
+ public T iOS {
+ get { return ios; }
+ set {
+ useLegacyFallback = true;
+ ios = value;
+ }
+ }
+
+ T winPhone;
+ [Obsolete]
+ public T WinPhone {
+ get { return winPhone; }
+ set {
+ useLegacyFallback = true;
+ winPhone = value;
+ }
+ }
+
+ bool hasDefault;
+ T @default;
+ public T Default {
+ get { return @default; }
+ set {
+ hasDefault = true;
+ @default = value;
+ }
+ }
+
+ public IList<On> Platforms { get; private set; }
+
+#pragma warning disable RECS0108 // Warns about static fields in generic types
+ static readonly IValueConverterProvider s_valueConverter = DependencyService.Get<IValueConverterProvider>();
+#pragma warning restore RECS0108 // Warns about static fields in generic types
+
+ public static implicit operator T(OnPlatform<T> onPlatform)
+ {
+ foreach (var onPlat in onPlatform.Platforms) {
+ if (onPlat.Platform == null)
+ continue;
+ if (!onPlat.Platform.Contains(Device.RuntimePlatform))
+ continue;
+ if (s_valueConverter == null)
+ continue;
+ return (T)s_valueConverter.Convert(onPlat.Value, typeof(T), null, null);
+ }
+
+ if (!onPlatform.useLegacyFallback)
+ return onPlatform.hasDefault ? onPlatform.@default : default(T);
+
+ //legacy fallback
+#pragma warning disable 0618, 0612
+ return Device.OnPlatform(iOS: onPlatform.iOS, Android: onPlatform.Android, WinPhone: onPlatform.WinPhone);
+#pragma warning restore 0618, 0612
+ }
+ }
+
+ [ContentProperty("Value")]
+ internal class On
+ {
+ [TypeConverter(typeof(ListStringTypeConverter))]
+ public IList<string> Platform { get; set; }
+ public object Value { get; set; }
+ }
+}
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+ internal static class PaddingElement
+ {
+ internal static readonly BindableProperty PaddingProperty =
+ BindableProperty.Create("Padding", typeof(Thickness), typeof(IPaddingElement), default(Thickness),
+ propertyChanged: OnPaddingPropertyChanged,
+ defaultValueCreator: PaddingDefaultValueCreator);
+
+ static void OnPaddingPropertyChanged(BindableObject bindable, object oldValue, object newValue)
+ {
+ ((IPaddingElement)bindable).OnPaddingPropertyChanged((Thickness)oldValue, (Thickness)newValue);
+ }
+
+ static object PaddingDefaultValueCreator(BindableObject bindable)
+ {
+ return ((IPaddingElement)bindable).PaddingDefaultValueCreator();
+ }
+
+ public static readonly BindableProperty PaddingLeftProperty =
+ BindableProperty.Create("PaddingLeft", typeof(double), typeof(IPaddingElement), default(double),
+ propertyChanged: OnPaddingLeftChanged);
+
+ static void OnPaddingLeftChanged(BindableObject bindable, object oldValue, object newValue)
+ {
+ var padding = (Thickness)bindable.GetValue(PaddingProperty);
+ padding.Left = (double)newValue;
+ bindable.SetValue(PaddingProperty, padding);
+ }
+
+ public static readonly BindableProperty PaddingTopProperty =
+ BindableProperty.Create("PaddingTop", typeof(double), typeof(IPaddingElement), default(double),
+ propertyChanged: OnPaddingTopChanged);
+
+ static void OnPaddingTopChanged(BindableObject bindable, object oldValue, object newValue)
+ {
+ var padding = (Thickness)bindable.GetValue(PaddingProperty);
+ padding.Top = (double)newValue;
+ bindable.SetValue(PaddingProperty, padding);
+ }
+
+ public static readonly BindableProperty PaddingRightProperty =
+ BindableProperty.Create("PaddingRight", typeof(double), typeof(IPaddingElement), default(double),
+ propertyChanged: OnPaddingRightChanged);
+
+ static void OnPaddingRightChanged(BindableObject bindable, object oldValue, object newValue)
+ {
+ var padding = (Thickness)bindable.GetValue(PaddingProperty);
+ padding.Right = (double)newValue;
+ bindable.SetValue(PaddingProperty, padding);
+ }
+
+ public static readonly BindableProperty PaddingBottomProperty =
+ BindableProperty.Create("PaddingBottom", typeof(double), typeof(IPaddingElement), default(double),
+ propertyChanged: OnPaddingBottomChanged);
+
+ static void OnPaddingBottomChanged(BindableObject bindable, object oldValue, object newValue)
+ {
+ var padding = (Thickness)bindable.GetValue(PaddingProperty);
+ padding.Bottom = (double)newValue;
+ bindable.SetValue(PaddingProperty, padding);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding
+{
+ [AttributeUsage(AttributeTargets.Parameter)]
+ internal sealed class ParameterAttribute : Attribute
+ {
+ public ParameterAttribute(string name)
+ {
+ Name = name;
+ }
+
+ public string Name { get; }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// <summary>
+ /// Helper that handles storing and lookup of platform specifics implementations
+ /// </summary>
+ /// <typeparam name="TElement">The Element type</typeparam>
+ internal class PlatformConfigurationRegistry<TElement> : IElementConfiguration<TElement>
+ where TElement : Element
+ {
+ readonly TElement _element;
+ readonly Dictionary<Type, object> _platformSpecifics = new Dictionary<Type, object>();
+
+ internal PlatformConfigurationRegistry(TElement element)
+ {
+ _element = element;
+ }
+
+
+ public IPlatformElementConfiguration<T, TElement> On<T>() where T : IConfigPlatform
+ {
+ if (_platformSpecifics.ContainsKey(typeof(T)))
+ {
+ return (IPlatformElementConfiguration<T, TElement>)_platformSpecifics[typeof(T)];
+ }
+
+ var emptyConfig = Configuration<T, TElement>.Create(_element);
+
+ _platformSpecifics.Add(typeof(T), emptyConfig);
+
+ return emptyConfig;
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+
+namespace Tizen.NUI.XamlBinding
+{
+ // Previewer uses reflection to bind to this method; Removal or modification of visibility will break previewer.
+ internal static class Registrar
+ {
+ internal static void RegisterAll(Type[] attrTypes) => Internals.Registrar.RegisterAll(attrTypes);
+ }
+}
+
+namespace Tizen.NUI.XamlBinding.Internals
+{
+ /// <summary>
+ /// For internal use.
+ /// </summary>
+ /// <typeparam name="TRegistrable"></typeparam>
+ internal class Registrar<TRegistrable> where TRegistrable : class
+ {
+ readonly Dictionary<Type, Type> _handlers = new Dictionary<Type, Type>();
+
+ /// <summary>
+ /// Register.
+ /// </summary>
+ /// <param name="tview">The type of the view</param>
+ /// <param name="trender">The type of the render.</param>
+ public void Register(Type tview, Type trender)
+ {
+ //avoid caching null renderers
+ if (trender == null)
+ return;
+ _handlers[tview] = trender;
+ }
+
+ internal TRegistrable GetHandler(Type type)
+ {
+ Type handlerType = GetHandlerType(type);
+ if (handlerType == null)
+ return null;
+
+ object handler = DependencyResolver.ResolveOrCreate(handlerType);
+
+ return (TRegistrable)handler;
+ }
+
+ internal TRegistrable GetHandler(Type type, params object[] args)
+ {
+ if (args.Length == 0)
+ {
+ return GetHandler(type);
+ }
+
+ Type handlerType = GetHandlerType(type);
+ if (handlerType == null)
+ return null;
+
+ return (TRegistrable)DependencyResolver.ResolveOrCreate(handlerType, args);
+ }
+
+ /// <summary>
+ /// For internal use. Returns handler.
+ /// </summary>
+ /// <typeparam name="TOut">The type of the handler</typeparam>
+ /// <param name="type">The type.</param>
+ /// <returns>The handler instance.</returns>
+ public TOut GetHandler<TOut>(Type type) where TOut : TRegistrable
+ {
+ return (TOut)GetHandler(type);
+ }
+
+ /// <summary>
+ /// For internal use. Returns handler.
+ /// </summary>
+ /// <typeparam name="TOut">The type of the handler</typeparam>
+ /// <param name="type">The type.</param>
+ /// <param name="args">The args of the type</param>
+ /// <returns>The handler instance.</returns>
+ public TOut GetHandler<TOut>(Type type, params object[] args) where TOut : TRegistrable
+ {
+ return (TOut)GetHandler(type, args);
+ }
+
+ /// <summary>
+ /// For internal use. Return the handler of the object.
+ /// </summary>
+ /// <typeparam name="TOut">Thetype</typeparam>
+ /// <param name="obj">The object instance.</param>
+ /// <returns>The handle of the obj.</returns>
+ public TOut GetHandlerForObject<TOut>(object obj) where TOut : TRegistrable
+ {
+ if (obj == null)
+ throw new ArgumentNullException(nameof(obj));
+
+ var reflectableType = obj as IReflectableType;
+ var type = reflectableType != null ? reflectableType.GetTypeInfo().AsType() : obj.GetType();
+
+ return (TOut)GetHandler(type);
+ }
+
+ /// <summary>
+ /// For inetrnal use. Return the handler of the object.
+ /// </summary>
+ /// <typeparam name="TOut">The type</typeparam>
+ /// <param name="obj">The object instance</param>
+ /// <param name="args">The args of the type</param>
+ /// <returns>The handler of the object.</returns>
+ public TOut GetHandlerForObject<TOut>(object obj, params object[] args) where TOut : TRegistrable
+ {
+ if (obj == null)
+ throw new ArgumentNullException(nameof(obj));
+
+ var reflectableType = obj as IReflectableType;
+ var type = reflectableType != null ? reflectableType.GetTypeInfo().AsType() : obj.GetType();
+
+ return (TOut)GetHandler(type, args);
+ }
+
+ /// <summary>
+ /// For internal use. Returns the handle type.
+ /// </summary>
+ /// <param name="viewType">The view type.</param>
+ /// <returns>The type of the handle.</returns>
+ public Type GetHandlerType(Type viewType)
+ {
+ Type type;
+ if (LookupHandlerType(viewType, out type))
+ return type;
+
+ // lazy load render-view association with RenderWithAttribute (as opposed to using ExportRenderer)
+ var attribute = viewType.GetTypeInfo().GetCustomAttribute<RenderWithAttribute>();
+ if (attribute == null)
+ {
+ Register(viewType, null); // Cache this result so we don't have to do GetCustomAttribute again
+ return null;
+ }
+
+ type = attribute.Type;
+
+ if (type.Name.StartsWith("_", StringComparison.Ordinal))
+ {
+ // TODO: Remove attribute2 once renderer names have been unified across all platforms
+ var attribute2 = type.GetTypeInfo().GetCustomAttribute<RenderWithAttribute>();
+ if (attribute2 != null)
+ type = attribute2.Type;
+
+ if (type.Name.StartsWith("_", StringComparison.Ordinal))
+ {
+ Register(viewType, null); // Cache this result so we don't work through this chain again
+ return null;
+ }
+ }
+
+ Register(viewType, type); // Register this so we don't have to look for the RenderWith Attibute again in the future
+
+ return type;
+ }
+
+ /// <summary>
+ /// For internal use. Return the handle type of the object
+ /// </summary>
+ /// <param name="obj">The object instance.</param>
+ /// <returns>The type of the handler.</returns>
+ public Type GetHandlerTypeForObject(object obj)
+ {
+ if (obj == null)
+ throw new ArgumentNullException(nameof(obj));
+
+ var reflectableType = obj as IReflectableType;
+ var type = reflectableType != null ? reflectableType.GetTypeInfo().AsType() : obj.GetType();
+
+ return GetHandlerType(type);
+ }
+
+ bool LookupHandlerType(Type viewType, out Type handlerType)
+ {
+ Type type = viewType;
+
+ while (type != null)
+ {
+ if (_handlers.ContainsKey(type))
+ {
+ handlerType = _handlers[type];
+ return true;
+ }
+
+ type = type.GetTypeInfo().BaseType;
+ }
+
+ handlerType = null;
+ return false;
+ }
+ }
+
+ /// <summary>
+ /// For internal use
+ /// </summary>
+ internal static class Registrar
+ {
+ static Registrar()
+ {
+ Registered = new Registrar<IRegisterable>();
+ }
+
+ internal static Dictionary<string, Type> Effects { get; } = new Dictionary<string, Type>();
+ internal static Dictionary<string, StyleSheets.StylePropertyAttribute> StyleProperties { get; } = new Dictionary<string, StyleSheets.StylePropertyAttribute>();
+
+ public static IEnumerable<Assembly> ExtraAssemblies { get; set; }
+
+ public static Registrar<IRegisterable> Registered { get; internal set; }
+
+ public static void RegisterAll(Type[] attrTypes)
+ {
+ Assembly[] assemblies = Device.GetAssemblies();
+ if (ExtraAssemblies != null)
+ assemblies = assemblies.Union(ExtraAssemblies).ToArray();
+
+ Assembly defaultRendererAssembly = Device.PlatformServices.GetType().GetTypeInfo().Assembly;
+ int indexOfExecuting = Array.IndexOf(assemblies, defaultRendererAssembly);
+
+ if (indexOfExecuting > 0)
+ {
+ assemblies[indexOfExecuting] = assemblies[0];
+ assemblies[0] = defaultRendererAssembly;
+ }
+
+ // Don't use LINQ for performance reasons
+ // Naive implementation can easily take over a second to run
+ foreach (Assembly assembly in assemblies)
+ {
+ foreach (Type attrType in attrTypes)
+ {
+ Attribute[] attributes;
+ try
+ {
+ attributes = assembly.GetCustomAttributes(attrType).ToArray();
+ }
+ catch (System.IO.FileNotFoundException)
+ {
+ // Sometimes the previewer doesn't actually have everything required for these loads to work
+ Console.WriteLine(nameof(Registrar), "Could not load assembly: {0} for Attibute {1} | Some renderers may not be loaded", assembly.FullName, attrType.FullName);
+ continue;
+ }
+ var length = attributes.Length;
+ for (var i = 0; i < length;i++)
+ {
+ var attribute = (HandlerAttribute)attributes[i];
+ if (attribute.ShouldRegister())
+ Registered.Register(attribute.HandlerType, attribute.TargetType);
+ }
+ }
+
+ string resolutionName = assembly.FullName;
+ var resolutionNameAttribute = (ResolutionGroupNameAttribute)assembly.GetCustomAttribute(typeof(ResolutionGroupNameAttribute));
+ if (resolutionNameAttribute != null)
+ resolutionName = resolutionNameAttribute.ShortName;
+
+ Attribute[] effectAttributes = assembly.GetCustomAttributes(typeof(ExportEffectAttribute)).ToArray();
+ var exportEffectsLength = effectAttributes.Length;
+ for (var i = 0; i < exportEffectsLength;i++)
+ {
+ var effect = (ExportEffectAttribute)effectAttributes[i];
+ Effects [resolutionName + "." + effect.Id] = effect.Type;
+ }
+
+ Attribute[] styleAttributes = assembly.GetCustomAttributes(typeof(StyleSheets.StylePropertyAttribute)).ToArray();
+ var stylePropertiesLength = styleAttributes.Length;
+ for (var i = 0; i < stylePropertiesLength; i++)
+ {
+ var attribute = (StyleSheets.StylePropertyAttribute)styleAttributes[i];
+ StyleProperties[attribute.CssPropertyName] = attribute;
+ }
+ }
+
+ DependencyService.Initialize(assemblies);
+ }
+ }
+}
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding
+{
+ [AttributeUsage(AttributeTargets.Class)]
+ internal sealed class RenderWithAttribute : Attribute
+ {
+ public RenderWithAttribute(Type type)
+ {
+ Type = type;
+ }
+
+ public Type Type { get; }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding
+{
+ [AttributeUsage(AttributeTargets.Assembly)]
+ internal class ResolutionGroupNameAttribute : Attribute
+ {
+ public ResolutionGroupNameAttribute(string name)
+ {
+ ShortName = name;
+ }
+
+ internal string ShortName { get; private set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal class ResourcesChangedEventArgs : EventArgs
+ {
+ public static readonly ResourcesChangedEventArgs StyleSheets = new ResourcesChangedEventArgs(null);
+
+ public ResourcesChangedEventArgs(IEnumerable<KeyValuePair<string, object>> values)
+ {
+ Values = values;
+ }
+
+ public IEnumerable<KeyValuePair<string, object>> Values { get; private set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal static class ResourcesExtensions
+ {
+ public static IEnumerable<KeyValuePair<string, object>> GetMergedResources(this IElement element)
+ {
+ Dictionary<string, object> resources = null;
+ while (element != null)
+ {
+ var ve = element as IResourcesProvider;
+ if (ve != null && ve.IsResourcesCreated)
+ {
+ resources = resources ?? new Dictionary<string, object>();
+ foreach (KeyValuePair<string, object> res in ve.XamlResources.MergedResources)
+ if (!resources.ContainsKey(res.Key))
+ resources.Add(res.Key, res.Value);
+ else if (res.Key.StartsWith(Style.StyleClassPrefix, StringComparison.Ordinal))
+ {
+ var mergedClassStyles = new List<Style>(resources[res.Key] as List<Style>);
+ mergedClassStyles.AddRange(res.Value as List<Style>);
+ resources[res.Key] = mergedClassStyles;
+ }
+ }
+ var app = element as Application;
+ if (app != null && app.SystemResources != null)
+ {
+ resources = resources ?? new Dictionary<string, object>(8);
+ foreach (KeyValuePair<string, object> res in app.SystemResources)
+ if (!resources.ContainsKey(res.Key))
+ resources.Add(res.Key, res.Value);
+ else if (res.Key.StartsWith(Style.StyleClassPrefix, StringComparison.Ordinal))
+ {
+ var mergedClassStyles = new List<Style>(resources[res.Key] as List<Style>);
+ mergedClassStyles.AddRange(res.Value as List<Style>);
+ resources[res.Key] = mergedClassStyles;
+ }
+ }
+ element = element.Parent;
+ }
+ return resources;
+ }
+
+ public static bool TryGetResource(this IElement element, string key, out object value)
+ {
+ while (element != null)
+ {
+ var ve = element as IResourcesProvider;
+ if (ve != null && ve.IsResourcesCreated && ve.XamlResources.TryGetValue(key, out value))
+ return true;
+ var app = element as Application;
+ if (app != null && app.SystemResources != null && app.SystemResources.TryGetValue(key, out value))
+ return true;
+ element = element.Parent;
+ }
+
+ //Fallback for the XF previewer
+ if (Application.Current != null && ((IResourcesProvider)Application.Current).IsResourcesCreated && Application.Current.XamlResources.TryGetValue(key, out value))
+ return true;
+
+ value = null;
+ return false;
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Globalization;
+using Tizen.NUI;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal class RotationTypeConverter : TypeConverter
+ {
+ public override object ConvertFromInvariantString(string value)
+ {
+ if (value != null)
+ {
+ string[] parts = value.Split(',');
+ if (parts.Length == 4)
+ {
+ 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")
+ {
+ radian = new Radian( new Degree( Single.Parse( head[1].Trim(), CultureInfo.InvariantCulture ) ) );
+ }
+ else if (radianOrDegree == "r" || radianOrDegree == "radian")
+ {
+ 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)
+ {
+ 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);
+ }
+ }
+
+ throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(Rotation)}");
+ }
+ }
+}
--- /dev/null
+using System.ComponentModel;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal class RoutingEffect : Effect
+ {
+ internal readonly Effect Inner;
+
+ protected RoutingEffect(string effectId)
+ {
+ Inner = Resolve(effectId);
+ }
+
+ protected override void OnAttached()
+ {
+ }
+
+ protected override void OnDetached()
+ {
+ }
+
+ internal override void ClearEffect()
+ {
+ Inner?.ClearEffect();
+ }
+
+ internal override void SendAttached()
+ {
+ Inner?.SendAttached();
+ }
+
+ internal override void SendDetached()
+ {
+ Inner?.SendDetached();
+ }
+
+ internal override void SendOnElementPropertyChanged(PropertyChangedEventArgs args)
+ {
+ Inner?.SendOnElementPropertyChanged(args);
+ }
+ }
+}
--- /dev/null
+using System.Diagnostics;
+using Tizen.NUI;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// <summary>
+ /// Struct that defines minimum and maximum Sizes.
+ /// </summary>
+ [DebuggerDisplay("Request={Request.Width}x{Request.Height}, Minimum={Minimum.Width}x{Minimum.Height}")]
+ internal struct SizeRequest
+ {
+ /// <summary>
+ /// The requested size.
+ /// </summary>
+ public Size Request { get; set; }
+
+ /// <summary>
+ /// The minimum acceptable size.
+ /// </summary>
+ public Size Minimum { get; set; }
+
+ /// <summary>
+ /// Creates a new SizeRequest object that requests at least the size minimum, but preferably the size request.
+ /// </summary>
+ /// <param name="request">The size of the request.</param>
+ /// <param name="minimum">The minimum size for the request.</param>
+ public SizeRequest(Size request, Size minimum)
+ {
+ Request = request;
+ Minimum = minimum;
+ }
+
+ /// <summary>
+ /// Creates a new SizeRequest with the specified request size.
+ /// </summary>
+ /// <param name="request">The size of the request.</param>
+ public SizeRequest(Size request)
+ {
+ Request = request;
+ Minimum = request;
+ }
+
+ /// <summary>
+ /// Returns a string representation of the size request.
+ /// </summary>
+ /// <returns>a string representation of the size request.</returns>
+ public override string ToString()
+ {
+ return string.Format("{{Request={0} Minimum={1}}}", Request, Minimum);
+ }
+ }
+}
--- /dev/null
+using System.Runtime.CompilerServices;
+
+namespace Tizen.NUI.StyleSheets
+{
+ internal static class CharExtensions
+ {
+ //w [ \t\r\n\f]*
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool IsW(this char c)
+ {
+ return c == ' '
+ || c == '\t'
+ || c == '\r'
+ || c == '\n'
+ || c == '\f';
+ }
+
+ //nmstart [_a-z]|{nonascii}|{escape}
+ //escape {unicode}|\\[^\n\r\f0-9a-f]
+ //nonascii [^\0-\237]
+ // TODO support escape and nonascii
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool IsNmStart(this char c)
+ {
+ return c == '_' || char.IsLetter(c);
+ }
+
+ //nmchar [_a-z0-9-]|{nonascii}|{escape}
+ //unicode \\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?
+ //escape {unicode}|\\[^\n\r\f0-9a-f]
+ //nonascii [^\0-\237]
+ //TODO support escape, nonascii and unicode
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool IsNmChar(this char c)
+ {
+ return c == '_'
+ || c == '-'
+ || char.IsLetterOrDigit(c);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.StyleSheets
+{
+ internal abstract class Selector
+ {
+ Selector()
+ {
+ }
+
+ public static Selector Parse(CssReader reader, char stopChar = '\0')
+ {
+ Selector root = All, workingRoot = All;
+ Operator workingRootParent = null;
+ Action<Operator, Selector> setCurrentSelector = (op, sel) => SetCurrentSelector(ref root, ref workingRoot, ref workingRootParent, op, sel);
+
+ int p;
+ reader.SkipWhiteSpaces();
+ while ((p = reader.Peek()) > 0) {
+ switch (unchecked((char)p)) {
+ case '*':
+ setCurrentSelector(new And(), All);
+ reader.Read();
+ break;
+ case '.':
+ reader.Read();
+ var className = reader.ReadIdent();
+ if (className == null)
+ return Invalid;
+ setCurrentSelector(new And(), new Class(className));
+ break;
+ case '#':
+ reader.Read();
+ var id = reader.ReadName();
+ if (id == null)
+ return Invalid;
+ setCurrentSelector(new And(), new Id(id));
+ break;
+ case '[':
+ throw new NotImplementedException("Attributes not implemented");
+ case ',':
+ reader.Read();
+ setCurrentSelector(new Or(), All);
+ reader.SkipWhiteSpaces();
+ break;
+ case '+':
+ reader.Read();
+ setCurrentSelector(new Adjacent(), All);
+ reader.SkipWhiteSpaces();
+ break;
+ case '~':
+ reader.Read();
+ setCurrentSelector(new Sibling(), All);
+ reader.SkipWhiteSpaces();
+ break;
+ case '>':
+ reader.Read();
+ setCurrentSelector(new Child(), All);
+ reader.SkipWhiteSpaces();
+ break;
+ case '^': //not in CSS spec
+ reader.Read();
+ var element = reader.ReadIdent();
+ if (element == null) return Invalid;
+ setCurrentSelector(new And(), new Base(element));
+ break;
+ case ' ':
+ case '\t':
+ case '\n':
+ case '\r':
+ case '\f':
+ reader.Read();
+ bool processWs = false;
+ while ((p = reader.Peek()) > 0) {
+ var c = unchecked((char)p);
+ if (char.IsWhiteSpace(c)) {
+ reader.Read();
+ continue;
+ }
+ processWs = (c != '+'
+ && c != '>'
+ && c != ','
+ && c != '~'
+ && c != '^'
+ && c != stopChar);
+ break;
+ }
+ if (!processWs)
+ break;
+ setCurrentSelector(new Descendent(), All);
+ reader.SkipWhiteSpaces();
+ break;
+ default:
+ if (unchecked((char)p) == stopChar)
+ return root;
+
+ var elementName = reader.ReadIdent();
+ if (elementName == null)
+ return Invalid;
+ setCurrentSelector(new And(), new Element(elementName));
+ break;
+ }
+ }
+ return root;
+ }
+
+ static void SetCurrentSelector(ref Selector root, ref Selector workingRoot, ref Operator workingRootParent, Operator op, Selector sel)
+ {
+ var updateRoot = root == workingRoot;
+
+ op.Left = workingRoot;
+ op.Right = sel;
+ workingRoot = op;
+ if (workingRootParent != null)
+ workingRootParent.Right = workingRoot;
+
+ if (updateRoot)
+ root = workingRoot;
+
+ if (workingRoot is Or) {
+ workingRootParent = (Operator)workingRoot;
+ workingRoot = sel;
+ }
+ }
+
+ public abstract bool Matches(IStyleSelectable styleable);
+
+ internal static Selector Invalid = new Generic(s => false);
+ internal static Selector All = new Generic(s => true);
+
+ abstract class UnarySelector : Selector
+ {
+ }
+
+ abstract class Operator : Selector
+ {
+ public Selector Left { get; set; } = Invalid;
+ public Selector Right { get; set; } = Invalid;
+ }
+
+ sealed class Generic : UnarySelector
+ {
+ readonly Func<IStyleSelectable, bool> func;
+ public Generic(Func<IStyleSelectable, bool> func)
+ {
+ this.func = func;
+ }
+
+ public override bool Matches(IStyleSelectable styleable) => func(styleable);
+ }
+
+ sealed class Class : UnarySelector
+ {
+ public Class(string className)
+ {
+ ClassName = className;
+ }
+
+ public string ClassName { get; }
+ public override bool Matches(IStyleSelectable styleable)
+ => styleable.Classes != null && styleable.Classes.Contains(ClassName);
+ }
+
+ sealed class Id : UnarySelector
+ {
+ public Id(string id)
+ {
+ IdName = id;
+ }
+
+ public string IdName { get; }
+ public override bool Matches(IStyleSelectable styleable) => styleable.Id == IdName;
+ }
+
+ sealed class Or : Operator
+ {
+ public override bool Matches(IStyleSelectable styleable) => Right.Matches(styleable) || Left.Matches(styleable);
+ }
+
+ sealed class And : Operator
+ {
+ public override bool Matches(IStyleSelectable styleable) => Right.Matches(styleable) && Left.Matches(styleable);
+ }
+
+ sealed class Element : UnarySelector
+ {
+ public Element(string elementName)
+ {
+ ElementName = elementName;
+ }
+
+ public string ElementName { get; }
+ public override bool Matches(IStyleSelectable styleable) =>
+ string.Equals(styleable.NameAndBases[0], ElementName, StringComparison.OrdinalIgnoreCase);
+ }
+
+ sealed class Base : UnarySelector
+ {
+ public Base(string elementName)
+ {
+ ElementName = elementName;
+ }
+
+ public string ElementName { get; }
+ public override bool Matches(IStyleSelectable styleable) {
+ for (var i = 0; i < styleable.NameAndBases.Length; i++)
+ if (string.Equals(styleable.NameAndBases[i], ElementName, StringComparison.OrdinalIgnoreCase))
+ return true;
+ return false;
+ }
+ }
+
+ sealed class Child : Operator
+ {
+ public override bool Matches(IStyleSelectable styleable) =>
+ Right.Matches(styleable) && styleable.Parent != null && Left.Matches(styleable.Parent);
+ }
+
+ sealed class Descendent : Operator
+ {
+ public override bool Matches(IStyleSelectable styleable)
+ {
+ if (!Right.Matches(styleable))
+ return false;
+ var parent = styleable.Parent;
+ while (parent != null) {
+ if (Left.Matches(parent))
+ return true;
+ parent = parent.Parent;
+ }
+ return false;
+ }
+ }
+
+ sealed class Adjacent : Operator
+ {
+ public override bool Matches(IStyleSelectable styleable)
+ {
+ if (!Right.Matches(styleable))
+ return false;
+ if (styleable.Parent == null)
+ return false;
+
+ IStyleSelectable prev = null;
+ foreach (var elem in styleable.Parent.Children) {
+ if (elem == styleable && prev != null)
+ return Left.Matches(prev);
+ prev = elem;
+ }
+ return false;
+ //var index = styleable.Parent.Children.IndexOf(styleable);
+ //if (index == 0)
+ // return false;
+ //var adjacent = styleable.Parent.Children[index - 1];
+ //return Left.Matches(adjacent);
+ }
+ }
+
+ sealed class Sibling : Operator
+ {
+ public override bool Matches(IStyleSelectable styleable)
+ {
+ if (!Right.Matches(styleable))
+ return false;
+ if (styleable.Parent == null)
+ return false;
+
+ int selfIndex = 0;
+ bool foundSelfInParent = false;
+ foreach (var elem in styleable.Parent.Children) {
+ if (elem == styleable) {
+ foundSelfInParent = true;
+ break;
+ }
+ ++selfIndex;
+ }
+
+ if (!foundSelfInParent)
+ return false;
+
+ int index = 0;
+ foreach (var elem in styleable.Parent.Children) {
+ if (index >= selfIndex)
+ return false;
+ if (Left.Matches(elem))
+ return true;
+ ++index;
+ }
+
+ return false;
+
+ //var index = styleable.Parent.Children.IndexOf(styleable);
+ //if (index == 0)
+ // return false;
+ //int siblingIndex = -1;
+ //for (var i = 0; i < index; i++)
+ // if (Left.Matches(styleable.Parent.Children[i])) {
+ // siblingIndex = i;
+ // break;
+ // }
+ //return siblingIndex != -1;
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using Tizen.NUI.XamlBinding;
+
+namespace Tizen.NUI.StyleSheets
+{
+ [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true, Inherited = true)]
+ internal sealed class StylePropertyAttribute : Attribute
+ {
+ public string CssPropertyName { get; }
+ public string BindablePropertyName { get; }
+ public Type TargetType { get; }
+ public Type PropertyOwnerType { get; set; }
+ public BindableProperty BindableProperty { get; set; }
+ public bool Inherited { get; set; } = false;
+
+
+ public StylePropertyAttribute(string cssPropertyName, Type targetType, string bindablePropertyName)
+ {
+ CssPropertyName = cssPropertyName;
+ BindablePropertyName = bindablePropertyName;
+ TargetType = targetType;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.Collections.Generic;
+using Tizen.NUI.XamlBinding;
+
+namespace Tizen.NUI.StyleSheets
+{
+ internal static class StyleSheetExtensions
+ {
+ public static IEnumerable<StyleSheet> GetStyleSheets(this Tizen.NUI.Binding.IResourcesProvider resourcesProvider)
+ {
+ if (!resourcesProvider.IsResourcesCreated)
+ yield break;
+ if (resourcesProvider.XamlResources.StyleSheets == null)
+ yield break;
+ foreach (var styleSheet in resourcesProvider.XamlResources.StyleSheets)
+ yield return styleSheet;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI.StyleSheets
+{
+ internal class StyleSheetServiceProvider : IServiceProvider
+ {
+ IProvideValueTarget vtProvider;
+ IConverterOptions convOptions => new ConverterOptions();
+
+ public StyleSheetServiceProvider(object targetObject, object targetProperty)
+ {
+ vtProvider = new ValueTargetProvider {
+ TargetObject = targetObject,
+ TargetProperty = targetProperty
+ };
+ }
+
+ public object GetService(Type serviceType)
+ {
+ if (serviceType == typeof(IProvideValueTarget))
+ return vtProvider;
+ if (serviceType == typeof(IConverterOptions))
+ return convOptions;
+ return null;
+ }
+
+ class ValueTargetProvider : IProvideValueTarget
+ {
+ public object TargetObject { get; set; }
+ public object TargetProperty { get; set; }
+ }
+
+ class ConverterOptions : IConverterOptions
+ {
+ public bool IgnoreCase => true;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.IO;
+using System.Linq;
+using System.Text;
+
+namespace Tizen.NUI.StyleSheets
+{
+ internal static class TextReaderExtensions
+ {
+ //ident [-]?{nmstart}{nmchar}*
+ public static string ReadIdent(this TextReader reader)
+ {
+ var sb = new StringBuilder();
+ bool first = true;
+ bool hasLeadingDash = false;
+ int p;
+ while ((p = reader.Peek()) > 0) {
+ var c = unchecked((char)p);
+ if (first && !hasLeadingDash && c == '-') {
+ sb.Append((char)reader.Read());
+ hasLeadingDash = true;
+ } else if (first && c.IsNmStart()) {
+ sb.Append((char)reader.Read());
+ first = false;
+ } else if (first) { //a nmstart is expected
+ throw new Exception();
+ } else if (c.IsNmChar())
+ sb.Append((char)reader.Read());
+ else
+ break;
+ }
+ return sb.ToString();
+ }
+
+ //name {nmchar}+
+ public static string ReadName(this TextReader reader)
+ {
+ var sb = new StringBuilder();
+ int p;
+ while ((p = reader.Peek()) > 0) {
+ var c = unchecked((char)p);
+ if (c.IsNmChar())
+ sb.Append((char)reader.Read());
+ else
+ break;
+ }
+ return sb.ToString();
+ }
+
+ public static string ReadUntil(this TextReader reader, params char[] limit)
+ {
+ var sb = new StringBuilder();
+ int p;
+ while ((p = reader.Peek()) > 0) {
+ var c = unchecked((char)p);
+ if (limit != null && limit.Contains(c))
+ break;
+ reader.Read();
+ sb.Append(c);
+ }
+ return sb.ToString();
+ }
+
+ //w [ \t\r\n\f]*
+ public static void SkipWhiteSpaces(this TextReader reader)
+ {
+ int p;
+ while ((p = reader.Peek()) > 0) {
+ var c = unchecked((char)p);
+ if (!c.IsW())
+ break;
+ reader.Read();
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal class SynchronizedList<T> : IList<T>, IReadOnlyList<T>
+ {
+ readonly List<T> _list = new List<T>();
+ ReadOnlyCollection<T> _snapshot;
+
+ public void Add(T item)
+ {
+ lock (_list)
+ {
+ _list.Add(item);
+ _snapshot = null;
+ }
+ }
+
+ public void Clear()
+ {
+ lock (_list)
+ {
+ _list.Clear();
+ _snapshot = null;
+ }
+ }
+
+ public bool Contains(T item)
+ {
+ lock (_list)
+ return _list.Contains(item);
+ }
+
+ public void CopyTo(T[] array, int arrayIndex)
+ {
+ lock (_list)
+ _list.CopyTo(array, arrayIndex);
+ }
+
+ public int Count
+ {
+ get
+ {
+ lock (_list)
+ return _list.Count;
+ }
+ }
+
+ bool ICollection<T>.IsReadOnly
+ {
+ get { return false; }
+ }
+
+ public bool Remove(T item)
+ {
+ lock (_list)
+ {
+ if (_list.Remove(item))
+ {
+ _snapshot = null;
+ return true;
+ }
+
+ return false;
+ }
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+
+ public IEnumerator<T> GetEnumerator()
+ {
+ ReadOnlyCollection<T> snap = _snapshot;
+ if (snap == null)
+ {
+ lock (_list)
+ _snapshot = snap = new ReadOnlyCollection<T>(_list.ToList());
+ }
+
+ return snap?.GetEnumerator();
+ }
+
+ public int IndexOf(T item)
+ {
+ lock (_list)
+ return _list.IndexOf(item);
+ }
+
+ public void Insert(int index, T item)
+ {
+ lock (_list)
+ {
+ _list.Insert(index, item);
+ _snapshot = null;
+ }
+ }
+
+ public T this[int index]
+ {
+ get
+ {
+ lock (_list)
+ {
+ ReadOnlyCollection<T> snap = _snapshot;
+ if (snap != null)
+ return snap[index];
+
+ return _list[index];
+ }
+ }
+
+ set
+ {
+ lock (_list)
+ {
+ _list[index] = value;
+ _snapshot = null;
+ }
+ }
+ }
+
+ public void RemoveAt(int index)
+ {
+ lock (_list)
+ {
+ _list.RemoveAt(index);
+ _snapshot = null;
+ }
+ }
+ }
+}
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+ internal enum TargetIdiom
+ {
+ Unsupported,
+ Phone,
+ Tablet,
+ Desktop,
+ TV,
+ Watch
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding
+{
+ [Obsolete]
+ internal enum TargetPlatform
+ {
+ Other,
+ iOS,
+ Android,
+ WinPhone,
+ Windows
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Globalization;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal class TemplateBinding : BindingBase
+ {
+ internal const string SelfPath = ".";
+ IValueConverter _converter;
+ object _converterParameter;
+
+ BindingExpression _expression;
+ string _path;
+
+ public TemplateBinding()
+ {
+ }
+
+ public TemplateBinding(string path, BindingMode mode = BindingMode.Default, IValueConverter converter = null, object converterParameter = null, string stringFormat = null)
+ {
+ if (path == null)
+ throw new ArgumentNullException("path");
+ if (string.IsNullOrWhiteSpace(path))
+ throw new ArgumentException("path can not be an empty string", "path");
+
+ AllowChaining = true;
+ Path = path;
+ Converter = converter;
+ ConverterParameter = converterParameter;
+ Mode = mode;
+ StringFormat = stringFormat;
+ }
+
+ public IValueConverter Converter
+ {
+ get { return _converter; }
+ set
+ {
+ ThrowIfApplied();
+
+ _converter = value;
+ }
+ }
+
+ public object ConverterParameter
+ {
+ get { return _converterParameter; }
+ set
+ {
+ ThrowIfApplied();
+
+ _converterParameter = value;
+ }
+ }
+
+ public string Path
+ {
+ get { return _path; }
+ set
+ {
+ ThrowIfApplied();
+
+ _path = value;
+ _expression = GetBindingExpression(value);
+ }
+ }
+
+ internal override void Apply(bool fromTarget)
+ {
+ base.Apply(fromTarget);
+
+ if (_expression == null)
+ _expression = new BindingExpression(this, SelfPath);
+
+ _expression.Apply(fromTarget);
+ }
+
+ internal override async void Apply(object newContext, BindableObject bindObj, BindableProperty targetProperty, bool fromBindingContextChanged = false)
+ {
+ var view = bindObj as Element;
+ if (view == null)
+ throw new InvalidOperationException();
+
+ base.Apply(newContext, bindObj, targetProperty, fromBindingContextChanged);
+
+ Element templatedParent = await TemplateUtilities.FindTemplatedParentAsync(view);
+ ApplyInner(templatedParent, bindObj, targetProperty);
+ }
+
+ internal override BindingBase Clone()
+ {
+ return new TemplateBinding(Path, Mode) { Converter = Converter, ConverterParameter = ConverterParameter, StringFormat = StringFormat };
+ }
+
+ internal override object GetSourceValue(object value, Type targetPropertyType)
+ {
+ if (Converter != null)
+ value = Converter.Convert(value, targetPropertyType, ConverterParameter, CultureInfo.CurrentUICulture);
+
+ return base.GetSourceValue(value, targetPropertyType);
+ }
+
+ internal override object GetTargetValue(object value, Type sourcePropertyType)
+ {
+ if (Converter != null)
+ value = Converter.ConvertBack(value, sourcePropertyType, ConverterParameter, CultureInfo.CurrentUICulture);
+
+ return base.GetTargetValue(value, sourcePropertyType);
+ }
+
+ internal override void Unapply(bool fromBindingContextChanged = false)
+ {
+ base.Unapply(fromBindingContextChanged: fromBindingContextChanged);
+
+ if (_expression != null)
+ _expression.Unapply();
+ }
+
+ void ApplyInner(Element templatedParent, BindableObject bindableObject, BindableProperty targetProperty)
+ {
+ if (_expression == null && templatedParent != null)
+ _expression = new BindingExpression(this, SelfPath);
+
+ _expression?.Apply(templatedParent, bindableObject, targetProperty);
+ }
+
+ BindingExpression GetBindingExpression(string path)
+ {
+ return new BindingExpression(this, !string.IsNullOrWhiteSpace(path) ? path : SelfPath);
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Threading.Tasks;
+using Tizen.NUI.Xaml.Forms.BaseComponents;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal static class TemplateUtilities
+ {
+ public static async Task<Element> FindTemplatedParentAsync(Element element)
+ {
+ if (element.RealParent is Application)
+ return null;
+
+ element = await GetRealParentAsync(element);
+ while (!Application.IsApplicationOrNull(element))
+ {
+ var controlTemplated = element as IControlTemplated;
+ element = await GetRealParentAsync(element);
+ }
+
+ return null;
+ }
+
+ public static Task<Element> GetRealParentAsync(Element element)
+ {
+ Element parent = element.RealParent;
+ if (parent is Application)
+ return Task.FromResult<Element>(null);
+
+ if (parent != null)
+ return Task.FromResult(parent);
+
+ var tcs = new TaskCompletionSource<Element>();
+ EventHandler handler = null;
+ handler = (sender, args) =>
+ {
+ tcs.TrySetResult(element.RealParent);
+ element.ParentSet -= handler;
+ };
+ element.ParentSet += handler;
+
+ return tcs.Task;
+ }
+
+ public static void OnControlTemplateChanged(BindableObject bindable, object oldValue, object newValue)
+ {
+ var self = (IControlTemplated)bindable;
+
+ // First make sure any old ContentPresenters are no longer bound up. This MUST be
+ // done before we attempt to make the new template.
+ if (oldValue != null)
+ {
+ var queue = new Queue<Element>(16);
+ queue.Enqueue((Element)self);
+
+ while (queue.Count > 0)
+ {
+ ReadOnlyCollection<Element> children = queue.Dequeue().LogicalChildrenInternal;
+ for (var i = 0; i < children.Count; i++)
+ {
+ Element child = children[i];
+ var controlTemplated = child as IControlTemplated;
+ }
+ }
+ }
+
+ // Now remove all remnants of any other children just to be sure
+ while (self.InternalChildren.Count > 0)
+ {
+ self.InternalChildren.RemoveAt(self.InternalChildren.Count - 1);
+ }
+ }
+ }
+}
--- /dev/null
+using System.Diagnostics;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// <summary>
+ /// Struct defining thickness around the edges of a Rectangle using doubles.
+ /// </summary>
+ [DebuggerDisplay("Left={Left}, Top={Top}, Right={Right}, Bottom={Bottom}, HorizontalThickness={HorizontalThickness}, VerticalThickness={VerticalThickness}")]
+ [TypeConverter(typeof(ThicknessTypeConverter))]
+ internal struct Thickness
+ {
+ /// <summary>
+ /// The thickness of the left side of a rectangle.
+ /// </summary>
+ public double Left { get; set; }
+
+ /// <summary>
+ /// The thickness of the top of a rectangle.
+ /// </summary>
+ public double Top { get; set; }
+
+ /// <summary>
+ /// The thickness of the right side of a rectangle.
+ /// </summary>
+ public double Right { get; set; }
+
+ /// <summary>
+ /// The thickness of the bottom of a rectangle.
+ /// </summary>
+ public double Bottom { get; set; }
+
+ /// <summary>
+ /// The sum of Left and Right.
+ /// </summary>
+ public double HorizontalThickness
+ {
+ get { return Left + Right; }
+ }
+
+ /// <summary>
+ /// The sum of Top and Bottom.
+ /// </summary>
+ public double VerticalThickness
+ {
+ get { return Top + Bottom; }
+ }
+
+ internal bool IsDefault
+ {
+ get { return Left == 0 && Top == 0 && Right == 0 && Bottom == 0; }
+ }
+
+ /// <summary>
+ /// Creates a new Thickness object that represents a uniform thickness of size uniformSize.
+ /// </summary>
+ /// <param name="uniformSize">The uniform size of all edges in the new thickness.</param>
+ public Thickness(double uniformSize) : this(uniformSize, uniformSize, uniformSize, uniformSize)
+ {
+ }
+
+ /// <summary>
+ /// Creates a new Thickness object that has a horizontal thickness of horizontalSize and a vertical thickness of verticalSize.
+ /// </summary>
+ /// <param name="horizontalSize">The width of the left and right thicknesses.</param>
+ /// <param name="verticalSize">The height of the top and bottom thicknesses.</param>
+ public Thickness(double horizontalSize, double verticalSize) : this(horizontalSize, verticalSize, horizontalSize, verticalSize)
+ {
+ }
+
+ /// <summary>
+ /// Creates a new Thickness object with thicknesses defined by left, top, right, and bottom.
+ /// </summary>
+ /// <param name="left">The width of the left thickness.</param>
+ /// <param name="top">The height of the top thickness.</param>
+ /// <param name="right">The width of the right thickness.</param>
+ /// <param name="bottom">The height of the bottom thickness.</param>
+ public Thickness(double left, double top, double right, double bottom) : this()
+ {
+ Left = left;
+ Top = top;
+ Right = right;
+ Bottom = bottom;
+ }
+
+ /// <summary>
+ /// Converts a Size into a Thickness.
+ /// </summary>
+ /// <param name="size">A Size to convert to a Thickness</param>
+ public static implicit operator Thickness(Size size)
+ {
+ return new Thickness(size.Width, size.Height, size.Width, size.Height);
+ }
+
+ /// <summary>
+ /// Implicit cast operator from Double.
+ /// </summary>
+ /// <param name="uniformSize">The value for the uniform Thickness.</param>
+ public static implicit operator Thickness(double uniformSize)
+ {
+ return new Thickness(uniformSize);
+ }
+
+ /// <summary>
+ /// Whether the other has equivalent values.
+ /// </summary>
+ /// <param name="other">A Thickness to be compared.</param>
+ /// <returns>true if other has equivalent values.</returns>
+ bool Equals(Thickness other)
+ {
+ return Left.Equals(other.Left) && Top.Equals(other.Top) && Right.Equals(other.Right) && Bottom.Equals(other.Bottom);
+ }
+
+ /// <summary>
+ /// Whether the obj has equivalent values.
+ /// </summary>
+ /// <param name="obj">A Thickness to be compared.</param>
+ /// <returns>true if obj is a Thickness and has equivalent values.</returns>
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj))
+ return false;
+ return obj is Thickness && Equals((Thickness)obj);
+ }
+
+ /// <summary>
+ /// A hash value for this Thickness.
+ /// </summary>
+ /// <returns>The hash value</returns>
+ public override int GetHashCode()
+ {
+ unchecked
+ {
+ int hashCode = Left.GetHashCode();
+ hashCode = (hashCode * 397) ^ Top.GetHashCode();
+ hashCode = (hashCode * 397) ^ Right.GetHashCode();
+ hashCode = (hashCode * 397) ^ Bottom.GetHashCode();
+ return hashCode;
+ }
+ }
+
+ /// <summary>
+ /// Whether two Thicknesses have identical values.
+ /// </summary>
+ /// <param name="left">A Thickness to be compared.</param>
+ /// <param name="right">A Thickness to be compared.</param>
+ /// <returns>true if left and right have identical values for Left,Right, Top, and Bottom.</returns>
+ public static bool operator ==(Thickness left, Thickness right)
+ {
+ return left.Equals(right);
+ }
+
+ /// <summary>
+ /// Whether the values of two Thickness's have at least one difference.
+ /// </summary>
+ /// <param name="left">A Thickness to be compared.</param>
+ /// <param name="right">A Thickness to be compared.</param>
+ /// <returns>true if any of the Left,Right, Top, and Bottom values differ between left and right.</returns>
+ public static bool operator !=(Thickness left, Thickness right)
+ {
+ return !left.Equals(right);
+ }
+
+ /// <summary>
+ /// Stores the components of the thickness in the corresponding arguments.
+ /// </summary>
+ /// <param name="left">Variable in which to store the left thickness of thickness object.</param>
+ /// <param name="top">Variable in which to store the top thickness of thickness object.</param>
+ /// <param name="right">Variable in which to store the right thickness of thickness object.</param>
+ /// <param name="bottom">Variable in which to store the bottom thickness of thickness object.</param>
+ public void Deconstruct(out double left, out double top, out double right, out double bottom)
+ {
+ left = Left;
+ top = Top;
+ right = Right;
+ bottom = Bottom;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Globalization;
+
+namespace Tizen.NUI.XamlBinding
+{
+ [Xaml.ProvideCompiled("Tizen.NUI.Xaml.Forms.XamlC.ThicknessTypeConverter")]
+ [Xaml.TypeConversion(typeof(Thickness))]
+ internal class ThicknessTypeConverter : TypeConverter
+ {
+ public override object ConvertFromInvariantString(string value)
+ {
+ if (value != null) {
+ value = value.Trim();
+ if (value.Contains(",")) { //Xaml
+ var thickness = value.Split(',');
+ switch (thickness.Length) {
+ case 2:
+ if ( double.TryParse(thickness[0], NumberStyles.Number, CultureInfo.InvariantCulture, out double h)
+ && double.TryParse(thickness[1], NumberStyles.Number, CultureInfo.InvariantCulture, out double v))
+ return new Thickness(h, v);
+ break;
+ case 4:
+ if ( double.TryParse(thickness[0], NumberStyles.Number, CultureInfo.InvariantCulture, out double l)
+ && double.TryParse(thickness[1], NumberStyles.Number, CultureInfo.InvariantCulture, out double t)
+ && double.TryParse(thickness[2], NumberStyles.Number, CultureInfo.InvariantCulture, out double r)
+ && double.TryParse(thickness[3], NumberStyles.Number, CultureInfo.InvariantCulture, out double b))
+ return new Thickness(l, t, r, b);
+ break;
+ }
+ }
+ else if (value.Contains(" ")) { //CSS
+ var thickness = value.Split(' ');
+ switch (thickness.Length) {
+ case 2:
+ if ( double.TryParse(thickness[0], NumberStyles.Number, CultureInfo.InvariantCulture, out double v)
+ && double.TryParse(thickness[1], NumberStyles.Number, CultureInfo.InvariantCulture, out double h))
+ return new Thickness(h, v);
+ break;
+ case 3:
+ if ( double.TryParse(thickness[0], NumberStyles.Number, CultureInfo.InvariantCulture, out double t)
+ && double.TryParse(thickness[1], NumberStyles.Number, CultureInfo.InvariantCulture, out h)
+ && double.TryParse(thickness[2], NumberStyles.Number, CultureInfo.InvariantCulture, out double b))
+ return new Thickness(h, t, h, b);
+ break;
+ case 4:
+ if ( double.TryParse(thickness[0], NumberStyles.Number, CultureInfo.InvariantCulture, out t)
+ && double.TryParse(thickness[1], NumberStyles.Number, CultureInfo.InvariantCulture, out double r)
+ && double.TryParse(thickness[2], NumberStyles.Number, CultureInfo.InvariantCulture, out b)
+ && double.TryParse(thickness[3], NumberStyles.Number, CultureInfo.InvariantCulture, out double l))
+ return new Thickness(l, t, r, b);
+ break;
+ }
+ }
+ else { //single uniform thickness
+ if (double.TryParse(value, NumberStyles.Number, CultureInfo.InvariantCulture, out double l))
+ return new Thickness(l);
+ }
+ }
+
+ throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(Thickness)}");
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+// using ElmSharp;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net.Http;
+using System.Reflection;
+using System.Security.Cryptography;
+using System.Threading;
+using System.Threading.Tasks;
+using Tizen.NUI.XamlBinding.Internals;
+// using TAppControl = Tizen.Applications.AppControl;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal class TizenPlatformServices : IPlatformServices
+ {
+ static MD5 checksum = MD5.Create();
+
+ static SynchronizationContext s_context;
+
+ public TizenPlatformServices()
+ {
+ s_context = SynchronizationContext.Current;
+ }
+
+ public class TizenTicker : Ticker
+ {
+ readonly System.Threading.Timer _timer;
+
+ public TizenTicker()
+ {
+ _timer = new System.Threading.Timer((object o) => HandleElapsed(o), this, Timeout.Infinite, Timeout.Infinite);
+ }
+
+ protected override void EnableTimer()
+ {
+ _timer.Change(16, 16);
+ }
+
+ protected override void DisableTimer()
+ {
+ _timer.Change(-1, -1);
+ }
+
+ void HandleElapsed(object state)
+ {
+ s_context.Post((o) => SendSignals(-1), null);
+ }
+ }
+ #region IPlatformServices implementation
+
+ // public double GetNamedSize(NamedSize size, Type targetElementType, bool useOldSizes)
+ // {
+ // int pt;
+ // // Actual font size depends on the target idiom.
+ // switch (size)
+ // {
+ // case NamedSize.Micro:
+ // pt = Device.Idiom == TargetIdiom.TV || Device.Idiom == TargetIdiom.Watch ? 24 : 19;
+ // break;
+ // case NamedSize.Small:
+ // pt = Device.Idiom == TargetIdiom.TV ? 26 : (Device.Idiom == TargetIdiom.Watch ? 30 : 22);
+ // break;
+ // case NamedSize.Default:
+ // case NamedSize.Medium:
+ // pt = Device.Idiom == TargetIdiom.TV ? 28 : (Device.Idiom == TargetIdiom.Watch ? 32 : 25);
+ // break;
+ // case NamedSize.Large:
+ // pt = Device.Idiom == TargetIdiom.TV ? 84 : (Device.Idiom == TargetIdiom.Watch ? 36 : 31);
+ // break;
+ // default:
+ // throw new ArgumentOutOfRangeException();
+ // }
+ // return Forms.ConvertToDPFont(pt);
+ // }
+
+ // public void OpenUriAction(Uri uri)
+ // {
+ // if (uri == null || uri.AbsoluteUri == null)
+ // {
+ // throw new ArgumentNullException(nameof(uri));
+ // }
+ // TAppControl tAppControl = new TAppControl() { Operation = "%", Uri = uri.AbsoluteUri };
+ // var matchedApplications = TAppControl.GetMatchedApplicationIds(tAppControl);
+ // if (matchedApplications.Count() > 0)
+ // {
+ // TAppControl.SendLaunchRequest(tAppControl);
+ // return;
+ // }
+ // throw new PlatformNotSupportedException();
+ // }
+
+ public void BeginInvokeOnMainThread(Action action)
+ {
+ s_context.Post((o) => action(), null);
+ }
+
+ public Ticker CreateTicker()
+ {
+ return new TizenTicker();
+ }
+
+ public void StartTimer(TimeSpan interval, Func<bool> callback)
+ {
+ Console.WriteLine("TizenPlatformServices StartTimer ...");
+ System.Threading.Timer timer = null;
+ bool invoking = false;
+ TimerCallback onTimeout = o =>
+ {
+ if (!invoking)
+ {
+ invoking = true;
+ BeginInvokeOnMainThread(() =>
+ {
+ if (!callback())
+ {
+ timer.Dispose();
+ }
+ invoking = false;
+ }
+ );
+ }
+ };
+ timer = new System.Threading.Timer(onTimeout, null, Timeout.Infinite, Timeout.Infinite);
+ // set interval separarately to prevent calling onTimeout before `timer' is assigned
+ timer.Change(interval, interval);
+ }
+
+ public async Task<Stream> GetStreamAsync(Uri uri, CancellationToken cancellationToken)
+ {
+ using (var client = new HttpClient())
+ using (HttpResponseMessage response = await client.GetAsync(uri, cancellationToken))
+ return await response.Content.ReadAsStreamAsync();
+ }
+
+ public Assembly[] GetAssemblies()
+ {
+ return AppDomain.CurrentDomain.GetAssemblies();
+ }
+
+ // public IIsolatedStorageFile GetUserStoreForApplication()
+ // {
+ // return new TizenIsolatedStorageFile();
+ // }
+
+ static readonly char[] HexDigits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
+ public string GetMD5Hash(string input)
+ {
+ byte[] bin = checksum.ComputeHash(System.Text.Encoding.UTF8.GetBytes(input));
+ char[] hex = new char[32];
+ for (var i = 0; i < 16; ++i)
+ {
+ hex[2 * i] = HexDigits[bin[i] >> 4];
+ hex[2 * i + 1] = HexDigits[bin[i] & 0xf];
+ }
+ return new string(hex);
+ }
+
+ public void QuitApplication()
+ {
+ // Forms.Context.Exit();
+ Console.WriteLine("!!!!!!!!!!!! Exit !!!!!!!!!!!!!!");
+ }
+
+ public bool IsInvokeRequired
+ {
+ get
+ {
+ // return !EcoreMainloop.IsMainThread;
+ return true;
+ }
+ }
+
+ public string RuntimePlatform => Device.Tizen;
+
+ #endregion
+
+ // In .NETCore, AppDomain is not supported. The list of the assemblies should be generated manually.
+ internal class AppDomain
+ {
+ public static AppDomain CurrentDomain { get; private set; }
+
+ List<Assembly> _assemblies;
+
+ public static bool IsTizenSpecificAvailable { get; private set; }
+
+ static AppDomain()
+ {
+ CurrentDomain = new AppDomain();
+ }
+
+ AppDomain()
+ {
+ _assemblies = new List<Assembly>();
+
+ // Add this renderer assembly to the list
+ _assemblies.Add(GetType().GetTypeInfo().Assembly);
+ }
+
+ internal void RegisterAssemblyRecursively(Assembly asm)
+ {
+ if (_assemblies.Contains(asm))
+ return;
+
+ _assemblies.Add(asm);
+
+ foreach (var refName in asm.GetReferencedAssemblies())
+ {
+ if (!refName.Name.StartsWith("System.") && !refName.Name.StartsWith("Microsoft.") && !refName.Name.StartsWith("mscorlib"))
+ {
+ try
+ {
+ Assembly refAsm = Assembly.Load(refName);
+ if (refAsm != null)
+ {
+ RegisterAssemblyRecursively(refAsm);
+ if (refName.Name == "Tizen.NUI.Xaml.Forms")
+ {
+ if (refAsm.GetType("Tizen.NUI.Xaml.PlatformConfiguration.TizenSpecific.VisualElement") != null)
+ {
+ IsTizenSpecificAvailable = true;
+ }
+ }
+ }
+ }
+ catch
+ {
+ Log.Warn("Reference Assembly can not be loaded. {0}", refName.FullName);
+ }
+ }
+ }
+ }
+
+ public Assembly[] GetAssemblies()
+ {
+ return _assemblies.ToArray();
+ }
+ }
+ }
+}
+
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal class ToolbarItem : MenuItem
+ {
+ static readonly BindableProperty OrderProperty = BindableProperty.Create("Order", typeof(ToolbarItemOrder), typeof(ToolbarItem), ToolbarItemOrder.Default, validateValue: (bo, o) =>
+ {
+ var order = (ToolbarItemOrder)o;
+ return order == ToolbarItemOrder.Default || order == ToolbarItemOrder.Primary || order == ToolbarItemOrder.Secondary;
+ });
+
+ static readonly BindableProperty PriorityProperty = BindableProperty.Create("Priority", typeof(int), typeof(ToolbarItem), 0);
+
+ public ToolbarItem()
+ {
+ }
+
+ public ToolbarItem(string name, string icon, Action activated, ToolbarItemOrder order = ToolbarItemOrder.Default, int priority = 0)
+ {
+ if (activated == null)
+ throw new ArgumentNullException("activated");
+
+ Text = name;
+ Icon = icon;
+ Clicked += (s, e) => activated();
+ Order = order;
+ Priority = priority;
+ }
+
+ [Obsolete("Name is obsolete as of version 1.3.0. Please use Text instead.")]
+ public string Name
+ {
+ get { return Text; }
+ set { Text = value; }
+ }
+
+ public ToolbarItemOrder Order
+ {
+ get { return (ToolbarItemOrder)GetValue(OrderProperty); }
+ set { SetValue(OrderProperty, value); }
+ }
+
+ public int Priority
+ {
+ get { return (int)GetValue(PriorityProperty); }
+ set { SetValue(PriorityProperty, value); }
+ }
+
+ [Obsolete("Activated is obsolete as of version 1.3.0. Please use Clicked instead.")]
+ public event EventHandler Activated
+ {
+ add { Clicked += value; }
+ remove { Clicked -= value; }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal class ToolbarItemEventArgs : EventArgs
+ {
+ public ToolbarItemEventArgs(ToolbarItem item)
+ {
+ ToolbarItem = item;
+ }
+
+ public ToolbarItem ToolbarItem { get; private set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+namespace Tizen.NUI.XamlBinding
+{
+ internal enum ToolbarItemOrder
+ {
+ Default,
+ Primary,
+ Secondary
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.ObjectModel;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal class TrackableCollection<T> : ObservableCollection<T>
+ {
+ public event EventHandler Clearing;
+
+ protected override void ClearItems()
+ {
+ Clearing?.Invoke(this, EventArgs.Empty);
+ base.ClearItems();
+ }
+ }
+}
--- /dev/null
+//
+// System.ComponentModel.TypeConverterAttribute
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+// (C) 2003 Andreas Nahr
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Tizen.NUI.XamlBinding
+{
+ [AttributeUsage(AttributeTargets.All)]
+ internal sealed class TypeConverterAttribute : Attribute
+ {
+ internal static string[] TypeConvertersType = { "Tizen.NUI.XamlBinding.TypeConverterAttribute", "System.ComponentModel.TypeConverterAttribute" };
+
+ public static readonly TypeConverterAttribute Default = new TypeConverterAttribute();
+
+ public TypeConverterAttribute()
+ {
+ ConverterTypeName = "";
+ }
+
+ public TypeConverterAttribute(string typeName)
+ {
+ ConverterTypeName = typeName;
+ }
+
+ public TypeConverterAttribute(Type type)
+ {
+ ConverterTypeName = type.AssemblyQualifiedName;
+ }
+
+ public string ConverterTypeName { get; }
+
+ public override bool Equals(object obj)
+ {
+ if (!(obj is TypeConverterAttribute))
+ return false;
+
+ return ((TypeConverterAttribute)obj).ConverterTypeName == ConverterTypeName;
+ }
+
+ public override int GetHashCode()
+ {
+ return ConverterTypeName.GetHashCode();
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using static System.String;
+
+namespace Tizen.NUI.XamlBinding
+{
+ internal class WeakEventManager
+ {
+ readonly Dictionary<string, List<Subscription>> _eventHandlers =
+ new Dictionary<string, List<Subscription>>();
+
+ public void AddEventHandler<TEventArgs>(string eventName, EventHandler<TEventArgs> handler)
+ where TEventArgs : EventArgs
+ {
+ if (IsNullOrEmpty(eventName))
+ {
+ throw new ArgumentNullException(nameof(eventName));
+ }
+
+ if (handler == null)
+ {
+ throw new ArgumentNullException(nameof(handler));
+ }
+
+ AddEventHandler(eventName, handler.Target, handler.GetMethodInfo());
+ }
+
+ public void AddEventHandler(string eventName, EventHandler handler)
+ {
+ if (IsNullOrEmpty(eventName))
+ {
+ throw new ArgumentNullException(nameof(eventName));
+ }
+
+ if (handler == null)
+ {
+ throw new ArgumentNullException(nameof(handler));
+ }
+
+ AddEventHandler(eventName, handler.Target, handler.GetMethodInfo());
+ }
+
+ public void HandleEvent(object sender, object args, string eventName)
+ {
+ var toRaise = new List<Tuple<object, MethodInfo>>();
+ var toRemove = new List<Subscription>();
+
+ List<Subscription> target;
+ if (_eventHandlers.TryGetValue(eventName, out target))
+ {
+ foreach (Subscription subscription in target)
+ {
+ bool isStatic = subscription.Subscriber == null;
+ if (isStatic)
+ {
+ // For a static method, we'll just pass null as the first parameter of MethodInfo.Invoke
+ toRaise.Add(Tuple.Create<object, MethodInfo>(null, subscription.Handler));
+ continue;
+ }
+
+ object subscriber = subscription.Subscriber.Target;
+
+ if (subscriber == null)
+ {
+ // The subscriber was collected, so there's no need to keep this subscription around
+ toRemove.Add(subscription);
+ }
+ else
+ {
+ toRaise.Add(Tuple.Create(subscriber, subscription.Handler));
+ }
+ }
+
+ foreach (Subscription subscription in toRemove)
+ {
+ target.Remove(subscription);
+ }
+ }
+
+ foreach (Tuple<object, MethodInfo> tuple in toRaise)
+ {
+ tuple.Item2.Invoke(tuple.Item1, new[] { sender, args });
+ }
+ }
+
+ public void RemoveEventHandler<TEventArgs>(string eventName, EventHandler<TEventArgs> handler)
+ where TEventArgs : EventArgs
+ {
+ if (IsNullOrEmpty(eventName))
+ {
+ throw new ArgumentNullException(nameof(eventName));
+ }
+
+ if (handler == null)
+ {
+ throw new ArgumentNullException(nameof(handler));
+ }
+
+ RemoveEventHandler(eventName, handler.Target, handler.GetMethodInfo());
+ }
+
+ public void RemoveEventHandler(string eventName, EventHandler handler)
+ {
+ if (IsNullOrEmpty(eventName))
+ {
+ throw new ArgumentNullException(nameof(eventName));
+ }
+
+ if (handler == null)
+ {
+ throw new ArgumentNullException(nameof(handler));
+ }
+
+ RemoveEventHandler(eventName, handler.Target, handler.GetMethodInfo());
+ }
+
+ void AddEventHandler(string eventName, object handlerTarget, MethodInfo methodInfo)
+ {
+ List<Subscription> targets;
+ if (!_eventHandlers.TryGetValue(eventName, out targets))
+ {
+ targets = new List<Subscription>();
+ _eventHandlers.Add(eventName, targets);
+ }
+
+ if (handlerTarget == null)
+ {
+ // This event handler is a static method
+ targets.Add(new Subscription(null, methodInfo));
+ return;
+ }
+
+ targets.Add(new Subscription(new WeakReference(handlerTarget), methodInfo));
+ }
+
+ void RemoveEventHandler(string eventName, object handlerTarget, MemberInfo methodInfo)
+ {
+ List<Subscription> subscriptions;
+ if (!_eventHandlers.TryGetValue(eventName, out subscriptions))
+ {
+ return;
+ }
+
+ for (int n = subscriptions.Count; n > 0; n--)
+ {
+ Subscription current = subscriptions[n - 1];
+
+ if (current.Subscriber != handlerTarget
+ || current.Handler.Name != methodInfo.Name)
+ {
+ continue;
+ }
+
+ subscriptions.Remove(current);
+ }
+ }
+
+ struct Subscription
+ {
+ public Subscription(WeakReference subscriber, MethodInfo handler)
+ {
+ if (handler == null)
+ {
+ throw new ArgumentNullException(nameof(handler));
+ }
+
+ Subscriber = subscriber;
+ Handler = handler;
+ }
+
+ public readonly WeakReference Subscriber;
+ public readonly MethodInfo Handler;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System.ComponentModel;
+using Tizen.NUI;
+using Tizen.NUI.XamlBinding;
+
+namespace Tizen.NUI.Xaml.Forms.BaseComponents
+{
+ internal class InternalCustomeView : Tizen.NUI.BaseComponents.CustomView
+ {
+ public InternalCustomeView(string typeName, CustomViewBehaviour behaviour) : base(typeName, behaviour)
+ {
+
+ }
+ /// <summary>
+ /// Requests a relayout, which means performing a size negotiation on this view, its parent, and children (and potentially whole scene).<br />
+ /// This method can also be called from a derived class every time it needs a different size.<br />
+ /// At the end of event processing, the relayout process starts and all controls which requested relayout will have their sizes (re)negotiated.<br />
+ /// It can be called multiple times; the size negotiation is still only performed once, i.e., there is no need to keep track of this in the calling side.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public new void RelayoutRequest()
+ {
+ base.RelayoutRequest();
+ }
+
+ /// <summary>
+ /// Provides the view implementation of GetHeightForWidth.
+ /// </summary>
+ /// <param name="width">The width to use.</param>
+ /// <returns>The height based on the width.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ public new float GetHeightForWidthBase(float width)
+ {
+ return base.GetHeightForWidthBase(width);
+ }
+
+ /// <summary>
+ /// Provides the view implementation of GetWidthForHeight.
+ /// </summary>
+ /// <param name="height">The height to use.</param>
+ /// <returns>The width based on the height.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ public new float GetWidthForHeightBase(float height)
+ {
+ return base.GetWidthForHeightBase(height);
+ }
+
+ /// <summary>
+ /// Calculates the size for a child using the base view object.
+ /// </summary>
+ /// <param name="child">The child view to calculate the size for.</param>
+ /// <param name="dimension">The dimension to calculate the size, for example, the width or the height.</param>
+ /// <returns>Return the calculated size for the given dimension. If more than one dimension is requested, just return the first one found.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ public float CalculateChildSizeBase(View child, DimensionType dimension)
+ {
+ return base.CalculateChildSizeBase(child.ViewInstance, dimension);
+ }
+
+ /// <summary>
+ /// Determines if this view is dependent on it's children for relayout from the base class.
+ /// </summary>
+ /// <param name="dimension">The dimension(s) to check for.</param>
+ /// <returns>Return if the view is dependent on it's children.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ public new bool RelayoutDependentOnChildrenBase(DimensionType dimension)
+ {
+ return base.RelayoutDependentOnChildrenBase(dimension);
+ }
+
+ /// <summary>
+ /// Determines if this view is dependent on it's children for relayout from the base class.
+ /// </summary>
+ /// <returns>Return if the view is dependent on it's children.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ public new bool RelayoutDependentOnChildrenBase()
+ {
+ return base.RelayoutDependentOnChildrenBase();
+ }
+
+ /// <summary>
+ /// Registers a visual by property index, linking a view to visual when required.<br />
+ /// In the case of the visual being a view or control deeming visual not required, then the visual should be an empty handle.<br />
+ /// No parenting is done during registration, this should be done by a derived class.<br />
+ /// </summary>
+ /// <param name="index">The property index of the visual used to reference visual.</param>
+ /// <param name="visual">The visual to register.</param>
+ /// <since_tizen> 6 </since_tizen>
+ public new void RegisterVisual(int index, VisualBase visual)
+ {
+ base.RegisterVisual(index, visual);
+ }
+
+ /// <summary>
+ /// Registers a visual by the property index, linking a view to visual when required.<br />
+ /// In the case of the visual being a view or control deeming visual not required, then the visual should be an empty handle.<br />
+ /// If enabled is false, then the visual is not set on the stage until enabled by the derived class.<br />
+ /// </summary>
+ /// <param name="index">The property index of the visual used to reference visual.</param>
+ /// <param name="visual">The visual to register.</param>
+ /// <param name="enabled">False if derived class wants to control when the visual is set on the stage.</param>
+ /// <since_tizen> 6 </since_tizen>
+ public new void RegisterVisual(int index, VisualBase visual, bool enabled)
+ {
+ base.RegisterVisual(index, visual, enabled);
+ }
+
+ /// <summary>
+ /// Erases the entry matching the given index from the list of registered visuals.
+ /// </summary>
+ /// <param name="index">The property index of the visual used to reference visual.</param>
+ /// <since_tizen> 6 </since_tizen>
+ public new void UnregisterVisual(int index)
+ {
+ base.UnregisterVisual(index);
+ }
+
+ /// <summary>
+ /// Retrieves the visual associated with the given property index.<br />
+ /// For managing the object lifecycle, do not store the returned visual as a member which increments its reference count.<br />
+ /// </summary>
+ /// <param name="index">The property index of the visual used to reference visual.</param>
+ /// <returns>The registered visual if exists, otherwise an empty handle.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ public new VisualBase GetVisual(int index)
+ {
+ return base.GetVisual(index);
+ }
+
+ /// <summary>
+ /// Sets the given visual to be displayed or not when parent staged.<br />
+ /// For managing the object lifecycle, do not store the returned visual as a member which increments its reference count.<br />
+ /// </summary>
+ /// <param name="index">The property index of the visual, used to reference visual.</param>
+ /// <param name="enable">Flag set to enabled or disabled.</param>
+ /// <since_tizen> 6 </since_tizen>
+ public new void EnableVisual(int index, bool enable)
+ {
+ base.EnableVisual(index, enable);
+ }
+
+ /// <summary>
+ /// Queries if the given visual is to be displayed when parent staged.<br />
+ /// For managing the object lifecycle, do not store the returned visual as a member which increments its reference count.<br />
+ /// </summary>
+ /// <param name="index">The property index of the visual.</param>
+ /// <returns>Whether visual is enabled or not.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ public new bool IsVisualEnabled(int index)
+ {
+ return base.IsVisualEnabled(index);
+ }
+
+ /// <summary>
+ /// Creates a transition effect on the control.
+ /// </summary>
+ /// <param name="transitionData">The transition data describing the effect to create.</param>
+ /// <returns>A handle to an animation defined with the given effect, or an empty handle if no properties match.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ public new Animation CreateTransition(TransitionData transitionData)
+ {
+ return base.CreateTransition(transitionData);
+ }
+
+ /// <summary>
+ /// Emits the KeyInputFocusGained signal if true, else, emits the KeyInputFocusLost signal.<br />
+ /// Should be called last by the control after it acts on the input focus change.<br />
+ /// </summary>
+ /// <param name="focusGained">True if gained, false if lost.</param>
+ /// <since_tizen> 6 </since_tizen>
+ public new void EmitFocusSignal(bool focusGained)
+ {
+ base.EmitFocusSignal(focusGained);
+ }
+ }
+
+ /// <summary>
+ /// CustomView provides some common functionality required by all views.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class CustomView : View
+ {
+ private InternalCustomeView _customView;
+ internal InternalCustomeView customView
+ {
+ get
+ {
+ if (null == _customView)
+ {
+ _customView = handleInstance as InternalCustomeView;
+ }
+
+ return _customView;
+ }
+ }
+
+ /// <summary>
+ /// Creates a new instance of a Xaml CustomView.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public CustomView(string typeName, CustomViewBehaviour behaviour) : this(new Tizen.NUI.BaseComponents.CustomView(typeName, behaviour))
+ {
+ }
+
+ internal CustomView(Tizen.NUI.BaseComponents.CustomView nuiInstance) : base(nuiInstance)
+ {
+ SetNUIInstance(nuiInstance);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty FocusNavigationSupportProperty = BindableProperty.Create("FocusNavigationSupport", typeof(bool), typeof(CustomView), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var customView = ((CustomView)bindable).customView;
+ customView.FocusNavigationSupport = (bool)newValue;
+ },
+ defaultValueCreator:(bindable) =>
+ {
+ var customView = ((CustomView)bindable).customView;
+ return customView.FocusNavigationSupport;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty FocusGroupProperty = BindableProperty.Create("FocusGroup", typeof(bool), typeof(CustomView), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var customView = ((CustomView)bindable).customView;
+ customView.FocusGroup = (bool)newValue;
+ },
+ defaultValueCreator:(bindable) =>
+ {
+ var customView = ((CustomView)bindable).customView;
+ return customView.FocusGroup;
+ });
+
+ /// <summary>
+ /// Sets the background with a property map.
+ /// </summary>
+ /// <param name="map">The background property map.</param>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetBackground(PropertyMap map)
+ {
+ customView.SetBackground(map);
+ }
+
+ /// <summary>
+ /// Allows deriving classes to enable any of the gesture detectors that are available.<br />
+ /// Gesture detection can be enabled one at a time or in a bitwise format.<br />
+ /// </summary>
+ /// <param name="type">The gesture type(s) to enable.</param>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void EnableGestureDetection(Gesture.GestureType type)
+ {
+ customView.EnableGestureDetection(type);
+ }
+
+ /// <summary>
+ /// Sets whether this control supports two dimensional keyboard navigation
+ /// (i.e., whether it knows how to handle the keyboard focus movement between its child views).<br />
+ /// The control doesn't support it by default.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool FocusNavigationSupport
+ {
+ get
+ {
+ return (bool)GetValue(FocusNavigationSupportProperty);
+ }
+ set
+ {
+ SetValue(FocusNavigationSupportProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Sets or gets whether this control is a focus group for keyboard navigation.
+ /// </summary>
+ /// <returns>True if this control is set as a focus group for keyboard navigation.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool FocusGroup
+ {
+ get
+ {
+ return (bool)GetValue(FocusGroupProperty);
+ }
+ set
+ {
+ SetValue(FocusGroupProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// This method is called after the control has been initialized.<br />
+ /// Derived classes should do any second phase initialization by overriding this method.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual void OnInitialize()
+ {
+ }
+
+ /// <summary>
+ /// Called after the view has been connected to the stage.<br />
+ /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
+ /// The root view is provided automatically by Tizen.NUI.Stage, and is always considered to be connected.<br />
+ /// When the parent of a set of views is connected to the stage, then all of the children will receive this callback.<br />
+ /// </summary>
+ /// <param name="depth">The depth in the hierarchy for the view.</param>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual void OnStageConnection(int depth)
+ {
+ }
+
+ /// <summary>
+ /// Called after the view has been disconnected from the stage.<br />
+ /// If a view is disconnected, it either has no parent, or is parented to a disconnected view.<br />
+ /// When the parent of a set of views is disconnected to the stage, then all of the children will receive this callback, starting with the leaf views.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual void OnStageDisconnection()
+ {
+ }
+
+ /// <summary>
+ /// Called after a child has been added to the owning view.
+ /// </summary>
+ /// <param name="view">The child which has been added.</param>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual void OnChildAdd(View view)
+ {
+ }
+
+ /// <summary>
+ /// Called after the owning view has attempted to remove a child( regardless of whether it succeeded or not ).
+ /// </summary>
+ /// <param name="view">The child being removed.</param>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual void OnChildRemove(View view)
+ {
+ }
+
+ /// <summary>
+ /// Called when the owning view property is set.
+ /// </summary>
+ /// <param name="index">The property index that was set.</param>
+ /// <param name="propertyValue">The value to set.</param>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual void OnPropertySet(int index, PropertyValue propertyValue)
+ {
+ }
+
+ /// <summary>
+ /// Called when the owning view's size is set, for example, using View.SetSize().
+ /// </summary>
+ /// <param name="targetSize">The target size.</param>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual void OnSizeSet(Vector3 targetSize)
+ {
+ }
+
+ /// <summary>
+ /// Called when the owning view's size is animated, for example, using Animation::AnimateTo( Property ( view, View::Property::SIZE ), ... ).
+ /// </summary>
+ /// <param name="animation">The object which is animating the owning view.</param>
+ /// <param name="targetSize">The target size.</param>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual void OnSizeAnimation(Animation animation, Vector3 targetSize)
+ {
+ }
+
+ /// <summary>
+ /// Called after a touch event is received by the owning view.<br />
+ /// CustomViewBehaviour.REQUIRES_TOUCH_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).<br />
+ /// </summary>
+ /// <param name="touch">The touch event.</param>
+ /// <returns>True if the event should be consumed.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual bool OnTouch(Touch touch)
+ {
+ return false; // Do not consume
+ }
+
+ /// <summary>
+ /// Called after a hover event is received by the owning view.<br />
+ /// CustomViewBehaviour.REQUIRES_HOVER_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).<br />
+ /// </summary>
+ /// <param name="hover">The hover event.</param>
+ /// <returns>True if the hover event should be consumed.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual bool OnHover(Hover hover)
+ {
+ return false; // Do not consume
+ }
+
+ /// <summary>
+ /// Called after a key event is received by the view that has had its focus set.
+ /// </summary>
+ /// <param name="key">The key event.</param>
+ /// <returns>True if the key event should be consumed.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual bool OnKey(Key key)
+ {
+ return false; // Do not consume
+ }
+
+ /// <summary>
+ /// Called after a wheel event is received by the owning view.<br />
+ /// CustomViewBehaviour.REQUIRES_WHEEL_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).<br />
+ /// </summary>
+ /// <param name="wheel">The wheel event.</param>
+ /// <returns>True if the wheel event should be consumed.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual bool OnWheel(Wheel wheel)
+ {
+ return false; // Do not consume
+ }
+
+ /// <summary>
+ /// Called after the size negotiation has been finished for this control.<br />
+ /// The control is expected to assign this given size to itself or its children.<br />
+ /// Should be overridden by derived classes if they need to layout views differently after certain operations like add or remove views, resize, or after changing specific properties.<br />
+ /// As this function is called from inside the size negotiation algorithm, you cannot call RequestRelayout (the call would just be ignored).<br />
+ /// </summary>
+ /// <param name="size">The allocated size.</param>
+ /// <param name="container">The control should add views to this container that it is not able to allocate a size for.</param>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual void OnRelayout(Vector2 size, RelayoutContainer container)
+ {
+ }
+
+ /// <summary>
+ /// Notification for deriving classes.
+ /// </summary>
+ /// <param name="policy">The policy being set.</param>
+ /// <param name="dimension">The policy is being set for.</param>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual void OnSetResizePolicy(ResizePolicyType policy, DimensionType dimension)
+ {
+ }
+
+ /// <summary>
+ /// Returns the natural size of the view.
+ /// </summary>
+ /// <returns>The view's natural size</returns>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual Size2D GetNaturalSize()
+ {
+ return new Size2D(0, 0);
+ }
+
+ /// <summary>
+ /// Calculates the size for a child.
+ /// </summary>
+ /// <param name="child">The child view to calculate the size for.</param>
+ /// <param name="dimension">The dimension to calculate the size, for example, the width or the height.</param>
+ /// <returns>Return the calculated size for the given dimension. If more than one dimension is requested, just return the first one found.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual float CalculateChildSize(View child, DimensionType dimension)
+ {
+ return customView.CalculateChildSize(child.view, dimension);
+ }
+
+ /// <summary>
+ /// This method is called during size negotiation when a height is required for a given width.<br />
+ /// Derived classes should override this if they wish to customize the height returned.<br />
+ /// </summary>
+ /// <param name="width">Width to use</param>
+ /// <returns>The height based on the width</returns>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new virtual float GetHeightForWidth(float width)
+ {
+ return customView.GetHeightForWidth(width);
+ }
+
+ /// <summary>
+ /// This method is called during size negotiation when a width is required for a given height.<br />
+ /// Derived classes should override this if they wish to customize the width returned.<br />
+ /// </summary>
+ /// <param name="height">Height to use</param>
+ /// <returns>The width based on the width</returns>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new virtual float GetWidthForHeight(float height)
+ {
+ return customView.GetWidthForHeight(height);
+ }
+
+ /// <summary>
+ /// Determines if this view is dependent on it's children for relayout.
+ /// </summary>
+ /// <param name="dimension">The dimension(s) to check for.</param>
+ /// <returns>Return if the view is dependent on it's children.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual bool RelayoutDependentOnChildren(DimensionType dimension)
+ {
+ return customView.RelayoutDependentOnChildren(dimension);
+ }
+
+ /// <summary>
+ /// Determines if this view is dependent on it's children for relayout from the base class.
+ /// </summary>
+ /// <returns>Return true if the view is dependent on it's children.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual bool RelayoutDependentOnChildren()
+ {
+ return customView.RelayoutDependentOnChildren();
+ }
+
+ /// <summary>
+ /// The virtual method to notify deriving classes that relayout dependencies have been
+ /// met and the size for this object is about to be calculated for the given dimension.
+ /// </summary>
+ /// <param name="dimension">The dimension that is about to be calculated.</param>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual void OnCalculateRelayoutSize(DimensionType dimension)
+ {
+ }
+
+ /// <summary>
+ /// The virtual method to notify deriving classes that the size for a dimension has just been negotiated.
+ /// </summary>
+ /// <param name="size">The new size for the given dimension.</param>
+ /// <param name="dimension">The dimension that was just negotiated.</param>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual void OnLayoutNegotiated(float size, DimensionType dimension)
+ {
+ }
+
+ /// <summary>
+ /// This method should be overridden by deriving classes requiring notifications when the style changes.
+ /// </summary>
+ /// <param name="styleManager">The StyleManager object.</param>
+ /// <param name="change">Information denoting what has changed.</param>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual void OnStyleChange(StyleManager styleManager, StyleChangeType change)
+ {
+ }
+
+ /// <summary>
+ /// Called when the control gain key input focus. Should be overridden by derived classes if they need to customize what happens when the focus is gained.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual void OnFocusGained()
+ {
+ }
+
+ /// <summary>
+ /// Called when the control loses key input focus. Should be overridden by derived classes if they need to customize what happens when the focus is lost.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual void OnFocusLost()
+ {
+ }
+
+ /// <summary>
+ /// Gets the next keyboard focusable view in this control towards the given direction.<br />
+ /// A control needs to override this function in order to support two dimensional keyboard navigation.<br />
+ /// </summary>
+ /// <param name="currentFocusedView">The current focused view.</param>
+ /// <param name="direction">The direction to move the focus towards.</param>
+ /// <param name="loopEnabled">Whether the focus movement should be looped within the control.</param>
+ /// <returns>The next keyboard focusable view in this control or an empty handle if no view can be focused.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual View GetNextFocusableView(View currentFocusedView, Tizen.NUI.BaseComponents.View.FocusDirection direction, bool loopEnabled)
+ {
+ return new View();
+ }
+
+ /// <summary>
+ /// Informs this control that its chosen focusable view will be focused.<br />
+ /// This allows the application to preform any actions it wishes before the focus is actually moved to the chosen view.<br />
+ /// </summary>
+ /// <param name="commitedFocusableView">The commited focused view.</param>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual void OnFocusChangeCommitted(View commitedFocusableView)
+ {
+ }
+
+ /// <summary>
+ /// This method is called when the control has enter pressed on it.<br />
+ /// Derived classes should override this to perform custom actions.<br />
+ /// </summary>
+ /// <returns>True if this control supported this action.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual bool OnKeyboardEnter()
+ {
+ return false;
+ }
+
+ /// <summary>
+ /// Called whenever a pan gesture is detected on this control.<br />
+ /// This should be overridden by deriving classes when pan detection is enabled.<br />
+ /// There is no default behavior with panning.<br />
+ /// Pan detection should be enabled via EnableGestureDetection().<br />
+ /// </summary>
+ /// <param name="pan">The pan gesture.</param>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual void OnPan(PanGesture pan)
+ {
+ }
+
+ /// <summary>
+ /// Called whenever a tap gesture is detected on this control.<br />
+ /// This should be overridden by deriving classes when tap detection is enabled.<br />
+ /// There is no default behavior with a tap.<br />
+ /// Tap detection should be enabled via EnableGestureDetection().<br />
+ /// </summary>
+ /// <param name="tap">The tap gesture.</param>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual void OnTap(TapGesture tap)
+ {
+ }
+
+ /// <summary>
+ /// Requests a relayout, which means performing a size negotiation on this view, its parent, and children (and potentially whole scene).<br />
+ /// This method can also be called from a derived class every time it needs a different size.<br />
+ /// At the end of event processing, the relayout process starts and all controls which requested relayout will have their sizes (re)negotiated.<br />
+ /// It can be called multiple times; the size negotiation is still only performed once, i.e., there is no need to keep track of this in the calling side.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected void RelayoutRequest()
+ {
+ customView.RelayoutRequest();
+ }
+
+ /// <summary>
+ /// Provides the view implementation of GetHeightForWidth.
+ /// </summary>
+ /// <param name="width">The width to use.</param>
+ /// <returns>The height based on the width.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected float GetHeightForWidthBase(float width)
+ {
+ return customView.GetHeightForWidthBase(width);
+ }
+
+ /// <summary>
+ /// Provides the view implementation of GetWidthForHeight.
+ /// </summary>
+ /// <param name="height">The height to use.</param>
+ /// <returns>The width based on the height.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected float GetWidthForHeightBase(float height)
+ {
+ return customView.GetWidthForHeightBase(height);
+ }
+
+ /// <summary>
+ /// Calculates the size for a child using the base view object.
+ /// </summary>
+ /// <param name="child">The child view to calculate the size for.</param>
+ /// <param name="dimension">The dimension to calculate the size, for example, the width or the height.</param>
+ /// <returns>Return the calculated size for the given dimension. If more than one dimension is requested, just return the first one found.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected float CalculateChildSizeBase(View child, DimensionType dimension)
+ {
+ return customView.CalculateChildSizeBase(child, dimension);
+ }
+
+ /// <summary>
+ /// Determines if this view is dependent on it's children for relayout from the base class.
+ /// </summary>
+ /// <param name="dimension">The dimension(s) to check for.</param>
+ /// <returns>Return if the view is dependent on it's children.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected bool RelayoutDependentOnChildrenBase(DimensionType dimension)
+ {
+ return customView.RelayoutDependentOnChildrenBase(dimension);
+ }
+
+ /// <summary>
+ /// Determines if this view is dependent on it's children for relayout from the base class.
+ /// </summary>
+ /// <returns>Return if the view is dependent on it's children.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected bool RelayoutDependentOnChildrenBase()
+ {
+ return customView.RelayoutDependentOnChildrenBase();
+ }
+
+ /// <summary>
+ /// Registers a visual by property index, linking a view to visual when required.<br />
+ /// In the case of the visual being a view or control deeming visual not required, then the visual should be an empty handle.<br />
+ /// No parenting is done during registration, this should be done by a derived class.<br />
+ /// </summary>
+ /// <param name="index">The property index of the visual used to reference visual.</param>
+ /// <param name="visual">The visual to register.</param>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected void RegisterVisual(int index, VisualBase visual)
+ {
+ customView.RegisterVisual(index, visual);
+ }
+
+ /// <summary>
+ /// Registers a visual by the property index, linking a view to visual when required.<br />
+ /// In the case of the visual being a view or control deeming visual not required, then the visual should be an empty handle.<br />
+ /// If enabled is false, then the visual is not set on the stage until enabled by the derived class.<br />
+ /// </summary>
+ /// <param name="index">The property index of the visual used to reference visual.</param>
+ /// <param name="visual">The visual to register.</param>
+ /// <param name="enabled">False if derived class wants to control when the visual is set on the stage.</param>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected void RegisterVisual(int index, VisualBase visual, bool enabled)
+ {
+ customView.RegisterVisual(index, visual, enabled);
+ }
+
+ /// <summary>
+ /// Erases the entry matching the given index from the list of registered visuals.
+ /// </summary>
+ /// <param name="index">The property index of the visual used to reference visual.</param>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected void UnregisterVisual(int index)
+ {
+ customView.UnregisterVisual(index);
+ }
+
+ /// <summary>
+ /// Retrieves the visual associated with the given property index.<br />
+ /// For managing the object lifecycle, do not store the returned visual as a member which increments its reference count.<br />
+ /// </summary>
+ /// <param name="index">The property index of the visual used to reference visual.</param>
+ /// <returns>The registered visual if exists, otherwise an empty handle.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected VisualBase GetVisual(int index)
+ {
+ return customView.GetVisual(index);
+ }
+
+ /// <summary>
+ /// Sets the given visual to be displayed or not when parent staged.<br />
+ /// For managing the object lifecycle, do not store the returned visual as a member which increments its reference count.<br />
+ /// </summary>
+ /// <param name="index">The property index of the visual, used to reference visual.</param>
+ /// <param name="enable">Flag set to enabled or disabled.</param>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected void EnableVisual(int index, bool enable)
+ {
+ customView.EnableVisual(index, enable);
+ }
+
+ /// <summary>
+ /// Queries if the given visual is to be displayed when parent staged.<br />
+ /// For managing the object lifecycle, do not store the returned visual as a member which increments its reference count.<br />
+ /// </summary>
+ /// <param name="index">The property index of the visual.</param>
+ /// <returns>Whether visual is enabled or not.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected bool IsVisualEnabled(int index)
+ {
+ return customView.IsVisualEnabled(index);
+ }
+
+ /// <summary>
+ /// Creates a transition effect on the control.
+ /// </summary>
+ /// <param name="transitionData">The transition data describing the effect to create.</param>
+ /// <returns>A handle to an animation defined with the given effect, or an empty handle if no properties match.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected Animation CreateTransition(TransitionData transitionData)
+ {
+ return customView.CreateTransition(transitionData);
+ }
+
+ /// <summary>
+ /// Emits the KeyInputFocusGained signal if true, else, emits the KeyInputFocusLost signal.<br />
+ /// Should be called last by the control after it acts on the input focus change.<br />
+ /// </summary>
+ /// <param name="focusGained">True if gained, false if lost.</param>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected void EmitFocusSignal(bool focusGained)
+ {
+ customView.EmitFocusSignal(focusGained);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright(c) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System;
+using System.ComponentModel;
+using Tizen.NUI.XamlBinding;
+using static Tizen.NUI.BaseComponents.FlexContainer;
+
+namespace Tizen.NUI.Xaml.Forms.BaseComponents
+{
+ /// <summary>
+ /// FlexContainer implements a subset of the flexbox spec (defined by W3C):https://www.w3.org/TR/css3-flexbox/<br />
+ /// It aims at providing a more efficient way to layout, align, and distribute space among items in the container, even when their size is unknown or dynamic.<br />
+ /// FlexContainer has the ability to alter the width and the height of its children (i.e., flex items) to fill the available space in the best possible way on different screen sizes.<br />
+ /// FlexContainer can expand items to fill available free space, or shrink them to prevent overflow.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class FlexContainer : View
+ {
+ private Tizen.NUI.BaseComponents.FlexContainer _flexContainer;
+ internal Tizen.NUI.BaseComponents.FlexContainer flexContainer
+ {
+ get
+ {
+ if (null == _flexContainer)
+ {
+ _flexContainer = handleInstance as Tizen.NUI.BaseComponents.FlexContainer;
+ }
+
+ return _flexContainer;
+ }
+ }
+
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public FlexContainer() : this(new Tizen.NUI.BaseComponents.FlexContainer())
+ {
+ }
+
+ internal FlexContainer(Tizen.NUI.BaseComponents.FlexContainer nuiInstance) : base(nuiInstance)
+ {
+ SetNUIInstance(nuiInstance);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ContentDirectionProperty = BindableProperty.Create("ContentDirection", typeof(ContentDirectionType), typeof(FlexContainer), ContentDirectionType.Inherit, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var flexContainer = ((FlexContainer)bindable).flexContainer;
+ flexContainer.ContentDirection = (ContentDirectionType)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var flexContainer = ((FlexContainer)bindable).flexContainer;
+ return flexContainer.ContentDirection;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty FlexDirectionProperty = BindableProperty.Create("FlexDirection", typeof(FlexDirectionType), typeof(FlexContainer), FlexDirectionType.Column, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var flexContainer = ((FlexContainer)bindable).flexContainer;
+ flexContainer.FlexDirection = (FlexDirectionType)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var flexContainer = ((FlexContainer)bindable).flexContainer;
+ return flexContainer.FlexDirection;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty FlexWrapProperty = BindableProperty.Create("FlexWrap", typeof(WrapType), typeof(FlexContainer), WrapType.NoWrap, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var flexContainer = ((FlexContainer)bindable).flexContainer;
+ flexContainer.FlexWrap = (WrapType)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var flexContainer = ((FlexContainer)bindable).flexContainer;
+ return flexContainer.FlexWrap;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty JustifyContentProperty = BindableProperty.Create("JustifyContent", typeof(Justification), typeof(FlexContainer), Justification.JustifyFlexStart, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var flexContainer = ((FlexContainer)bindable).flexContainer;
+ flexContainer.JustifyContent = (Justification)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var flexContainer = ((FlexContainer)bindable).flexContainer;
+ return flexContainer.JustifyContent;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty AlignItemsProperty = BindableProperty.Create("AlignItems", typeof(Tizen.NUI.BaseComponents.FlexContainer.Alignment), typeof(FlexContainer), Tizen.NUI.BaseComponents.FlexContainer.Alignment.AlignAuto, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var flexContainer = ((FlexContainer)bindable).flexContainer;
+ flexContainer.AlignItems = (Tizen.NUI.BaseComponents.FlexContainer.Alignment)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var flexContainer = ((FlexContainer)bindable).flexContainer;
+ return flexContainer.AlignItems;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty AlignContentProperty = BindableProperty.Create("AlignContent", typeof(Tizen.NUI.BaseComponents.FlexContainer.Alignment), typeof(FlexContainer), Tizen.NUI.BaseComponents.FlexContainer.Alignment.AlignAuto, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var flexContainer = ((FlexContainer)bindable).flexContainer;
+ flexContainer.AlignContent = (Tizen.NUI.BaseComponents.FlexContainer.Alignment)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var flexContainer = ((FlexContainer)bindable).flexContainer;
+ return flexContainer.AlignContent;
+ });
+
+ /// <summary>
+ /// The primary direction in which content is ordered.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ContentDirectionType ContentDirection
+ {
+ get
+ {
+ return (ContentDirectionType)GetValue(ContentDirectionProperty);
+ }
+ set
+ {
+ SetValue(ContentDirectionProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The direction of the main axis which determines the direction that flex items are laid out.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public FlexDirectionType FlexDirection
+ {
+ get
+ {
+ return (FlexDirectionType)GetValue(FlexDirectionProperty);
+ }
+ set
+ {
+ SetValue(FlexDirectionProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Whether the flex items should wrap or not if there is no enough room for them on one flex line.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public WrapType FlexWrap
+ {
+ get
+ {
+ return (WrapType)GetValue(FlexWrapProperty);
+ }
+ set
+ {
+ SetValue(FlexWrapProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The alignment of flex items when the items do not use all available space on the main axis.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Justification JustifyContent
+ {
+ get
+ {
+ return (Justification)GetValue(JustifyContentProperty);
+ }
+ set
+ {
+ SetValue(JustifyContentProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The alignment of flex items when the items do not use all available space on the cross axis.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Tizen.NUI.BaseComponents.FlexContainer.Alignment AlignItems
+ {
+ get
+ {
+ return (Tizen.NUI.BaseComponents.FlexContainer.Alignment)GetValue(AlignItemsProperty);
+ }
+ set
+ {
+ SetValue(AlignItemsProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Similar to "alignItems", but it aligns flex lines; so only works when there are multiple lines.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Tizen.NUI.BaseComponents.FlexContainer.Alignment AlignContent
+ {
+ get
+ {
+ return (Tizen.NUI.BaseComponents.FlexContainer.Alignment)GetValue(AlignContentProperty);
+ }
+ set
+ {
+ SetValue(AlignContentProperty, value);
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System;
+using System.Runtime.InteropServices;
+using System.ComponentModel;
+using Tizen.NUI.XamlBinding;
+using Tizen.NUI;
+using static Tizen.NUI.BaseComponents.ImageView;
+
+namespace Tizen.NUI.Xaml.Forms.BaseComponents
+{
+ /// <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> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class ImageView : View
+ {
+ private Tizen.NUI.BaseComponents.ImageView _imageView;
+ private Tizen.NUI.BaseComponents.ImageView imageView
+ {
+ get
+ {
+ if (_imageView == null)
+ {
+ _imageView = handleInstance as Tizen.NUI.BaseComponents.ImageView;
+ }
+
+ return _imageView;
+ }
+ }
+
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ImageView() : this(new Tizen.NUI.BaseComponents.ImageView())
+ {
+ }
+
+ internal ImageView(Tizen.NUI.BaseComponents.ImageView nuiInstance) : base(nuiInstance)
+ {
+ SetNUIInstance(nuiInstance);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ResourceUrlProperty = BindableProperty.Create(nameof(Tizen.NUI.BaseComponents.ImageView.ResourceUrl), typeof(string), typeof(ImageView), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var imageView = (ImageView)bindable;
+
+ string url = (string)newValue;
+ if (url.Contains("*Resource*"))
+ {
+ string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
+ url = url.Replace("*Resource*", resource);
+ }
+
+ imageView.imageView.ResourceUrl = url;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var imageView = (ImageView)bindable;
+ return imageView.imageView.ResourceUrl;
+ });
+ /// This will be public opened in tizen_5.5 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) =>
+ {
+ var imageView = (ImageView)bindable;
+
+ PropertyMap map = (PropertyMap)newValue;
+ string url = "", alphaMaskURL = "", auxiliaryImageURL = "";
+ string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
+ PropertyValue urlValue = map.Find(ImageVisualProperty.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(ImageVisualProperty.URL, new PropertyValue(url));
+ }
+
+ ret = false;
+ PropertyValue alphaMaskUrlValue = map.Find(ImageVisualProperty.AlphaMaskURL);
+ if (alphaMaskUrlValue != null) ret = alphaMaskUrlValue.Get(out alphaMaskURL);
+ if (ret && alphaMaskURL.Contains("*Resource*"))
+ {
+ alphaMaskURL = alphaMaskURL.Replace("*Resource*", resource);
+ mmap.Insert(ImageVisualProperty.AlphaMaskURL, new PropertyValue(alphaMaskURL));
+ }
+
+ ret = false;
+ PropertyValue auxiliaryImageURLValue = map.Find(ImageVisualProperty.AuxiliaryImageURL);
+ if (auxiliaryImageURLValue != null) ret = auxiliaryImageURLValue.Get(out auxiliaryImageURL);
+ if (ret && auxiliaryImageURL.Contains("*Resource*"))
+ {
+ auxiliaryImageURL = auxiliaryImageURL.Replace("*Resource*", resource);
+ mmap.Insert(ImageVisualProperty.AuxiliaryImageURL, new PropertyValue(auxiliaryImageURL));
+ }
+
+ map.Merge(mmap);
+
+ imageView.imageView.Image = (PropertyMap)map;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var imageView = (ImageView)bindable;
+ return imageView.imageView.Image;
+ });
+ /// This will be public opened in tizen_5.5 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) =>
+ {
+ var imageView = (ImageView)bindable;
+ imageView.imageView.PreMultipliedAlpha = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var imageView = (ImageView)bindable;
+ return imageView.imageView.PreMultipliedAlpha;
+ });
+ /// This will be public opened in tizen_5.5 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;
+ imageView.imageView.PixelArea = (RelativeVector4)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var imageView = (ImageView)bindable;
+ return imageView.imageView.PixelArea;
+ });
+ /// This will be public opened in tizen_5.5 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;
+ imageView.imageView.Border = (Rectangle)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var imageView = (ImageView)bindable;
+ return imageView.imageView.Border;
+ });
+ /// This will be public opened in tizen_5.5 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;
+ imageView.imageView.BorderOnly = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var imageView = (ImageView)bindable;
+ return imageView.imageView.BorderOnly;
+ });
+ /// This will be public opened in tizen_5.5 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;
+ imageView.imageView.SynchronosLoading = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var imageView = (ImageView)bindable;
+ return imageView.imageView.SynchronosLoading;
+ });
+ /// This will be public opened in tizen_5.5 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;
+ imageView.imageView.OrientationCorrection = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var imageView = (ImageView)bindable;
+ return imageView.imageView.OrientationCorrection;
+ });
+
+ /// <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> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler<ResourceReadyEventArgs> ResourceReady
+ {
+ add
+ {
+ imageView.ResourceReady += value;
+ }
+
+ remove
+ {
+ imageView.ResourceReady -= value;
+ }
+ }
+
+ /// <summary>
+ /// ImageView ResourceUrl, type string.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string ResourceUrl
+ {
+ get
+ {
+ return (string)GetValue(ResourceUrlProperty);
+ }
+ set
+ {
+ SetValue(ResourceUrlProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// This will be deprecated, please use Image instead. <br />
+ /// ImageView ImageMap, type PropertyMap: string if it is a URL, map otherwise.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [Obsolete("Please do not use! This will be deprecated! Please use Image property instead!")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap ImageMap
+ {
+ get
+ {
+ return imageView.ImageMap;
+ }
+ set
+ {
+ imageView.ImageMap = value;
+ }
+ }
+
+ /// <summary>
+ /// ImageView Image, type PropertyMap
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap Image
+ {
+ get
+ {
+ return (PropertyMap)GetValue(ImageProperty);
+ }
+ set
+ {
+ SetValue(ImageProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// ImageView PreMultipliedAlpha, type Boolean.<br />
+ /// Image must be initialized.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool PreMultipliedAlpha
+ {
+ get
+ {
+ return (bool)GetValue(PreMultipliedAlphaProperty);
+ }
+ set
+ {
+ SetValue(PreMultipliedAlphaProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// ImageView PixelArea, type Vector4 (Animatable property).<br />
+ /// Pixel area is a relative value with the whole image area as [0.0, 0.0, 1.0, 1.0].<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public RelativeVector4 PixelArea
+ {
+ get
+ {
+ return (RelativeVector4)GetValue(PixelAreaProperty);
+ }
+ set
+ {
+ SetValue(PixelAreaProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The border of the image in the order: left, right, bottom, top.<br />
+ /// If set, ImageMap will be ignored.<br />
+ /// For N-Patch images only.<br />
+ /// Optional.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Rectangle Border
+ {
+ get
+ {
+ return (Rectangle)GetValue(BorderProperty);
+ }
+ set
+ {
+ SetValue(BorderProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets whether to draw the borders only (if true).<br />
+ /// If not specified, the default is false.<br />
+ /// For N-Patch images only.<br />
+ /// Optional.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool BorderOnly
+ {
+ get
+ {
+ return (bool)GetValue(BorderOnlyProperty);
+ }
+ set
+ {
+ SetValue(BorderOnlyProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets whether to synchronos loading the resourceurl of image.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool SynchronosLoading
+ {
+ get
+ {
+ return (bool)GetValue(SynchronosLoadingProperty);
+ }
+ set
+ {
+ SetValue(SynchronosLoadingProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets whether to automatically correct the orientation of an image.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool OrientationCorrection
+ {
+ get
+ {
+ return (bool)GetValue(OrientationCorrectionProperty);
+ }
+ set
+ {
+ SetValue(OrientationCorrectionProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets the loading state of the visual resource.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public LoadingStatusType LoadingStatus
+ {
+ get
+ {
+ return imageView.LoadingStatus;
+ }
+ }
+
+ /// <summary>
+ /// Downcasts a handle to imageView handle.
+ /// </summary>
+ /// Please do not use! this will be deprecated!
+ /// Instead please use as keyword.
+ /// <since_tizen> 6 </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)
+ {
+ Tizen.NUI.BaseComponents.ImageView result = Tizen.NUI.BaseComponents.ImageView.DownCast(handle.handleInstance) as Tizen.NUI.BaseComponents.ImageView;
+ return BaseHandle.GetHandle(result) as ImageView;
+ }
+
+ /// <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> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetImage(string url)
+ {
+ imageView.SetImage(url);
+ }
+
+ /// <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> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new bool IsResourceReady()
+ {
+ return imageView.IsResourceReady();
+ }
+
+ /// <summary>
+ /// Forcefully reloads the image. All the visuals using this image will reload to the latest image.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Reload()
+ {
+ imageView.Reload();
+ }
+
+ /// <summary>
+ /// Plays the animated GIF. This is also the default playback mode.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Play()
+ {
+ imageView.Play();
+ }
+
+ /// <summary>
+ /// Pauses the animated GIF.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Pause()
+ {
+ imageView.Pause();
+ }
+
+ /// <summary>
+ /// Stops the animated GIF.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Stop()
+ {
+ imageView.Stop();
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System.ComponentModel;
+using Tizen.NUI;
+using Tizen.NUI.XamlBinding;
+using static Tizen.NUI.BaseComponents.Scrollable;
+
+namespace Tizen.NUI.Xaml.Forms.BaseComponents
+{
+ /// <summary>
+ /// Base class for derived Scrollables that contains actors that can be scrolled manually
+ /// (via touch) or automatically.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class Scrollable : View
+ {
+ private Tizen.NUI.BaseComponents.Scrollable _scrollable;
+ internal Tizen.NUI.BaseComponents.Scrollable scrollable
+ {
+ get
+ {
+ if (null == _scrollable)
+ {
+ _scrollable = handleInstance as Tizen.NUI.BaseComponents.Scrollable;
+ }
+
+ return _scrollable;
+ }
+ }
+
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Scrollable() : this(new Tizen.NUI.BaseComponents.Scrollable())
+ {
+ }
+
+ internal Scrollable(Tizen.NUI.BaseComponents.Scrollable nuiInstance) : base(nuiInstance)
+ {
+ SetNUIInstance(nuiInstance);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty OvershootEffectColorProperty = BindableProperty.Create("OvershootEffectColor", typeof(Vector4), typeof(Scrollable), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollable = ((Scrollable)bindable).scrollable;
+ scrollable.OvershootEffectColor = (Vector4)newValue;
+ },
+ defaultValueCreator:(bindable) =>
+ {
+ var scrollable = ((Scrollable)bindable).scrollable;
+ return scrollable.OvershootEffectColor;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty OvershootAnimationSpeedProperty = BindableProperty.Create("OvershootAnimationSpeed", typeof(float), typeof(Scrollable), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollable = ((Scrollable)bindable).scrollable;
+ scrollable.OvershootAnimationSpeed = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollable = ((Scrollable)bindable).scrollable;
+ return scrollable.OvershootAnimationSpeed;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty OvershootEnabledProperty = BindableProperty.Create("OvershootEnabled", typeof(bool), typeof(Scrollable), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollable = ((Scrollable)bindable).scrollable;
+ scrollable.OvershootEnabled = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollable = ((Scrollable)bindable).scrollable;
+ return scrollable.OvershootEnabled;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty OvershootSizeProperty = BindableProperty.Create("OvershootSize", typeof(Vector2), typeof(Scrollable), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollable = ((Scrollable)bindable).scrollable;
+ scrollable.OvershootSize = (Vector2)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollable = ((Scrollable)bindable).scrollable;
+ return scrollable.OvershootSize;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ScrollToAlphaFunctionProperty = BindableProperty.Create("ScrollToAlphaFunction", typeof(int), typeof(Scrollable), default(int), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollable = ((Scrollable)bindable).scrollable;
+ scrollable.ScrollToAlphaFunction = (int)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollable = ((Scrollable)bindable).scrollable;
+ return scrollable.ScrollToAlphaFunction;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ScrollRelativePositionProperty = BindableProperty.Create("ScrollRelativePosition", typeof(Vector2), typeof(Scrollable), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollable = ((Scrollable)bindable).scrollable;
+ scrollable.ScrollRelativePosition = (Vector2)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollable = ((Scrollable)bindable).scrollable;
+ return scrollable.ScrollRelativePosition;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ScrollPositionMinProperty = BindableProperty.Create("ScrollPositionMin", typeof(Vector2), typeof(Scrollable), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollable = ((Scrollable)bindable).scrollable;
+ scrollable.ScrollPositionMin = (Vector2)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollable = ((Scrollable)bindable).scrollable;
+ return scrollable.ScrollPositionMin;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ScrollPositionMaxProperty = BindableProperty.Create("ScrollPositionMax", typeof(Vector2), typeof(Scrollable), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollable = ((Scrollable)bindable).scrollable;
+ scrollable.ScrollPositionMax = (Vector2)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollable = ((Scrollable)bindable).scrollable;
+ return scrollable.ScrollPositionMax;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty CanScrollVerticalProperty = BindableProperty.Create("CanScrollVertical", typeof(bool), typeof(Scrollable), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollable = ((Scrollable)bindable).scrollable;
+ scrollable.CanScrollVertical = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollable = ((Scrollable)bindable).scrollable;
+ return scrollable.CanScrollVertical;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty CanScrollHorizontalProperty = BindableProperty.Create("CanScrollHorizontal", typeof(bool), typeof(Scrollable), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollable = ((Scrollable)bindable).scrollable;
+ scrollable.CanScrollHorizontal = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollable = ((Scrollable)bindable).scrollable;
+ return scrollable.CanScrollHorizontal;
+ });
+
+ /// <summary>
+ /// The ScrollStarted event emitted when the Scrollable has moved (whether by touch or animation).
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event DaliEventHandler<object, StartedEventArgs> ScrollStarted
+ {
+ add
+ {
+ scrollable.ScrollStarted += value;
+ }
+
+ remove
+ {
+ scrollable.ScrollStarted -= value;
+ }
+ }
+
+ /// <summary>
+ /// The ScrollUpdated event emitted when the Scrollable has moved (whether by touch or animation).
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event DaliEventHandler<object, UpdatedEventArgs> ScrollUpdated
+ {
+ add
+ {
+ scrollable.ScrollUpdated += value;
+ }
+
+ remove
+ {
+ scrollable.ScrollUpdated -= value;
+ }
+ }
+
+ /// <summary>
+ /// The ScrollCompleted event emitted when the Scrollable has completed movement
+ /// (whether by touch or animation).
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event DaliEventHandler<object, CompletedEventArgs> ScrollCompleted
+ {
+ add
+ {
+ scrollable.ScrollCompleted += value;
+ }
+
+ remove
+ {
+ scrollable.ScrollCompleted -= value;
+ }
+ }
+
+ /// <summary>
+ /// Sets and Gets the color of the overshoot effect.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector4 OvershootEffectColor
+ {
+ get
+ {
+ return (Vector4)GetValue(OvershootEffectColorProperty);
+ }
+ set
+ {
+ SetValue(OvershootEffectColorProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Sets and Gets the speed of overshoot animation in pixels per second.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float OvershootAnimationSpeed
+ {
+ get
+ {
+ return (float)GetValue(OvershootAnimationSpeedProperty);
+ }
+ set
+ {
+ SetValue(OvershootAnimationSpeedProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Checks if scroll overshoot has been enabled or not.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool OvershootEnabled
+ {
+ get
+ {
+ return (bool)GetValue(OvershootEnabledProperty);
+ }
+ set
+ {
+ SetValue(OvershootEnabledProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets and Sets OvershootSize property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector2 OvershootSize
+ {
+ get
+ {
+ return (Vector2)GetValue(OvershootSizeProperty);
+ }
+ set
+ {
+ SetValue(OvershootSizeProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets and Sets ScrollToAlphaFunction property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int ScrollToAlphaFunction
+ {
+ get
+ {
+ return (int)GetValue(ScrollToAlphaFunctionProperty);
+ }
+ set
+ {
+ SetValue(ScrollToAlphaFunctionProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets and Sets ScrollRelativePosition property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector2 ScrollRelativePosition
+ {
+ get
+ {
+ return (Vector2)GetValue(ScrollRelativePositionProperty);
+ }
+ set
+ {
+ SetValue(ScrollRelativePositionProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets and Sets ScrollPositionMin property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector2 ScrollPositionMin
+ {
+ get
+ {
+ return (Vector2)GetValue(ScrollPositionMinProperty);
+ }
+ set
+ {
+ SetValue(ScrollPositionMinProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets and Sets ScrollPositionMax property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector2 ScrollPositionMax
+ {
+ get
+ {
+ return (Vector2)GetValue(ScrollPositionMaxProperty);
+ }
+ set
+ {
+ SetValue(ScrollPositionMaxProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets and Sets CanScrollVertical property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool CanScrollVertical
+ {
+ get
+ {
+ return (bool)GetValue(CanScrollVerticalProperty);
+ }
+ set
+ {
+ SetValue(CanScrollVerticalProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets and Sets CanScrollHorizontal property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool CanScrollHorizontal
+ {
+ get
+ {
+ return (bool)GetValue(CanScrollHorizontalProperty);
+ }
+ set
+ {
+ SetValue(CanScrollHorizontalProperty, value);
+
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright(c) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+using System.ComponentModel;
+using Tizen.NUI;
+using Tizen.NUI.XamlBinding;
+
+namespace Tizen.NUI.Xaml.Forms.BaseComponents
+{
+
+ /// <summary>
+ /// TableView is a layout container for aligning child actors in a grid like layout.<br />
+ /// TableView constraints the X and the Y position and the width and the height of the child actors.<br />
+ /// The Z position and depth are left intact so that the 3D model actors can also be laid out
+ /// in a grid without loosing their depth scaling.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class TableView : View
+ {
+ private Tizen.NUI.BaseComponents.TableView _tableView;
+ internal Tizen.NUI.BaseComponents.TableView tableView
+ {
+ get
+ {
+ if (null == _tableView)
+ {
+ _tableView = handleInstance as Tizen.NUI.BaseComponents.TableView;
+ }
+
+ return _tableView;
+ }
+ }
+
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public TableView() : this(new Tizen.NUI.BaseComponents.TableView())
+ {
+ }
+
+ internal TableView(Tizen.NUI.BaseComponents.TableView nuiInstance) : base(nuiInstance)
+ {
+ SetNUIInstance(nuiInstance);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty RowsProperty = BindableProperty.Create("Rows", typeof(int), typeof(TableView), default(int), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var tableView = ((TableView)bindable).tableView;
+ tableView.Rows = (int)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var tableView = ((TableView)bindable).tableView;
+ return tableView.Rows;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ColumnsProperty = BindableProperty.Create("Columns", typeof(int), typeof(TableView), default(int), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var tableView = ((TableView)bindable).tableView;
+ tableView.Columns = (int)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var tableView = ((TableView)bindable).tableView;
+ return tableView.Columns;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty CellPaddingProperty = BindableProperty.Create("CellPadding", typeof(Vector2), typeof(TableView), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var tableView = ((TableView)bindable).tableView;
+ tableView.CellPadding = (Vector2)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var tableView = ((TableView)bindable).tableView;
+ return tableView.CellPadding;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty LayoutRowsProperty = BindableProperty.Create("LayoutRows", typeof(PropertyMap), typeof(TableView), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var tableView = ((TableView)bindable).tableView;
+ tableView.LayoutRows = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var tableView = ((TableView)bindable).tableView;
+ return tableView.LayoutRows;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty LayoutColumnsProperty = BindableProperty.Create("LayoutColumns", typeof(PropertyMap), typeof(TableView), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var tableView = ((TableView)bindable).tableView;
+ tableView.LayoutColumns = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var tableView = ((TableView)bindable).tableView;
+ return tableView.LayoutColumns;
+ });
+
+ /// <summary>
+ /// Adds a child to the table.<br />
+ /// If the row or column index is outside the table, the table gets resized bigger.<br />
+ /// </summary>
+ /// <param name="child">The child to add.</param>
+ /// <param name="position">The position for the child.</param>
+ /// <returns>True if the addition succeeded, and false if the cell is already occupied.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool AddChild(View child, Tizen.NUI.BaseComponents.TableView.CellPosition position)
+ {
+ return tableView.AddChild(child.view, position);
+ }
+
+ /// <summary>
+ /// Returns a child from the given layout position.
+ /// </summary>
+ /// <param name="position">The position in the table.</param>
+ /// <returns>Child that was in the cell or an uninitialized handle.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public View GetChildAt(Tizen.NUI.BaseComponents.TableView.CellPosition position)
+ {
+ return BaseHandle.GetHandle(tableView.GetChildAt(position)) as View;
+ }
+
+ /// <summary>
+ /// Removes a child from the given layout position.
+ /// </summary>
+ /// <param name="position">The position for the child to remove.</param>
+ /// <returns>Child that was removed or an uninitialized handle.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public View RemoveChildAt(Tizen.NUI.BaseComponents.TableView.CellPosition position)
+ {
+ return BaseHandle.GetHandle(tableView.RemoveChildAt(position)) as View;
+ }
+
+ /// <summary>
+ /// Finds the child's layout position.
+ /// </summary>
+ /// <param name="child">The child to search for.</param>
+ /// <param name="position">The position for the child.</param>
+ /// <returns>True if the child was included in this TableView.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool FindChildPosition(View child, Tizen.NUI.BaseComponents.TableView.CellPosition position)
+ {
+ return tableView.FindChildPosition(child.view, position);
+ }
+
+ /// <summary>
+ /// Inserts a new row to the given index.
+ /// </summary>
+ /// <param name="rowIndex">The rowIndex of the new row.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void InsertRow(uint rowIndex)
+ {
+ tableView.InsertRow(rowIndex);
+ }
+
+ /// <summary>
+ /// Deletes a row from the given index.<br />
+ /// Removed elements are deleted.<br />
+ /// </summary>
+ /// <param name="rowIndex">The rowIndex of the row to delete.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void DeleteRow(uint rowIndex)
+ {
+ tableView.DeleteRow(rowIndex);
+ }
+
+ /// <summary>
+ /// Inserts a new column to the given index.
+ /// </summary>
+ /// <param name="columnIndex">The columnIndex of the new column.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void InsertColumn(uint columnIndex)
+ {
+ tableView.InsertColumn(columnIndex);
+ }
+
+ /// <summary>
+ /// Deletes a column from the given index.<br />
+ /// Removed elements are deleted.<br />
+ /// </summary>
+ /// <param name="columnIndex">The columnIndex of the column to delete.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void DeleteColumn(uint columnIndex)
+ {
+ tableView.DeleteColumn(columnIndex);
+ }
+
+ /// <summary>
+ /// Resizes the TableView.
+ /// </summary>
+ /// <param name="rows">The rows for the table.</param>
+ /// <param name="columns">The columns for the table.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Resize(uint rows, uint columns)
+ {
+ tableView.Resize(rows, columns);
+ }
+
+ /// <summary>
+ /// Sets the horizontal and the vertical padding between cells.
+ /// </summary>
+ /// <param name="padding">Width and height.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetCellPadding(Size2D padding)
+ {
+ tableView.SetCellPadding(padding);
+ }
+
+ /// <summary>
+ /// Gets the current padding as width and height.
+ /// </summary>
+ /// <returns>The current padding as width and height.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector2 GetCellPadding()
+ {
+ return tableView.GetCellPadding();
+ }
+
+ /// <summary>
+ /// Specifies this row as fitting its height to its children.
+ /// </summary>
+ /// <param name="rowIndex">The row to set.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetFitHeight(uint rowIndex)
+ {
+ tableView.SetFitHeight(rowIndex);
+ }
+
+ /// <summary>
+ /// Checks if the row is a fit row.
+ /// </summary>
+ /// <param name="rowIndex">The row to check.</param>
+ /// <returns>True if the row is fit.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool IsFitHeight(uint rowIndex)
+ {
+ return tableView.IsFitHeight(rowIndex);
+ }
+
+ /// <summary>
+ /// Specifies this column as fitting its width to its children.
+ /// </summary>
+ /// <param name="columnIndex">The column to set.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetFitWidth(uint columnIndex)
+ {
+ tableView.SetFitWidth(columnIndex);
+ }
+
+ /// <summary>
+ /// Checks if the column is a fit column.
+ /// </summary>
+ /// <param name="columnIndex">The column to check.</param>
+ /// <returns>True if the column is fit.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool IsFitWidth(uint columnIndex)
+ {
+ return tableView.IsFitWidth(columnIndex);
+ }
+
+ /// <summary>
+ /// Sets a row to have a fixed height.<br />
+ /// Setting a fixed height of 0 has no effect.<br />
+ /// </summary>
+ /// <param name="rowIndex">The rowIndex for row with a fixed height.</param>
+ /// <param name="height">The height in world coordinate units.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetFixedHeight(uint rowIndex, float height)
+ {
+ tableView.SetFixedHeight(rowIndex, height);
+ }
+
+ /// <summary>
+ /// Gets a row's fixed height.
+ /// </summary>
+ /// <param name="rowIndex">The row index with a fixed height.</param>
+ /// <returns>height The height in world coordinate units.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float GetFixedHeight(uint rowIndex)
+ {
+ return tableView.GetFixedHeight(rowIndex);
+ }
+
+ /// <summary>
+ /// Sets a row to have a relative height. Relative height means percentage of
+ /// the remainder of the table height after subtracting padding and fixed height rows.<br />
+ /// Setting a relative height of 0 has no effect.<br />
+ /// </summary>
+ /// <param name="rowIndex">The rowIndex for row with a relative height.</param>
+ /// <param name="heightPercentage">The height percentage between 0.0f and 1.0f.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetRelativeHeight(uint rowIndex, float heightPercentage)
+ {
+ tableView.SetRelativeHeight(rowIndex, heightPercentage);
+ }
+
+ /// <summary>
+ /// Gets a row's relative height.
+ /// </summary>
+ /// <param name="rowIndex">The row index with a relative height.</param>
+ /// <returns>Height in percentage units, between 0.0f and 1.0f.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float GetRelativeHeight(uint rowIndex)
+ {
+ return tableView.GetRelativeHeight(rowIndex);
+ }
+
+ /// <summary>
+ /// Sets a column to have a fixed width.<br />
+ /// Setting a fixed width of 0 has no effect.<br />
+ /// </summary>
+ /// <param name="columnIndex">The columnIndex for column with a fixed width.</param>
+ /// <param name="width">The width in world coordinate units.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetFixedWidth(uint columnIndex, float width)
+ {
+ tableView.SetFixedWidth(columnIndex, width);
+ }
+
+ /// <summary>
+ /// Gets a column's fixed width.
+ /// </summary>
+ /// <param name="columnIndex">The column index with a fixed width.</param>
+ /// <returns>Width in world coordinate units.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float GetFixedWidth(uint columnIndex)
+ {
+ return tableView.GetFixedWidth(columnIndex);
+ }
+
+ /// <summary>
+ /// Sets a column to have a relative width. Relative width means percentage of
+ /// the remainder of the table width after subtracting padding and fixed width columns.<br />
+ /// Setting a relative width of 0 has no effect.<br />
+ /// </summary>
+ /// <param name="columnIndex">The columnIndex for column with a fixed width.</param>
+ /// <param name="widthPercentage">The widthPercentage between 0.0f and 1.0f.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetRelativeWidth(uint columnIndex, float widthPercentage)
+ {
+ tableView.SetRelativeWidth(columnIndex, widthPercentage);
+ }
+
+ /// <summary>
+ /// Gets a column's relative width.
+ /// </summary>
+ /// <param name="columnIndex">The column index with a relative width.</param>
+ /// <returns>Width in percentage units, between 0.0f and 1.0f.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float GetRelativeWidth(uint columnIndex)
+ {
+ return tableView.GetRelativeWidth(columnIndex);
+ }
+
+ /// <summary>
+ /// Sets the alignment on a cell.<br />
+ /// Cells without calling this function have the default values of left and top respectively.<br />
+ /// </summary>
+ /// <param name="position">The cell to set alignment on.</param>
+ /// <param name="horizontal">The horizontal alignment.</param>
+ /// <param name="vertical">The vertical alignment.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetCellAlignment(Tizen.NUI.BaseComponents.TableView.CellPosition position, HorizontalAlignmentType horizontal, VerticalAlignmentType vertical)
+ {
+ tableView.SetCellAlignment(position, horizontal, vertical);
+ }
+
+ /// <summary>
+ /// The amount of rows in the table.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int Rows
+ {
+ get
+ {
+ return (int)GetValue(RowsProperty);
+ }
+ set
+ {
+ SetValue(RowsProperty, value);
+ }
+ }
+ /// <summary>
+ /// The amount of columns in the table.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int Columns
+ {
+ get
+ {
+ return (int)GetValue(ColumnsProperty);
+ }
+ set
+ {
+ SetValue(ColumnsProperty, value);
+ }
+ }
+ /// <summary>
+ /// Padding between cells.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector2 CellPadding
+ {
+ get
+ {
+ return (Vector2)GetValue(CellPaddingProperty);
+ }
+ set
+ {
+ SetValue(CellPaddingProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The number of layout rows.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap LayoutRows
+ {
+ get
+ {
+ return (PropertyMap)GetValue(LayoutRowsProperty);
+ }
+ set
+ {
+ SetValue(LayoutRowsProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The number of layout columns.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap LayoutColumns
+ {
+ get
+ {
+ return (PropertyMap)GetValue(LayoutColumnsProperty);
+ }
+ set
+ {
+ SetValue(LayoutColumnsProperty, value);
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+extern alias TizenSystemSettings;
+using TizenSystemSettings.Tizen.System;
+
+using System;
+using System.Runtime.InteropServices;
+using System.Globalization;
+using System.ComponentModel;
+using Tizen.NUI.XamlBinding;
+using static Tizen.NUI.BaseComponents.TextEditor;
+using Tizen.NUI;
+
+namespace Tizen.NUI.Xaml.Forms.BaseComponents
+{
+ /// <summary>
+ /// A control which provides a multi-line editable text editor.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class TextEditor : View
+ {
+ private Tizen.NUI.BaseComponents.TextEditor _textEditor;
+ internal Tizen.NUI.BaseComponents.TextEditor textEditor
+ {
+ get
+ {
+ if (null == _textEditor)
+ {
+ _textEditor = handleInstance as Tizen.NUI.BaseComponents.TextEditor;
+ }
+
+ return _textEditor;
+ }
+ }
+
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public TextEditor() : this(new Tizen.NUI.BaseComponents.TextEditor())
+ {
+ }
+
+ internal TextEditor(Tizen.NUI.BaseComponents.TextEditor nuiInstance) : base(nuiInstance)
+ {
+ SetNUIInstance(nuiInstance);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty TextProperty = BindableProperty.Create(nameof(Text), typeof(string), typeof(TextEditor), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.Text = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.Text;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty TextColorProperty = BindableProperty.Create(nameof(TextColor), typeof(Vector4), typeof(TextEditor), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.TextColor = (Vector4)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.TextColor;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty FontFamilyProperty = BindableProperty.Create(nameof(FontFamily), typeof(string), typeof(TextEditor), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.FontFamily = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.FontFamily;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty FontStyleProperty = BindableProperty.Create(nameof(FontStyle), typeof(PropertyMap), typeof(TextEditor), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.FontStyle = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.FontStyle;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty PointSizeProperty = BindableProperty.Create(nameof(PointSize), typeof(float), typeof(TextEditor), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.PointSize = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.PointSize;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty HorizontalAlignmentProperty = BindableProperty.Create(nameof(HorizontalAlignment), typeof(HorizontalAlignment), typeof(TextEditor), HorizontalAlignment.Begin, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.HorizontalAlignment = (HorizontalAlignment)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.HorizontalAlignment;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ScrollThresholdProperty = BindableProperty.Create(nameof(ScrollThreshold), typeof(float), typeof(TextEditor), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.ScrollThreshold = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.ScrollThreshold;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ScrollSpeedProperty = BindableProperty.Create(nameof(ScrollSpeed), typeof(float), typeof(TextEditor), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.ScrollSpeed = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.ScrollSpeed;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty PrimaryCursorColorProperty = BindableProperty.Create(nameof(PrimaryCursorColor), typeof(Vector4), typeof(TextEditor), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.PrimaryCursorColor = (Vector4)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.PrimaryCursorColor;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SecondaryCursorColorProperty = BindableProperty.Create(nameof(SecondaryCursorColor), typeof(Vector4), typeof(TextEditor), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.SecondaryCursorColor = (Vector4)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.SecondaryCursorColor;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty EnableCursorBlinkProperty = BindableProperty.Create(nameof(EnableCursorBlink), typeof(bool), typeof(TextEditor), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.EnableCursorBlink = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.EnableCursorBlink;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty CursorBlinkIntervalProperty = BindableProperty.Create(nameof(CursorBlinkInterval), typeof(float), typeof(TextEditor), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.CursorBlinkInterval = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.CursorBlinkInterval;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty CursorBlinkDurationProperty = BindableProperty.Create(nameof(CursorBlinkDuration), typeof(float), typeof(TextEditor), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.CursorBlinkDuration = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.CursorBlinkDuration;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty CursorWidthProperty = BindableProperty.Create(nameof(CursorWidth), typeof(int), typeof(TextEditor), default(int), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.CursorWidth = (int)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.CursorWidth;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty GrabHandleImageProperty = BindableProperty.Create(nameof(GrabHandleImage), typeof(string), typeof(TextEditor), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.GrabHandleImage = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.GrabHandleImage;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty GrabHandlePressedImageProperty = BindableProperty.Create(nameof(GrabHandlePressedImage), typeof(string), typeof(TextEditor), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.GrabHandlePressedImage = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.GrabHandlePressedImage;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SelectionHandleImageLeftProperty = BindableProperty.Create(nameof(SelectionHandleImageLeft), typeof(PropertyMap), typeof(TextEditor), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.SelectionHandleImageLeft = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.SelectionHandleImageLeft;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SelectionHandleImageRightProperty = BindableProperty.Create(nameof(SelectionHandleImageRight), typeof(PropertyMap), typeof(TextEditor), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.SelectionHandleImageRight = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.SelectionHandleImageRight;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SelectionHandlePressedImageLeftProperty = BindableProperty.Create(nameof(SelectionHandlePressedImageLeft), typeof(PropertyMap), typeof(TextEditor), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.SelectionHandlePressedImageLeft = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.SelectionHandlePressedImageLeft;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SelectionHandlePressedImageRightProperty = BindableProperty.Create(nameof(SelectionHandlePressedImageRight), typeof(PropertyMap), typeof(TextEditor), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.SelectionHandlePressedImageRight = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.SelectionHandlePressedImageRight;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SelectionHandleMarkerImageLeftProperty = BindableProperty.Create(nameof(SelectionHandleMarkerImageLeft), typeof(PropertyMap), typeof(TextEditor), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.SelectionHandleMarkerImageLeft = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.SelectionHandleMarkerImageLeft;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SelectionHandleMarkerImageRightProperty = BindableProperty.Create(nameof(SelectionHandleMarkerImageRight), typeof(PropertyMap), typeof(TextEditor), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.SelectionHandleMarkerImageRight = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.SelectionHandleMarkerImageRight;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SelectionHighlightColorProperty = BindableProperty.Create(nameof(SelectionHighlightColor), typeof(Vector4), typeof(TextEditor), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.SelectionHighlightColor = (Vector4)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.SelectionHighlightColor;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty DecorationBoundingBoxProperty = BindableProperty.Create(nameof(DecorationBoundingBox), typeof(Rectangle), typeof(TextEditor), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.DecorationBoundingBox = (Rectangle)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.DecorationBoundingBox;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty EnableMarkupProperty = BindableProperty.Create(nameof(EnableMarkup), typeof(bool), typeof(TextEditor), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.EnableMarkup = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.EnableMarkup;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty InputColorProperty = BindableProperty.Create(nameof(InputColor), typeof(Vector4), typeof(TextEditor), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.InputColor = (Vector4)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.InputColor;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty InputFontFamilyProperty = BindableProperty.Create(nameof(InputFontFamily), typeof(string), typeof(TextEditor), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.InputFontFamily = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.InputFontFamily;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty InputFontStyleProperty = BindableProperty.Create(nameof(InputFontStyle), typeof(PropertyMap), typeof(TextEditor), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.InputFontStyle = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.InputFontStyle;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty InputPointSizeProperty = BindableProperty.Create(nameof(InputPointSize), typeof(float), typeof(TextEditor), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.InputPointSize = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.InputPointSize;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty LineSpacingProperty = BindableProperty.Create(nameof(LineSpacing), typeof(float), typeof(TextEditor), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.LineSpacing = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.LineSpacing;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty InputLineSpacingProperty = BindableProperty.Create(nameof(InputLineSpacing), typeof(float), typeof(TextEditor), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.InputLineSpacing = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.InputLineSpacing;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty UnderlineProperty = BindableProperty.Create(nameof(Underline), typeof(PropertyMap), typeof(TextEditor), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.Underline = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.Underline;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty InputUnderlineProperty = BindableProperty.Create(nameof(InputUnderline), typeof(string), typeof(TextEditor), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.InputUnderline = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.InputUnderline;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ShadowProperty = BindableProperty.Create(nameof(Shadow), typeof(PropertyMap), typeof(TextEditor), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.Shadow = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.Shadow;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty InputShadowProperty = BindableProperty.Create(nameof(InputShadow), typeof(string), typeof(TextEditor), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.InputShadow = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.InputShadow;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty EmbossProperty = BindableProperty.Create(nameof(Emboss), typeof(string), typeof(TextEditor), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.Emboss = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.Emboss;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty InputEmbossProperty = BindableProperty.Create(nameof(InputEmboss), typeof(string), typeof(TextEditor), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.InputEmboss = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.InputEmboss;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty OutlineProperty = BindableProperty.Create(nameof(Outline), typeof(PropertyMap), typeof(TextEditor), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.Outline = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.Outline;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty InputOutlineProperty = BindableProperty.Create(nameof(InputOutline), typeof(string), typeof(TextEditor), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.InputOutline = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.InputOutline;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SmoothScrollProperty = BindableProperty.Create(nameof(SmoothScroll), typeof(bool), typeof(TextEditor), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.SmoothScroll = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.SmoothScroll;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SmoothScrollDurationProperty = BindableProperty.Create(nameof(SmoothScrollDuration), typeof(float), typeof(TextEditor), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.SmoothScrollDuration = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.SmoothScrollDuration;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty EnableScrollBarProperty = BindableProperty.Create(nameof(EnableScrollBar), typeof(bool), typeof(TextEditor), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.EnableScrollBar = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.EnableScrollBar;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ScrollBarShowDurationProperty = BindableProperty.Create(nameof(ScrollBarShowDuration), typeof(float), typeof(TextEditor), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.ScrollBarShowDuration = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.ScrollBarShowDuration;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ScrollBarFadeDurationProperty = BindableProperty.Create(nameof(ScrollBarFadeDuration), typeof(float), typeof(TextEditor), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.ScrollBarFadeDuration = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.ScrollBarFadeDuration;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty PixelSizeProperty = BindableProperty.Create(nameof(PixelSize), typeof(float), typeof(TextEditor), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.PixelSize = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.PixelSize;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty PlaceholderTextProperty = BindableProperty.Create(nameof(PlaceholderText), typeof(string), typeof(TextEditor), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.PlaceholderText = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.PlaceholderText;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty PlaceholderTextColorProperty = BindableProperty.Create(nameof(PlaceholderTextColor), typeof(Color), typeof(TextEditor), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.PlaceholderTextColor = (Color)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.PlaceholderTextColor;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty EnableSelectionProperty = BindableProperty.Create(nameof(EnableSelection), typeof(bool), typeof(TextEditor), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.EnableSelection = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.EnableSelection;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty PlaceholderProperty = BindableProperty.Create(nameof(Placeholder), typeof(PropertyMap), typeof(TextEditor), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.Placeholder = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.Placeholder;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty LineWrapModeProperty = BindableProperty.Create(nameof(LineWrapMode), typeof(LineWrapMode), typeof(TextEditor), LineWrapMode.Word, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.LineWrapMode = (LineWrapMode)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.LineWrapMode;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty EnableShiftSelectionProperty = BindableProperty.Create(nameof(TextEditor.EnableShiftSelection), typeof(bool), typeof(TextEditor), true, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.EnableShiftSelection = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.EnableShiftSelection;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty MatchSystemLanguageDirectionProperty = BindableProperty.Create(nameof(TextEditor.MatchSystemLanguageDirection), typeof(bool), typeof(TextEditor), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ textEditor.MatchSystemLanguageDirection = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textEditor = ((TextEditor)bindable).textEditor;
+ return textEditor.MatchSystemLanguageDirection;
+ });
+
+ /// <summary>
+ /// An event for the TextChanged signal which can be used to subscribe or unsubscribe the event handler
+ /// provided by the user. The TextChanged signal is emitted when the text changes.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler<TextChangedEventArgs> TextChanged
+ {
+ add
+ {
+ textEditor.TextChanged += value;
+ }
+ remove
+ {
+ textEditor.TextChanged -= value;
+ }
+ }
+
+ /// <summary>
+ /// Event for the ScrollStateChanged signal which can be used to subscribe or unsubscribe the event handler
+ /// provided by the user. The ScrollStateChanged signal is emitted when the scroll state changes.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler<ScrollStateChangedEventArgs> ScrollStateChanged
+ {
+ add
+ {
+ textEditor.ScrollStateChanged += value;
+ }
+ remove
+ {
+ textEditor.ScrollStateChanged -= value;
+ }
+ }
+
+ /// <summary>
+ /// Get the InputMethodContext instance.
+ /// </summary>
+ /// <returns>The InputMethodContext instance.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public InputMethodContext GetInputMethodContext()
+ {
+ return textEditor.GetInputMethodContext();
+ }
+
+ /// <summary>
+ /// The TranslatableText property.<br />
+ /// The text can set the SID value.<br />
+ /// </summary>
+ /// <exception cref='ArgumentNullException'>
+ /// ResourceManager about multilingual is null.
+ /// </exception>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string TranslatableText
+ {
+ get
+ {
+ return textEditor.TranslatableText;
+ }
+ set
+ {
+ textEditor.TranslatableText = value;
+ }
+ }
+
+ /// <summary>
+ /// The TranslatablePlaceholderText property.<br />
+ /// The text can set the SID value.<br />
+ /// </summary>
+ /// <exception cref='ArgumentNullException'>
+ /// ResourceManager about multilingual is null.
+ /// </exception>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string TranslatablePlaceholderText
+ {
+ get
+ {
+ return textEditor.TranslatablePlaceholderText;
+ }
+ set
+ {
+ textEditor.TranslatablePlaceholderText = value;
+ }
+ }
+
+ /// <summary>
+ /// The Text property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string Text
+ {
+ get
+ {
+ return (string)GetValue(TextProperty);
+ }
+ set
+ {
+ SetValue(TextProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The TextColor property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector4 TextColor
+ {
+ get
+ {
+ return (Vector4)GetValue(TextColorProperty);
+ }
+ set
+ {
+ SetValue(TextColorProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The FontFamily property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string FontFamily
+ {
+ get
+ {
+ return (string)GetValue(FontFamilyProperty);
+ }
+ set
+ {
+ SetValue(FontFamilyProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The FontStyle property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap FontStyle
+ {
+ get
+ {
+ return (PropertyMap)GetValue(FontStyleProperty);
+ }
+ set
+ {
+ SetValue(FontStyleProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The PointSize property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float PointSize
+ {
+ get
+ {
+ return (float)GetValue(PointSizeProperty);
+ }
+ set
+ {
+ SetValue(PointSizeProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The HorizontalAlignment property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public HorizontalAlignment HorizontalAlignment
+ {
+ get
+ {
+ return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
+ }
+ set
+ {
+ SetValue(HorizontalAlignmentProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The ScrollThreshold property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float ScrollThreshold
+ {
+ get
+ {
+ return (float)GetValue(ScrollThresholdProperty);
+ }
+ set
+ {
+ SetValue(ScrollThresholdProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The ScrollSpeed property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float ScrollSpeed
+ {
+ get
+ {
+ return (float)GetValue(ScrollSpeedProperty);
+ }
+ set
+ {
+ SetValue(ScrollSpeedProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The PrimaryCursorColor property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector4 PrimaryCursorColor
+ {
+ get
+ {
+ return (Vector4)GetValue(PrimaryCursorColorProperty);
+ }
+ set
+ {
+ SetValue(PrimaryCursorColorProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The SecondaryCursorColor property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector4 SecondaryCursorColor
+ {
+ get
+ {
+ return (Vector4)GetValue(SecondaryCursorColorProperty);
+ }
+ set
+ {
+ SetValue(SecondaryCursorColorProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The EnableCursorBlink property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool EnableCursorBlink
+ {
+ get
+ {
+ return (bool)GetValue(EnableCursorBlinkProperty);
+ }
+ set
+ {
+ SetValue(EnableCursorBlinkProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The CursorBlinkInterval property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float CursorBlinkInterval
+ {
+ get
+ {
+ return (float)GetValue(CursorBlinkIntervalProperty);
+ }
+ set
+ {
+ SetValue(CursorBlinkIntervalProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The CursorBlinkDuration property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float CursorBlinkDuration
+ {
+ get
+ {
+ return (float)GetValue(CursorBlinkDurationProperty);
+ }
+ set
+ {
+ SetValue(CursorBlinkDurationProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The CursorWidth property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int CursorWidth
+ {
+ get
+ {
+ return (int)GetValue(CursorWidthProperty);
+ }
+ set
+ {
+ SetValue(CursorWidthProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The GrabHandleImage property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string GrabHandleImage
+ {
+ get
+ {
+ return (string)GetValue(GrabHandleImageProperty);
+ }
+ set
+ {
+ SetValue(GrabHandleImageProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The GrabHandlePressedImage property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string GrabHandlePressedImage
+ {
+ get
+ {
+ return (string)GetValue(GrabHandlePressedImageProperty);
+ }
+ set
+ {
+ SetValue(GrabHandlePressedImageProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The SelectionHandleImageLeft property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap SelectionHandleImageLeft
+ {
+ get
+ {
+ return (PropertyMap)GetValue(SelectionHandleImageLeftProperty);
+ }
+ set
+ {
+ SetValue(SelectionHandleImageLeftProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The SelectionHandleImageRight property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap SelectionHandleImageRight
+ {
+ get
+ {
+ return (PropertyMap)GetValue(SelectionHandleImageRightProperty);
+ }
+ set
+ {
+ SetValue(SelectionHandleImageRightProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The SelectionHandlePressedImageLeft property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap SelectionHandlePressedImageLeft
+ {
+ get
+ {
+ return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty);
+ }
+ set
+ {
+ SetValue(SelectionHandlePressedImageLeftProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The SelectionHandlePressedImageRight property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap SelectionHandlePressedImageRight
+ {
+ get
+ {
+ return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty);
+ }
+ set
+ {
+ SetValue(SelectionHandlePressedImageRightProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The SelectionHandleMarkerImageLeft property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap SelectionHandleMarkerImageLeft
+ {
+ get
+ {
+ return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty);
+ }
+ set
+ {
+ SetValue(SelectionHandleMarkerImageLeftProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The SelectionHandleMarkerImageRight property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap SelectionHandleMarkerImageRight
+ {
+ get
+ {
+ return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty);
+ }
+ set
+ {
+ SetValue(SelectionHandleMarkerImageRightProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The SelectionHighlightColor property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector4 SelectionHighlightColor
+ {
+ get
+ {
+ return (Vector4)GetValue(SelectionHighlightColorProperty);
+ }
+ set
+ {
+ SetValue(SelectionHighlightColorProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The DecorationBoundingBox property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Rectangle DecorationBoundingBox
+ {
+ get
+ {
+ return (Rectangle)GetValue(DecorationBoundingBoxProperty);
+ }
+ set
+ {
+ SetValue(DecorationBoundingBoxProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The EnableMarkup property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool EnableMarkup
+ {
+ get
+ {
+ return (bool)GetValue(EnableMarkupProperty);
+ }
+ set
+ {
+ SetValue(EnableMarkupProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The InputColor property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector4 InputColor
+ {
+ get
+ {
+ return (Vector4)GetValue(InputColorProperty);
+ }
+ set
+ {
+ SetValue(InputColorProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The InputFontFamily property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string InputFontFamily
+ {
+ get
+ {
+ return (string)GetValue(InputFontFamilyProperty);
+ }
+ set
+ {
+ SetValue(InputFontFamilyProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The InputFontStyle property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap InputFontStyle
+ {
+ get
+ {
+ return (PropertyMap)GetValue(InputFontStyleProperty);
+ }
+ set
+ {
+ SetValue(InputFontStyleProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The InputPointSize property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float InputPointSize
+ {
+ get
+ {
+ return (float)GetValue(InputPointSizeProperty);
+ }
+ set
+ {
+ SetValue(InputPointSizeProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The LineSpacing property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float LineSpacing
+ {
+ get
+ {
+ return (float)GetValue(LineSpacingProperty);
+ }
+ set
+ {
+ SetValue(LineSpacingProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The InputLineSpacing property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float InputLineSpacing
+ {
+ get
+ {
+ return (float)GetValue(InputLineSpacingProperty);
+ }
+ set
+ {
+ SetValue(InputLineSpacingProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The Underline property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap Underline
+ {
+ get
+ {
+ return (PropertyMap)GetValue(UnderlineProperty);
+ }
+ set
+ {
+ SetValue(UnderlineProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The InputUnderline property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string InputUnderline
+ {
+ get
+ {
+ return (string)GetValue(InputUnderlineProperty);
+ }
+ set
+ {
+ SetValue(InputUnderlineProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The Shadow property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap Shadow
+ {
+ get
+ {
+ return (PropertyMap)GetValue(ShadowProperty);
+ }
+ set
+ {
+ SetValue(ShadowProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The InputShadow property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string InputShadow
+ {
+ get
+ {
+ return (string)GetValue(InputShadowProperty);
+ }
+ set
+ {
+ SetValue(InputShadowProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The Emboss property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string Emboss
+ {
+ get
+ {
+ return (string)GetValue(EmbossProperty);
+ }
+ set
+ {
+ SetValue(EmbossProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The InputEmboss property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string InputEmboss
+ {
+ get
+ {
+ return (string)GetValue(InputEmbossProperty);
+ }
+ set
+ {
+ SetValue(InputEmbossProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The Outline property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap Outline
+ {
+ get
+ {
+ return (PropertyMap)GetValue(OutlineProperty);
+ }
+ set
+ {
+ SetValue(OutlineProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The InputOutline property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string InputOutline
+ {
+ get
+ {
+ return (string)GetValue(InputOutlineProperty);
+ }
+ set
+ {
+ SetValue(InputOutlineProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The SmoothScroll property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool SmoothScroll
+ {
+ get
+ {
+ return (bool)GetValue(SmoothScrollProperty);
+ }
+ set
+ {
+ SetValue(SmoothScrollProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The SmoothScrollDuration property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float SmoothScrollDuration
+ {
+ get
+ {
+ return (float)GetValue(SmoothScrollDurationProperty);
+ }
+ set
+ {
+ SetValue(SmoothScrollDurationProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The EnableScrollBar property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool EnableScrollBar
+ {
+ get
+ {
+ return (bool)GetValue(EnableScrollBarProperty);
+ }
+ set
+ {
+ SetValue(EnableScrollBarProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The ScrollBarShowDuration property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float ScrollBarShowDuration
+ {
+ get
+ {
+ return (float)GetValue(ScrollBarShowDurationProperty);
+ }
+ set
+ {
+ SetValue(ScrollBarShowDurationProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The ScrollBarFadeDuration property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float ScrollBarFadeDuration
+ {
+ get
+ {
+ return (float)GetValue(ScrollBarFadeDurationProperty);
+ }
+ set
+ {
+ SetValue(ScrollBarFadeDurationProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The PixelSize property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float PixelSize
+ {
+ get
+ {
+ return (float)GetValue(PixelSizeProperty);
+ }
+ set
+ {
+ SetValue(PixelSizeProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The line count of the text.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int LineCount
+ {
+ get
+ {
+ return textEditor.LineCount;
+ }
+ }
+
+ /// <summary>
+ /// The text to display when the TextEditor is empty and inactive.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string PlaceholderText
+ {
+ get
+ {
+ return (string)GetValue(PlaceholderTextProperty);
+ }
+ set
+ {
+ SetValue(PlaceholderTextProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The Placeholder text color.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Color PlaceholderTextColor
+ {
+ get
+ {
+ return (Color)GetValue(PlaceholderTextColorProperty);
+ }
+ set
+ {
+ SetValue(PlaceholderTextColorProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The EnableSelection property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool EnableSelection
+ {
+ get
+ {
+ return (bool)GetValue(EnableSelectionProperty);
+ }
+ set
+ {
+ SetValue(EnableSelectionProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The Placeholder property.
+ /// Gets or sets the placeholder: text, color, font family, font style, point size, and pixel size.
+ /// </summary>
+ /// <example>
+ /// The following example demonstrates how to set the placeholder property.
+ /// <code>
+ /// PropertyMap propertyMap = new PropertyMap();
+ /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
+ /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
+ /// propertyMap.Add("color", new PropertyValue(Color.Red));
+ /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
+ /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
+ ///
+ /// PropertyMap fontStyleMap = new PropertyMap();
+ /// fontStyleMap.Add("weight", new PropertyValue("bold"));
+ /// fontStyleMap.Add("width", new PropertyValue("condensed"));
+ /// fontStyleMap.Add("slant", new PropertyValue("italic"));
+ /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
+ ///
+ /// TextEditor editor = new TextEditor();
+ /// editor.Placeholder = propertyMap;
+ /// </code>
+ /// </example>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap Placeholder
+ {
+ get
+ {
+ return (PropertyMap)GetValue(PlaceholderProperty);
+ }
+ set
+ {
+ SetValue(PlaceholderProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The LineWrapMode property.<br />
+ /// The line wrap mode when the text lines over the layout width.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public LineWrapMode LineWrapMode
+ {
+ get
+ {
+ return (LineWrapMode)GetValue(LineWrapModeProperty);
+ }
+ set
+ {
+ SetValue(LineWrapModeProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Enables Text selection using Shift key.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool EnableShiftSelection
+ {
+ get
+ {
+ return (bool)GetValue(EnableShiftSelectionProperty);
+ }
+ set
+ {
+ SetValue(EnableShiftSelectionProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The text alignment to match the direction of the system language.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool MatchSystemLanguageDirection
+ {
+ get
+ {
+ return (bool)GetValue(MatchSystemLanguageDirectionProperty);
+ }
+ set
+ {
+ SetValue(MatchSystemLanguageDirectionProperty, value);
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+extern alias TizenSystemSettings;
+using TizenSystemSettings.Tizen.System;
+
+using System;
+using System.Runtime.InteropServices;
+using System.Globalization;
+using System.ComponentModel;
+using Tizen.NUI.XamlBinding;
+using static Tizen.NUI.BaseComponents.TextField;
+using Tizen.NUI;
+
+namespace Tizen.NUI.Xaml.Forms.BaseComponents
+{
+ /// <summary>
+ /// A control which provides a single line editable text field.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class TextField : View
+ {
+ private Tizen.NUI.BaseComponents.TextField _textField;
+ internal Tizen.NUI.BaseComponents.TextField textField
+ {
+ get
+ {
+ if (null == _textField)
+ {
+ _textField = handleInstance as Tizen.NUI.BaseComponents.TextField;
+ }
+
+ return _textField;
+ }
+ }
+
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public TextField() : this(new Tizen.NUI.BaseComponents.TextField())
+ {
+ }
+
+ internal TextField(Tizen.NUI.BaseComponents.TextField nuiInstance) : base(nuiInstance)
+ {
+ SetNUIInstance(nuiInstance);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty TextProperty = BindableProperty.Create(nameof(Text), typeof(string), typeof(TextField), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.Text = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.Text;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty PlaceholderTextProperty = BindableProperty.Create(nameof(PlaceholderText), typeof(string), typeof(TextField), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.PlaceholderText = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.PlaceholderText;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty PlaceholderTextFocusedProperty = BindableProperty.Create(nameof(PlaceholderTextFocused), typeof(string), typeof(TextField), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.PlaceholderTextFocused = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.PlaceholderTextFocused;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty FontFamilyProperty = BindableProperty.Create(nameof(FontFamily), typeof(string), typeof(TextField), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.FontFamily = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.FontFamily;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty FontStyleProperty = BindableProperty.Create(nameof(FontStyle), typeof(PropertyMap), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.FontStyle = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.FontStyle;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty PointSizeProperty = BindableProperty.Create(nameof(PointSize), typeof(float), typeof(TextField), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.PointSize = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.PointSize;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty MaxLengthProperty = BindableProperty.Create(nameof(MaxLength), typeof(int), typeof(TextField), default(int), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.MaxLength = (int)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.MaxLength;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ExceedPolicyProperty = BindableProperty.Create(nameof(ExceedPolicy), typeof(int), typeof(TextField), default(int), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.ExceedPolicy = (int)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.ExceedPolicy;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty HorizontalAlignmentProperty = BindableProperty.Create(nameof(HorizontalAlignment), typeof(HorizontalAlignment), typeof(TextField), HorizontalAlignment.Begin, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.HorizontalAlignment = (HorizontalAlignment)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.HorizontalAlignment;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty VerticalAlignmentProperty = BindableProperty.Create(nameof(TextField.VerticalAlignment), typeof(VerticalAlignment), typeof(TextField), VerticalAlignment.Bottom, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.VerticalAlignment = (VerticalAlignment)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.VerticalAlignment;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty TextColorProperty = BindableProperty.Create(nameof(TextField.TextColor), typeof(Color), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.TextColor = (Color)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.TextColor;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty PlaceholderTextColorProperty = BindableProperty.Create(nameof(TextField.PlaceholderTextColor), typeof(Vector4), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.PlaceholderTextColor = (Vector4)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.PlaceholderTextColor;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty PrimaryCursorColorProperty = BindableProperty.Create("PrimaryCursorColor", typeof(Vector4), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.PrimaryCursorColor = (Vector4)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.PrimaryCursorColor;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SecondaryCursorColorProperty = BindableProperty.Create(nameof(TextField.SecondaryCursorColor), typeof(Vector4), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.SecondaryCursorColor = (Vector4)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.SecondaryCursorColor;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty EnableCursorBlinkProperty = BindableProperty.Create(nameof(TextField.EnableCursorBlink), typeof(bool), typeof(TextField), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.EnableCursorBlink = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.EnableCursorBlink;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty CursorBlinkIntervalProperty = BindableProperty.Create(nameof(TextField.CursorBlinkInterval), typeof(float), typeof(TextField), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.CursorBlinkInterval = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.CursorBlinkInterval;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty CursorBlinkDurationProperty = BindableProperty.Create(nameof(TextField.CursorBlinkDuration), typeof(float), typeof(TextField), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.CursorBlinkDuration = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.CursorBlinkDuration;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty CursorWidthProperty = BindableProperty.Create(nameof(TextField.CursorWidth), typeof(int), typeof(TextField), default(int), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.CursorWidth = (int)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.CursorWidth;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty GrabHandleImageProperty = BindableProperty.Create(nameof(TextField.GrabHandleImage), typeof(string), typeof(TextField), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.GrabHandleImage = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.GrabHandleImage;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty GrabHandlePressedImageProperty = BindableProperty.Create(nameof(TextField.GrabHandlePressedImage), typeof(string), typeof(TextField), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.GrabHandlePressedImage = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.GrabHandlePressedImage;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ScrollThresholdProperty = BindableProperty.Create(nameof(TextField.ScrollThreshold), typeof(float), typeof(TextField), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.ScrollThreshold = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.ScrollThreshold;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ScrollSpeedProperty = BindableProperty.Create(nameof(TextField.ScrollSpeed), typeof(float), typeof(TextField), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.ScrollSpeed = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.ScrollSpeed;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SelectionHandleImageLeftProperty = BindableProperty.Create(nameof(TextField.SelectionHandleImageLeft), typeof(PropertyMap), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.SelectionHandleImageLeft = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.SelectionHandleImageLeft;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SelectionHandleImageRightProperty = BindableProperty.Create(nameof(TextField.SelectionHandleImageLeft), typeof(PropertyMap), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.SelectionHandleImageLeft = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.SelectionHandleImageLeft;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SelectionHandlePressedImageLeftProperty = BindableProperty.Create(nameof(TextField.SelectionHandlePressedImageLeft), typeof(PropertyMap), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.SelectionHandlePressedImageLeft = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.SelectionHandlePressedImageLeft;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SelectionHandlePressedImageRightProperty = BindableProperty.Create(nameof(TextField.SelectionHandlePressedImageRight), typeof(PropertyMap), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.SelectionHandlePressedImageRight = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.SelectionHandlePressedImageRight;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SelectionHandleMarkerImageLeftProperty = BindableProperty.Create(nameof(TextField.SelectionHandleMarkerImageLeft), typeof(PropertyMap), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.SelectionHandleMarkerImageLeft = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.SelectionHandleMarkerImageLeft;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SelectionHandleMarkerImageRightProperty = BindableProperty.Create(nameof(TextField.SelectionHandleMarkerImageRight), typeof(PropertyMap), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.SelectionHandleMarkerImageRight = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.SelectionHandleMarkerImageRight;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SelectionHighlightColorProperty = BindableProperty.Create(nameof(TextField.SelectionHighlightColor), typeof(Vector4), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.SelectionHighlightColor = (Vector4)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.SelectionHighlightColor;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty DecorationBoundingBoxProperty = BindableProperty.Create(nameof(TextField.DecorationBoundingBox), typeof(Rectangle), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.DecorationBoundingBox = (Rectangle)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.DecorationBoundingBox;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty InputMethodSettingsProperty = BindableProperty.Create(nameof(TextField.InputMethodSettings), typeof(PropertyMap), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.InputMethodSettings = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.InputMethodSettings;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty InputColorProperty = BindableProperty.Create(nameof(TextField.InputColor), typeof(Vector4), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.InputColor = (Vector4)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.InputColor;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty EnableMarkupProperty = BindableProperty.Create(nameof(TextField.EnableMarkup), typeof(bool), typeof(TextField), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.EnableMarkup = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.EnableMarkup;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty InputFontFamilyProperty = BindableProperty.Create(nameof(TextField.InputFontFamily), typeof(string), typeof(TextField), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.InputFontFamily = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.InputFontFamily;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty InputFontStyleProperty = BindableProperty.Create(nameof(TextField.InputFontStyle), typeof(PropertyMap), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.InputFontStyle = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.InputFontStyle;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty InputPointSizeProperty = BindableProperty.Create(nameof(TextField.InputPointSize), typeof(float), typeof(TextField), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.InputPointSize = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.InputPointSize;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty UnderlineProperty = BindableProperty.Create(nameof(TextField.Underline), typeof(PropertyMap), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.Underline = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.Underline;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty InputUnderlineProperty = BindableProperty.Create(nameof(TextField.InputUnderline), typeof(string), typeof(TextField), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.InputUnderline = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.InputUnderline;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ShadowProperty = BindableProperty.Create(nameof(TextField.Shadow), typeof(PropertyMap), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.Shadow = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.Shadow;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty InputShadowProperty = BindableProperty.Create(nameof(TextField.InputShadow), typeof(string), typeof(TextField), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.InputShadow = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.InputShadow;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty EmbossProperty = BindableProperty.Create(nameof(TextField.Emboss), typeof(string), typeof(TextField), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.Emboss = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.Emboss;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty InputEmbossProperty = BindableProperty.Create(nameof(TextField.InputEmboss), typeof(string), typeof(TextField), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.InputEmboss = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.InputEmboss;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty OutlineProperty = BindableProperty.Create(nameof(TextField.Outline), typeof(PropertyMap), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.Outline = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.Outline;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty InputOutlineProperty = BindableProperty.Create(nameof(TextField.InputOutline), typeof(string), typeof(TextField), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.InputOutline = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.InputOutline;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty HiddenInputSettingsProperty = BindableProperty.Create(nameof(TextField.HiddenInputSettings), typeof(PropertyMap), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.HiddenInputSettings = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.HiddenInputSettings;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty PixelSizeProperty = BindableProperty.Create(nameof(TextField.PixelSize), typeof(float), typeof(TextField), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.PixelSize = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.PixelSize;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty EnableSelectionProperty = BindableProperty.Create(nameof(TextField.EnableSelection), typeof(bool), typeof(TextField), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.EnableSelection = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.EnableSelection;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty PlaceholderProperty = BindableProperty.Create(nameof(TextField.Placeholder), typeof(PropertyMap), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.Placeholder = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.Placeholder;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty EllipsisProperty = BindableProperty.Create(nameof(TextField.Ellipsis), typeof(bool), typeof(TextField), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.Ellipsis = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.Ellipsis;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty EnableShiftSelectionProperty = BindableProperty.Create(nameof(TextField.EnableShiftSelection), typeof(bool), typeof(TextField), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.EnableShiftSelection = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.EnableShiftSelection;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty MatchSystemLanguageDirectionProperty = BindableProperty.Create(nameof(TextField.MatchSystemLanguageDirection), typeof(bool), typeof(TextField), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ textField.MatchSystemLanguageDirection = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = ((TextField)bindable).textField;
+ return textField.MatchSystemLanguageDirection;
+ });
+
+ /// <summary>
+ /// The TextChanged event.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler<TextChangedEventArgs> TextChanged
+ {
+ add
+ {
+ textField.TextChanged += value;
+ }
+ remove
+ {
+ textField.TextChanged -= value;
+ }
+ }
+
+ /// <summary>
+ /// The MaxLengthReached event.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler<MaxLengthReachedEventArgs> MaxLengthReached
+ {
+ add
+ {
+ textField.MaxLengthReached += value;
+ }
+ remove
+ {
+ textField.MaxLengthReached -= value;
+ }
+ }
+
+ /// <summary>
+ /// Get the InputMethodContext instance.
+ /// </summary>
+ /// <returns>The InputMethodContext instance.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public InputMethodContext GetInputMethodContext()
+ {
+ return textField.GetInputMethodContext();
+ }
+
+ /// <summary>
+ /// The TranslatableText property.<br />
+ /// The text can set the SID value.<br />
+ /// </summary>
+ /// <exception cref='ArgumentNullException'>
+ /// ResourceManager about multilingual is null.
+ /// </exception>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string TranslatableText
+ {
+ get
+ {
+ return textField.TranslatableText;
+ }
+ set
+ {
+ textField.TranslatableText = value;
+ }
+ }
+ /// <summary>
+ /// The TranslatablePlaceholderText property.<br />
+ /// The text can set the SID value.<br />
+ /// </summary>
+ /// <exception cref='ArgumentNullException'>
+ /// ResourceManager about multilingual is null.
+ /// </exception>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string TranslatablePlaceholderText
+ {
+ get
+ {
+ return textField.TranslatablePlaceholderText;
+ }
+ set
+ {
+ textField.TranslatablePlaceholderText = value;
+ }
+ }
+
+ /// <summary>
+ /// The Text property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string Text
+ {
+ get
+ {
+ return (string)GetValue(TextProperty);
+ }
+ set
+ {
+ SetValue(TextProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The PlaceholderText property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string PlaceholderText
+ {
+ get
+ {
+ return (string)GetValue(PlaceholderTextProperty);
+ }
+ set
+ {
+ SetValue(PlaceholderTextProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The PlaceholderTextFocused property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string PlaceholderTextFocused
+ {
+ get
+ {
+ return (string)GetValue(PlaceholderTextFocusedProperty);
+ }
+ set
+ {
+ SetValue(PlaceholderTextFocusedProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The FontFamily property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string FontFamily
+ {
+ get
+ {
+ return (string)GetValue(FontFamilyProperty);
+ }
+ set
+ {
+ SetValue(FontFamilyProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The FontStyle property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap FontStyle
+ {
+ get
+ {
+ return (PropertyMap)GetValue(FontStyleProperty);
+ }
+ set
+ {
+ SetValue(FontStyleProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The PointSize property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float PointSize
+ {
+ get
+ {
+ return (float)GetValue(PointSizeProperty);
+ }
+ set
+ {
+ SetValue(PointSizeProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The MaxLength property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int MaxLength
+ {
+ get
+ {
+ return (int)GetValue(MaxLengthProperty);
+ }
+ set
+ {
+ SetValue(MaxLengthProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The ExceedPolicy property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int ExceedPolicy
+ {
+ get
+ {
+ return (int)GetValue(ExceedPolicyProperty);
+ }
+ set
+ {
+ SetValue(ExceedPolicyProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The HorizontalAlignment property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public HorizontalAlignment HorizontalAlignment
+ {
+ get
+ {
+ return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
+ }
+ set
+ {
+ SetValue(HorizontalAlignmentProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The VerticalAlignment property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public VerticalAlignment VerticalAlignment
+ {
+ get
+ {
+ return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
+ }
+ set
+ {
+ SetValue(VerticalAlignmentProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The TextColor property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Color TextColor
+ {
+ get
+ {
+ return (Color)GetValue(TextColorProperty);
+ }
+ set
+ {
+ SetValue(TextColorProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The PlaceholderTextColor property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector4 PlaceholderTextColor
+ {
+ get
+ {
+ return (Vector4)GetValue(PlaceholderTextColorProperty);
+ }
+ set
+ {
+ SetValue(PlaceholderTextColorProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The PrimaryCursorColor property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector4 PrimaryCursorColor
+ {
+ get
+ {
+ return (Vector4)GetValue(PrimaryCursorColorProperty);
+ }
+ set
+ {
+ SetValue(PrimaryCursorColorProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The SecondaryCursorColor property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector4 SecondaryCursorColor
+ {
+ get
+ {
+ return (Vector4)GetValue(SecondaryCursorColorProperty);
+ }
+ set
+ {
+ SetValue(SecondaryCursorColorProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The EnableCursorBlink property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool EnableCursorBlink
+ {
+ get
+ {
+ return (bool)GetValue(EnableCursorBlinkProperty);
+ }
+ set
+ {
+ SetValue(EnableCursorBlinkProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The CursorBlinkInterval property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float CursorBlinkInterval
+ {
+ get
+ {
+ return (float)GetValue(CursorBlinkIntervalProperty);
+ }
+ set
+ {
+ SetValue(CursorBlinkIntervalProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The CursorBlinkDuration property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float CursorBlinkDuration
+ {
+ get
+ {
+ return (float)GetValue(CursorBlinkDurationProperty);
+ }
+ set
+ {
+ SetValue(CursorBlinkDurationProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The CursorWidth property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int CursorWidth
+ {
+ get
+ {
+ return (int)GetValue(CursorWidthProperty);
+ }
+ set
+ {
+ SetValue(CursorWidthProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The GrabHandleImage property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string GrabHandleImage
+ {
+ get
+ {
+ return (string)GetValue(GrabHandleImageProperty);
+ }
+ set
+ {
+ SetValue(GrabHandleImageProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The GrabHandlePressedImage property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string GrabHandlePressedImage
+ {
+ get
+ {
+ return (string)GetValue(GrabHandlePressedImageProperty);
+ }
+ set
+ {
+ SetValue(GrabHandlePressedImageProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The ScrollThreshold property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float ScrollThreshold
+ {
+ get
+ {
+ return (float)GetValue(ScrollThresholdProperty);
+ }
+ set
+ {
+ SetValue(ScrollThresholdProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The ScrollSpeed property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float ScrollSpeed
+ {
+ get
+ {
+ return (float)GetValue(ScrollSpeedProperty);
+ }
+ set
+ {
+ SetValue(ScrollSpeedProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The SelectionHandleImageLeft property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap SelectionHandleImageLeft
+ {
+ get
+ {
+ return (PropertyMap)GetValue(SelectionHandleImageLeftProperty);
+ }
+ set
+ {
+ SetValue(SelectionHandleImageLeftProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The SelectionHandleImageRight property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap SelectionHandleImageRight
+ {
+ get
+ {
+ return (PropertyMap)GetValue(SelectionHandleImageRightProperty);
+ }
+ set
+ {
+ SetValue(SelectionHandleImageRightProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The SelectionHandlePressedImageLeft property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap SelectionHandlePressedImageLeft
+ {
+ get
+ {
+ return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty);
+ }
+ set
+ {
+ SetValue(SelectionHandlePressedImageLeftProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The SelectionHandlePressedImageRight property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap SelectionHandlePressedImageRight
+ {
+ get
+ {
+ return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty);
+ }
+ set
+ {
+ SetValue(SelectionHandlePressedImageRightProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The SelectionHandleMarkerImageLeft property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap SelectionHandleMarkerImageLeft
+ {
+ get
+ {
+ return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty);
+ }
+ set
+ {
+ SetValue(SelectionHandleMarkerImageLeftProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The SelectionHandleMarkerImageRight property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap SelectionHandleMarkerImageRight
+ {
+ get
+ {
+ return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty);
+ }
+ set
+ {
+ SetValue(SelectionHandleMarkerImageRightProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The SelectionHighlightColor property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector4 SelectionHighlightColor
+ {
+ get
+ {
+ return (Vector4)GetValue(SelectionHighlightColorProperty);
+ }
+ set
+ {
+ SetValue(SelectionHighlightColorProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The DecorationBoundingBox property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Rectangle DecorationBoundingBox
+ {
+ get
+ {
+ return (Rectangle)GetValue(DecorationBoundingBoxProperty);
+ }
+ set
+ {
+ SetValue(DecorationBoundingBoxProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The InputMethodSettings property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap InputMethodSettings
+ {
+ get
+ {
+ return (PropertyMap)GetValue(InputMethodSettingsProperty);
+ }
+ set
+ {
+ SetValue(InputMethodSettingsProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The InputColor property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector4 InputColor
+ {
+ get
+ {
+ return (Vector4)GetValue(InputColorProperty);
+ }
+ set
+ {
+ SetValue(InputColorProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The EnableMarkup property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool EnableMarkup
+ {
+ get
+ {
+ return (bool)GetValue(EnableMarkupProperty);
+ }
+ set
+ {
+ SetValue(EnableMarkupProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The InputFontFamily property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string InputFontFamily
+ {
+ get
+ {
+ return (string)GetValue(InputFontFamilyProperty);
+ }
+ set
+ {
+ SetValue(InputFontFamilyProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The InputFontStyle property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap InputFontStyle
+ {
+ get
+ {
+ return (PropertyMap)GetValue(InputFontStyleProperty);
+ }
+ set
+ {
+ SetValue(InputFontStyleProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The InputPointSize property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float InputPointSize
+ {
+ get
+ {
+ return (float)GetValue(InputPointSizeProperty);
+ }
+ set
+ {
+ SetValue(InputPointSizeProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The Underline property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap Underline
+ {
+ get
+ {
+ return (PropertyMap)GetValue(UnderlineProperty);
+ }
+ set
+ {
+ SetValue(UnderlineProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The InputUnderline property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string InputUnderline
+ {
+ get
+ {
+ return (string)GetValue(InputUnderlineProperty);
+ }
+ set
+ {
+ SetValue(InputUnderlineProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The Shadow property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap Shadow
+ {
+ get
+ {
+ return (PropertyMap)GetValue(ShadowProperty);
+ }
+ set
+ {
+ SetValue(ShadowProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The InputShadow property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string InputShadow
+ {
+ get
+ {
+ return (string)GetValue(InputShadowProperty);
+ }
+ set
+ {
+ SetValue(InputShadowProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The Emboss property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string Emboss
+ {
+ get
+ {
+ return (string)GetValue(EmbossProperty);
+ }
+ set
+ {
+ SetValue(EmbossProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The InputEmboss property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string InputEmboss
+ {
+ get
+ {
+ return (string)GetValue(InputEmbossProperty);
+ }
+ set
+ {
+ SetValue(InputEmbossProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The Outline property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap Outline
+ {
+ get
+ {
+ return (PropertyMap)GetValue(OutlineProperty);
+ }
+ set
+ {
+ SetValue(OutlineProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The InputOutline property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string InputOutline
+ {
+ get
+ {
+ return (string)GetValue(InputOutlineProperty);
+ }
+ set
+ {
+ SetValue(InputOutlineProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The HiddenInputSettings property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap HiddenInputSettings
+ {
+ get
+ {
+ return (PropertyMap)GetValue(HiddenInputSettingsProperty);
+ }
+ set
+ {
+ SetValue(HiddenInputSettingsProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The PixelSize property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float PixelSize
+ {
+ get
+ {
+ return (float)GetValue(PixelSizeProperty);
+ }
+ set
+ {
+ SetValue(PixelSizeProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The Enable selection property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool EnableSelection
+ {
+ get
+ {
+ return (bool)GetValue(EnableSelectionProperty);
+ }
+ set
+ {
+ SetValue(EnableSelectionProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The Placeholder property.
+ /// Gets or sets the placeholder: text, color, font family, font style, point size, and pixel size.
+ /// </summary>
+ /// <example>
+ /// The following example demonstrates how to set the Placeholder property.
+ /// <code>
+ /// PropertyMap propertyMap = new PropertyMap();
+ /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
+ /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
+ /// propertyMap.Add("color", new PropertyValue(Color.Red));
+ /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
+ /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
+ ///
+ /// PropertyMap fontStyleMap = new PropertyMap();
+ /// fontStyleMap.Add("weight", new PropertyValue("bold"));
+ /// fontStyleMap.Add("width", new PropertyValue("condensed"));
+ /// fontStyleMap.Add("slant", new PropertyValue("italic"));
+ /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
+ ///
+ /// TextField field = new TextField();
+ /// field.Placeholder = propertyMap;
+ /// </code>
+ /// </example>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap Placeholder
+ {
+ get
+ {
+ return (PropertyMap)GetValue(PlaceholderProperty);
+ }
+ set
+ {
+ SetValue(PlaceholderProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The Ellipsis property.<br />
+ /// Enable or disable the ellipsis.<br />
+ /// Placeholder PropertyMap is used to add ellipsis to placeholder text.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool Ellipsis
+ {
+ get
+ {
+ return (bool)GetValue(EllipsisProperty);
+ }
+ set
+ {
+ SetValue(EllipsisProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Enables selection of the text using the Shift key.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool EnableShiftSelection
+ {
+ get
+ {
+ return (bool)GetValue(EnableShiftSelectionProperty);
+ }
+ set
+ {
+ SetValue(EnableShiftSelectionProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The text alignment to match the direction of the system language.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool MatchSystemLanguageDirection
+ {
+ get
+ {
+ return (bool)GetValue(MatchSystemLanguageDirectionProperty);
+ }
+ set
+ {
+ SetValue(MatchSystemLanguageDirectionProperty, value);
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+extern alias TizenSystemSettings;
+using System;
+using System.ComponentModel;
+using Tizen.NUI;
+using Tizen.NUI.XamlBinding;
+
+namespace Tizen.NUI.Xaml.Forms.BaseComponents
+{
+
+ /// <summary>
+ /// A control which renders a short text string.<br />
+ /// Text labels are lightweight, non-editable, and do not respond to the user input.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class TextLabel : View
+ {
+ private Tizen.NUI.BaseComponents.TextLabel _textLabel;
+ internal Tizen.NUI.BaseComponents.TextLabel textLabel
+ {
+ get
+ {
+ if (null == _textLabel)
+ {
+ _textLabel = handleInstance as Tizen.NUI.BaseComponents.TextLabel;
+ }
+
+ return _textLabel;
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty TextProperty = BindableProperty.Create(nameof(Text), typeof(string), typeof(TextLabel), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ textLabel.Text = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ return textLabel.Text;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty FontFamilyProperty = BindableProperty.Create(nameof(FontFamily), typeof(string), typeof(TextLabel), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ textLabel.FontFamily = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ return textLabel.FontFamily;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty FontStyleProperty = BindableProperty.Create(nameof(FontStyle), typeof(PropertyMap), typeof(TextLabel), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ textLabel.FontStyle = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ return textLabel.FontStyle;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty PointSizeProperty = BindableProperty.Create(nameof(PointSize), typeof(float), typeof(TextLabel), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ textLabel.PointSize = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ return textLabel.PointSize;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty MultiLineProperty = BindableProperty.Create(nameof(MultiLine), typeof(bool), typeof(TextLabel), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ textLabel.MultiLine = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ return textLabel.MultiLine;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty HorizontalAlignmentProperty = BindableProperty.Create(nameof(HorizontalAlignment), typeof(HorizontalAlignment), typeof(TextLabel), HorizontalAlignment.Begin, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ textLabel.HorizontalAlignment = (HorizontalAlignment)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ return textLabel.HorizontalAlignment;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty VerticalAlignmentProperty = BindableProperty.Create(nameof(VerticalAlignment), typeof(VerticalAlignment), typeof(TextLabel), VerticalAlignment.Bottom, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ textLabel.VerticalAlignment = (VerticalAlignment)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ return textLabel.VerticalAlignment;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty TextColorProperty = BindableProperty.Create(nameof(TextColor), typeof(Color), typeof(TextLabel), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ textLabel.TextColor = (Color)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ return textLabel.TextColor;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty EnableMarkupProperty = BindableProperty.Create(nameof(EnableMarkup), typeof(bool), typeof(TextLabel), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ textLabel.EnableMarkup = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ return textLabel.EnableMarkup;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty EnableAutoScrollProperty = BindableProperty.Create(nameof(EnableAutoScroll), typeof(bool), typeof(TextLabel), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ textLabel.EnableAutoScroll = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ return textLabel.EnableAutoScroll;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty AutoScrollSpeedProperty = BindableProperty.Create(nameof(AutoScrollSpeed), typeof(int), typeof(TextLabel), default(int), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ textLabel.AutoScrollSpeed = (int)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ return textLabel.AutoScrollSpeed;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty AutoScrollLoopCountProperty = BindableProperty.Create(nameof(AutoScrollLoopCount), typeof(int), typeof(TextLabel), default(int), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ textLabel.AutoScrollLoopCount = (int)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ return textLabel.AutoScrollLoopCount;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty AutoScrollGapProperty = BindableProperty.Create(nameof(AutoScrollGap), typeof(float), typeof(TextLabel), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ textLabel.AutoScrollGap = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ return textLabel.AutoScrollGap;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty LineSpacingProperty = BindableProperty.Create(nameof(LineSpacing), typeof(float), typeof(TextLabel), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ textLabel.LineSpacing = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ return textLabel.LineSpacing;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty UnderlineProperty = BindableProperty.Create(nameof(Underline), typeof(PropertyMap), typeof(TextLabel), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ textLabel.Underline = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ return textLabel.Underline;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ShadowProperty = BindableProperty.Create(nameof(Shadow), typeof(PropertyMap), typeof(TextLabel), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ textLabel.Shadow = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ return textLabel.Shadow;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty EmbossProperty = BindableProperty.Create(nameof(Emboss), typeof(string), typeof(TextLabel), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ textLabel.Emboss = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ return textLabel.Emboss;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty OutlineProperty = BindableProperty.Create(nameof(Outline), typeof(PropertyMap), typeof(TextLabel), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ textLabel.Outline = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ return textLabel.Outline;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty PixelSizeProperty = BindableProperty.Create(nameof(PixelSize), typeof(float), typeof(TextLabel), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ textLabel.PixelSize = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ return textLabel.PixelSize;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty EllipsisProperty = BindableProperty.Create(nameof(Ellipsis), typeof(bool), typeof(TextLabel), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ textLabel.Ellipsis = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ return textLabel.Ellipsis;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty AutoScrollLoopDelayProperty = BindableProperty.Create(nameof(AutoScrollLoopDelay), typeof(float), typeof(TextLabel), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ textLabel.AutoScrollLoopDelay = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ return textLabel.AutoScrollLoopDelay;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty AutoScrollStopModeProperty = BindableProperty.Create(nameof(AutoScrollStopMode), typeof(AutoScrollStopMode), typeof(TextLabel), AutoScrollStopMode.FinishLoop, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ textLabel.AutoScrollStopMode = (AutoScrollStopMode)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ return textLabel.AutoScrollStopMode;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty LineWrapModeProperty = BindableProperty.Create(nameof(LineWrapMode), typeof(LineWrapMode), typeof(TextLabel), LineWrapMode.Word, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ textLabel.LineWrapMode = (LineWrapMode)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ return textLabel.LineWrapMode;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty VerticalLineAlignmentProperty = BindableProperty.Create(nameof(VerticalLineAlignment), typeof(VerticalLineAlignment), typeof(TextLabel), VerticalLineAlignment.Bottom, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ textLabel.VerticalLineAlignment = (VerticalLineAlignment)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ return textLabel.VerticalLineAlignment;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty MatchSystemLanguageDirectionProperty = BindableProperty.Create(nameof(MatchSystemLanguageDirection), typeof(bool), typeof(TextLabel), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ textLabel.MatchSystemLanguageDirection = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = ((TextLabel)bindable).textLabel;
+ return textLabel.MatchSystemLanguageDirection;
+ });
+
+ /// <summary>
+ /// Creates a new instance of a Xaml TextLabel.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public TextLabel() : this(new Tizen.NUI.BaseComponents.TextLabel())
+ {
+ }
+
+ /// <summary>
+ /// Creates a new instance of a Xaml TextLabel.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public TextLabel(string text) : this(new Tizen.NUI.BaseComponents.TextLabel(text))
+ {
+ }
+
+ internal TextLabel(Tizen.NUI.BaseComponents.TextLabel nuiInstance) : base(nuiInstance)
+ {
+ SetNUIInstance(nuiInstance);
+ }
+
+ /// <summary>
+ /// Downcasts a handle to textLabel handle
+ /// </summary>
+ /// <param name="handle"></param>
+ /// <returns></returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// Please do not use! this will be deprecated!
+ /// Instead please use as keyword.
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [Obsolete("Please do not use! This will be deprecated! Please use as keyword instead! " +
+ "Like: " +
+ "BaseHandle handle = new TextLabel(\"Hello World!\"); " +
+ "TextLabel label = handle as TextLabel")]
+ public static TextLabel DownCast(BaseHandle handle)
+ {
+ return BaseHandle.GetHandle(handle.handleInstance) as TextLabel;
+ }
+
+ /// <summary>
+ /// The TranslatableText property.<br />
+ /// The text can set the SID value.<br />
+ /// </summary>
+ /// <exception cref='ArgumentNullException'>
+ /// ResourceManager about multilingual is null.
+ /// </exception>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string TranslatableText
+ {
+ get
+ {
+ return textLabel.TranslatableText;
+ }
+ set
+ {
+ textLabel.TranslatableText = value;
+ }
+ }
+
+ /// <summary>
+ /// The Text property.<br />
+ /// The text to display in the UTF-8 format.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string Text
+ {
+ get
+ {
+ return (string)GetValue(TextProperty);
+ }
+ set
+ {
+ SetValue(TextProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The FontFamily property.<br />
+ /// The requested font family to use.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string FontFamily
+ {
+ get
+ {
+ return (string)GetValue(FontFamilyProperty);
+ }
+ set
+ {
+ SetValue(FontFamilyProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The FontStyle property.<br />
+ /// The requested font style to use.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap FontStyle
+ {
+ get
+ {
+ return (PropertyMap)GetValue(FontStyleProperty);
+ }
+ set
+ {
+ SetValue(FontStyleProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The PointSize property.<br />
+ /// The size of font in points.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float PointSize
+ {
+ get
+ {
+ return (float)GetValue(PointSizeProperty);
+ }
+ set
+ {
+ SetValue(PointSizeProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The MultiLine property.<br />
+ /// The single-line or multi-line layout option.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool MultiLine
+ {
+ get
+ {
+ return (bool)GetValue(MultiLineProperty);
+ }
+ set
+ {
+ SetValue(MultiLineProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The HorizontalAlignment property.<br />
+ /// The line horizontal alignment.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public HorizontalAlignment HorizontalAlignment
+ {
+ get
+ {
+ return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
+ }
+ set
+ {
+ SetValue(HorizontalAlignmentProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The VerticalAlignment property.<br />
+ /// The line vertical alignment.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public VerticalAlignment VerticalAlignment
+ {
+ get
+ {
+ return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
+ }
+ set
+ {
+ SetValue(VerticalAlignmentProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The TextColor property.<br />
+ /// The color of the text.<br />
+ /// Animation framework can be used to change the color of the text when not using mark up.<br />
+ /// Cannot animate the color when text is auto scrolling.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Color TextColor
+ {
+ get
+ {
+ return (Color)GetValue(TextColorProperty);
+ }
+ set
+ {
+ SetValue(TextColorProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The EnableMarkup property.<br />
+ /// Whether the mark-up processing is enabled.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool EnableMarkup
+ {
+ get
+ {
+ return (bool)GetValue(EnableMarkupProperty);
+ }
+ set
+ {
+ SetValue(EnableMarkupProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The EnableAutoScroll property.<br />
+ /// Starts or stops auto scrolling.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool EnableAutoScroll
+ {
+ get
+ {
+ return (bool)GetValue(EnableAutoScrollProperty);
+ }
+ set
+ {
+ SetValue(EnableAutoScrollProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The AutoScrollSpeed property.<br />
+ /// Sets the speed of scrolling in pixels per second.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int AutoScrollSpeed
+ {
+ get
+ {
+ return (int)GetValue(AutoScrollSpeedProperty);
+ }
+ set
+ {
+ SetValue(AutoScrollSpeedProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The AutoScrollLoopCount property.<br />
+ /// Number of complete loops when scrolling enabled.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int AutoScrollLoopCount
+ {
+ get
+ {
+ return (int)GetValue(AutoScrollLoopCountProperty);
+ }
+ set
+ {
+ SetValue(AutoScrollLoopCountProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The AutoScrollGap property.<br />
+ /// Gap before scrolling wraps.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float AutoScrollGap
+ {
+ get
+ {
+ return (float)GetValue(AutoScrollGapProperty);
+ }
+ set
+ {
+ SetValue(AutoScrollGapProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The LineSpacing property.<br />
+ /// The default extra space between lines in points.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float LineSpacing
+ {
+ get
+ {
+ return (float)GetValue(LineSpacingProperty);
+ }
+ set
+ {
+ SetValue(LineSpacingProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The Underline property.<br />
+ /// The default underline parameters.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap Underline
+ {
+ get
+ {
+ return (PropertyMap)GetValue(UnderlineProperty);
+ }
+ set
+ {
+ SetValue(UnderlineProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The Shadow property.<br />
+ /// The default shadow parameters.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap Shadow
+ {
+ get
+ {
+ return (PropertyMap)GetValue(ShadowProperty);
+ }
+ set
+ {
+ SetValue(ShadowProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The Emboss property.<br />
+ /// The default emboss parameters.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string Emboss
+ {
+ get
+ {
+ return (string)GetValue(EmbossProperty);
+ }
+ set
+ {
+ SetValue(EmbossProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The Outline property.<br />
+ /// The default outline parameters.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap Outline
+ {
+ get
+ {
+ return (PropertyMap)GetValue(OutlineProperty);
+ }
+ set
+ {
+ SetValue(OutlineProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The PixelSize property.<br />
+ /// The size of font in pixels.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float PixelSize
+ {
+ get
+ {
+ return (float)GetValue(PixelSizeProperty);
+ }
+ set
+ {
+ SetValue(PixelSizeProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The Ellipsis property.<br />
+ /// Enable or disable the ellipsis.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool Ellipsis
+ {
+ get
+ {
+ return (bool)GetValue(EllipsisProperty);
+ }
+ set
+ {
+ SetValue(EllipsisProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The AutoScrollLoopDelay property.<br />
+ /// Do something.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float AutoScrollLoopDelay
+ {
+ get
+ {
+ return (float)GetValue(AutoScrollLoopDelayProperty);
+ }
+ set
+ {
+ SetValue(AutoScrollLoopDelayProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The AutoScrollStopMode property.<br />
+ /// Do something.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public AutoScrollStopMode AutoScrollStopMode
+ {
+ get
+ {
+ return (AutoScrollStopMode)GetValue(AutoScrollStopModeProperty);
+ }
+ set
+ {
+ SetValue(AutoScrollStopModeProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The line count of the text.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int LineCount
+ {
+ get
+ {
+ return textLabel.LineCount;
+ }
+ }
+
+ /// <summary>
+ /// The LineWrapMode property.<br />
+ /// line wrap mode when the text lines over layout width.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public LineWrapMode LineWrapMode
+ {
+ get
+ {
+ return (LineWrapMode)GetValue(LineWrapModeProperty);
+ }
+ set
+ {
+ SetValue(LineWrapModeProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The direction of the text such as left to right or right to left.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public TextDirection TextDirection
+ {
+ get
+ {
+ return textLabel.TextDirection;
+ }
+ }
+
+ /// <summary>
+ /// The vertical line alignment of the text.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public VerticalLineAlignment VerticalLineAlignment
+ {
+ get
+ {
+ return (VerticalLineAlignment)GetValue(VerticalLineAlignmentProperty);
+ }
+ set
+ {
+ SetValue(VerticalLineAlignmentProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The text alignment to match the direction of the system language.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool MatchSystemLanguageDirection
+ {
+ get
+ {
+ return (bool)GetValue(MatchSystemLanguageDirectionProperty);
+ }
+ set
+ {
+ SetValue(MatchSystemLanguageDirectionProperty, value);
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System;
+using System.ComponentModel;
+using Tizen.NUI;
+using Tizen.NUI.XamlBinding;
+using static Tizen.NUI.BaseComponents.VideoView;
+
+namespace Tizen.NUI.Xaml.Forms.BaseComponents
+{
+ /// <summary>
+ /// VideoView is a control for video playback and display.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class VideoView : View
+ {
+ private Tizen.NUI.BaseComponents.VideoView _videoView;
+ internal Tizen.NUI.BaseComponents.VideoView videoView
+ {
+ get
+ {
+ if (null == _videoView)
+ {
+ _videoView = handleInstance as Tizen.NUI.BaseComponents.VideoView;
+ }
+
+ return _videoView;
+ }
+ }
+
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public VideoView() : this(new Tizen.NUI.BaseComponents.VideoView())
+ {
+ }
+
+ internal VideoView(Tizen.NUI.BaseComponents.VideoView nuiInstance) : base(nuiInstance)
+ {
+ SetNUIInstance(nuiInstance);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty VideoProperty = BindableProperty.Create("Video", typeof(PropertyMap), typeof(VideoView), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var videoView = ((VideoView)bindable).videoView;
+ videoView.Video = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var videoView = ((VideoView)bindable).videoView;
+ return videoView.Video;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty LoopingProperty = BindableProperty.Create("Looping", typeof(bool), typeof(VideoView), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var videoView = ((VideoView)bindable).videoView;
+ videoView.Looping = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var videoView = ((VideoView)bindable).videoView;
+ return videoView.Looping;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty MutedProperty = BindableProperty.Create("Muted", typeof(bool), typeof(VideoView), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var videoView = ((VideoView)bindable).videoView;
+ videoView.Muted = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var videoView = ((VideoView)bindable).videoView;
+ return videoView.Muted;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty VolumeProperty = BindableProperty.Create("Volume", typeof(PropertyMap), typeof(VideoView), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var videoView = ((VideoView)bindable).videoView;
+ videoView.Volume = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var videoView = ((VideoView)bindable).videoView;
+ return videoView.Volume;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty UnderlayProperty = BindableProperty.Create("Underlay", typeof(bool), typeof(VideoView), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var videoView = ((VideoView)bindable).videoView;
+ videoView.Underlay = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var videoView = ((VideoView)bindable).videoView;
+ return videoView.Underlay;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ResourceUrlProperty = BindableProperty.Create("ResourceUrl", typeof(string), typeof(VideoView), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var videoView = ((VideoView)bindable).videoView;
+ videoView.ResourceUrl = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var videoView = ((VideoView)bindable).videoView;
+ return videoView.ResourceUrl;
+ });
+
+ /// <summary>
+ /// Event for the finished signal which can be used to subscribe or unsubscribe the event handler
+ /// The finished signal is emitted when a video playback has finished.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler<FinishedEventArgs> Finished
+ {
+ add
+ {
+ videoView.Finished += value;
+ }
+ remove
+ {
+ videoView.Finished -= value;
+ }
+ }
+
+ /// <summary>
+ /// Starts the video playback.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Play()
+ {
+ videoView.Play();
+ }
+
+ /// <summary>
+ /// Pauses the video playback.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Pause()
+ {
+ videoView.Pause();
+ }
+
+ /// <summary>
+ /// Stops the video playback.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Stop()
+ {
+ videoView.Stop();
+ }
+
+ /// <summary>
+ /// Seeks forward by the specified number of milliseconds.
+ /// </summary>
+ /// <param name="millisecond">The position for forward playback.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Forward(int millisecond)
+ {
+ videoView.Forward(millisecond);
+ }
+
+ /// <summary>
+ /// Seeks backward by the specified number of milliseconds.
+ /// </summary>
+ /// <param name="millisecond">The position for backward playback.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Backward(int millisecond)
+ {
+ videoView.Backward(millisecond);
+ }
+
+ /// <summary>
+ /// Video file setting type of PropertyMap.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap Video
+ {
+ get
+ {
+ return (PropertyMap)GetValue(VideoProperty);
+ }
+ set
+ {
+ SetValue(VideoProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The looping status, true or false.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool Looping
+ {
+ get
+ {
+ return (bool)GetValue(LoopingProperty);
+ }
+ set
+ {
+ SetValue(LoopingProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The mute status, true or false.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool Muted
+ {
+ get
+ {
+ return (bool)GetValue(MutedProperty);
+ }
+ set
+ {
+ SetValue(MutedProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The left and the right volume scalar as float type, PropertyMap with two values ( "left" and "right" ).
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap Volume
+ {
+ get
+ {
+ return (PropertyMap)GetValue(VolumeProperty);
+ }
+ set
+ {
+ SetValue(VolumeProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Video rendering by underlay, true or false.<br />
+ /// This shows video composited underneath the window by the system. This means it may ignore rotation of the video-view.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool Underlay
+ {
+ get
+ {
+ return (bool)GetValue(UnderlayProperty);
+ }
+ set
+ {
+ SetValue(UnderlayProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Video file URL as string type.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string ResourceUrl
+ {
+ get
+ {
+ return (string)GetValue(ResourceUrlProperty);
+ }
+ set
+ {
+ SetValue(ResourceUrlProperty, value);
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System;
+using System.ComponentModel;
+using Tizen.NUI.XamlBinding;
+using static Tizen.NUI.BaseComponents.View;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.Xaml.Forms.BaseComponents
+{
+ /// <summary>
+ /// View is the base class for all views.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [ContentProperty("Content")]
+ public class View : Tizen.NUI.Xaml.Forms.Container, Tizen.NUI.Binding.IResourcesProvider
+ {
+ private Tizen.NUI.BaseComponents.View _view;
+ internal Tizen.NUI.BaseComponents.View view
+ {
+ get
+ {
+ if (null == _view)
+ {
+ _view = handleInstance as Tizen.NUI.BaseComponents.View;
+ }
+
+ return _view;
+ }
+ }
+
+ /// <summary>
+ /// Creates a new instance of a Xaml View.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public View() : this(new Tizen.NUI.BaseComponents.View())
+ {
+ }
+
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Tizen.NUI.BaseComponents.View ViewInstance
+ {
+ get
+ {
+ return _view;
+ }
+ }
+
+ internal View(Tizen.NUI.BaseComponents.View nuiInstance) : base(nuiInstance)
+ {
+ _view = nuiInstance;
+ SetNUIInstance(nuiInstance);
+ }
+
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ bool Tizen.NUI.Binding.IResourcesProvider.IsResourcesCreated => _resources != null;
+
+ ResourceDictionary _resources;
+
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ResourceDictionary Resources
+ {
+ get
+ {
+ if (_resources != null)
+ return _resources;
+ _resources = new ResourceDictionary();
+ ((IResourceDictionary)_resources).ValuesChanged += OnResourcesChanged;
+ return _resources;
+ }
+ set
+ {
+ if (_resources == value)
+ return;
+ OnPropertyChanging();
+ if (_resources != null)
+ ((IResourceDictionary)_resources).ValuesChanged -= OnResourcesChanged;
+ _resources = value;
+ OnResourcesChanged(value);
+ if (_resources != null)
+ ((IResourceDictionary)_resources).ValuesChanged += OnResourcesChanged;
+ OnPropertyChanged();
+ }
+ }
+
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ResourceDictionary XamlResources
+ {
+ get
+ {
+ if (_resources != null)
+ return _resources;
+
+ _resources = new ResourceDictionary();
+ ((IResourceDictionary)_resources).ValuesChanged += OnResourcesChanged;
+ return _resources;
+ }
+ set
+ {
+ if (_resources == value)
+ return;
+ OnPropertyChanging();
+ if (_resources != null)
+ ((IResourceDictionary)_resources).ValuesChanged -= OnResourcesChanged;
+ _resources = value;
+ OnResourcesChanged(value);
+ if (_resources != null)
+ ((IResourceDictionary)_resources).ValuesChanged += OnResourcesChanged;
+ OnPropertyChanged();
+ }
+ }
+
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ContentProperty = BindableProperty.Create("Content", typeof(View), typeof(ContentPage), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var self = (View)bindable;
+ if (newValue != null)
+ {
+ self.Add((View)newValue);
+ }
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty StyleNameProperty = BindableProperty.Create("StyleName", typeof(string), typeof(View), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.StyleName = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.StyleName;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty BackgroundColorProperty = BindableProperty.Create("BackgroundColor", typeof(Color), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.BackgroundColor = (Color)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.BackgroundColor;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty BackgroundImageProperty = BindableProperty.Create("BackgroundImage", typeof(string), typeof(View), default(string), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.BackgroundImage = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.BackgroundImage;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty BackgroundProperty = BindableProperty.Create("Background", typeof(PropertyMap), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.Background = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.Background;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty StateProperty = BindableProperty.Create("State", typeof(States), typeof(View), States.Normal, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.State = (States)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.State;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SubStateProperty = BindableProperty.Create("SubState", typeof(States), typeof(View), States.Normal, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.SubState = (States)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.SubState;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty TooltipProperty = BindableProperty.Create("Tooltip", typeof(PropertyMap), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.Tooltip = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.Tooltip;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty FlexProperty = BindableProperty.Create("Flex", typeof(float), typeof(View), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.Flex = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.Flex;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty AlignSelfProperty = BindableProperty.Create("AlignSelf", typeof(int), typeof(View), default(int), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.AlignSelf = (int)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.AlignSelf;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty FlexMarginProperty = BindableProperty.Create("FlexMargin", typeof(Vector4), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.FlexMargin = (Vector4)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.FlexMargin;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty CellIndexProperty = BindableProperty.Create("CellIndex", typeof(Vector2), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.CellIndex = (Vector2)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.CellIndex;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty RowSpanProperty = BindableProperty.Create("RowSpan", typeof(float), typeof(View), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.RowSpan = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.RowSpan;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ColumnSpanProperty = BindableProperty.Create("ColumnSpan", typeof(float), typeof(View), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.ColumnSpan = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.ColumnSpan;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty CellHorizontalAlignmentProperty = BindableProperty.Create("CellHorizontalAlignment", typeof(HorizontalAlignmentType), typeof(View), HorizontalAlignmentType.Left, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.CellHorizontalAlignment = (HorizontalAlignmentType)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.CellHorizontalAlignment;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty CellVerticalAlignmentProperty = BindableProperty.Create("CellVerticalAlignment", typeof(VerticalAlignmentType), typeof(View), VerticalAlignmentType.Top, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.CellVerticalAlignment = (VerticalAlignmentType)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.CellVerticalAlignment;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty LeftFocusableViewProperty = BindableProperty.Create(nameof(View.LeftFocusableView), typeof(Tizen.NUI.BaseComponents.View), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.LeftFocusableView = (Tizen.NUI.BaseComponents.View)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.LeftFocusableView;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty RightFocusableViewProperty = BindableProperty.Create(nameof(View.RightFocusableView), typeof(Tizen.NUI.BaseComponents.View), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.RightFocusableView = (Tizen.NUI.BaseComponents.View)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.RightFocusableView;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty UpFocusableViewProperty = BindableProperty.Create(nameof(View.UpFocusableView), typeof(Tizen.NUI.BaseComponents.View), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.UpFocusableView = (Tizen.NUI.BaseComponents.View)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.UpFocusableView;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty DownFocusableViewProperty = BindableProperty.Create(nameof(View.DownFocusableView), typeof(Tizen.NUI.BaseComponents.View), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.DownFocusableView = (Tizen.NUI.BaseComponents.View)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.DownFocusableView;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty FocusableProperty = BindableProperty.Create("Focusable", typeof(bool), typeof(View), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.Focusable = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.Focusable;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty Size2DProperty = BindableProperty.Create("Size2D", typeof(Size2D), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.Size2D = (Size2D)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.Size2D;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty OpacityProperty = BindableProperty.Create("Opacity", typeof(float), typeof(View), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.Opacity = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.Opacity;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty Position2DProperty = BindableProperty.Create("Position2D", typeof(Position2D), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.Position2D = (Position2D)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.Position2D;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty PositionUsesPivotPointProperty = BindableProperty.Create("PositionUsesPivotPoint", typeof(bool), typeof(View), true, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.PositionUsesPivotPoint = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.PositionUsesPivotPoint;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SiblingOrderProperty = BindableProperty.Create("SiblingOrder", typeof(int), typeof(View), default(int), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.SiblingOrder = (int)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ var parentChildren = view.GetParent()?.Children;
+ int currentOrder = 0;
+ if (parentChildren != null)
+ {
+ currentOrder = parentChildren.IndexOf(view);
+
+ if (currentOrder < 0) { return 0; }
+ else if (currentOrder < parentChildren.Count) { return currentOrder; }
+ }
+
+ return 0;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ParentOriginProperty = BindableProperty.Create("ParentOrigin", typeof(Position), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.ParentOrigin = (Position)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.ParentOrigin;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty PivotPointProperty = BindableProperty.Create("PivotPoint", typeof(Position), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.PivotPoint = (Position)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.PivotPoint;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SizeWidthProperty = BindableProperty.Create("SizeWidth", typeof(float), typeof(View), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.SizeWidth = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.SizeWidth;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SizeHeightProperty = BindableProperty.Create("SizeHeight", typeof(float), typeof(View), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.SizeHeight = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.SizeHeight;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty PositionProperty = BindableProperty.Create("Position", typeof(Position), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.Position = (Position)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.Position;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty PositionXProperty = BindableProperty.Create("PositionX", typeof(float), typeof(View), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.PositionX = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.PositionX;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty PositionYProperty = BindableProperty.Create("PositionY", typeof(float), typeof(View), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.PositionY = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.PositionY;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty PositionZProperty = BindableProperty.Create("PositionZ", typeof(float), typeof(View), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.PositionZ = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.PositionZ;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty OrientationProperty = BindableProperty.Create("Orientation", typeof(Rotation), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.Orientation = (Rotation)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.Orientation;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ScaleProperty = BindableProperty.Create("Scale", typeof(Vector3), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.Scale = (Vector3)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.Scale;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ScaleXProperty = BindableProperty.Create("ScaleX", typeof(float), typeof(View), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.ScaleX = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.ScaleX;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ScaleYProperty = BindableProperty.Create("ScaleY", typeof(float), typeof(View), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.ScaleY = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.ScaleY;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ScaleZProperty = BindableProperty.Create("ScaleZ", typeof(float), typeof(View), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.ScaleZ = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.ScaleZ;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty NameProperty = BindableProperty.Create("Name", typeof(string), typeof(View), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.Name = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.Name;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SensitiveProperty = BindableProperty.Create("Sensitive", typeof(bool), typeof(View), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.Sensitive = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.Sensitive;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty LeaveRequiredProperty = BindableProperty.Create("LeaveRequired", typeof(bool), typeof(View), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.LeaveRequired = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.LeaveRequired;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty InheritOrientationProperty = BindableProperty.Create("InheritOrientation", typeof(bool), typeof(View), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.InheritOrientation = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.InheritOrientation;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty InheritScaleProperty = BindableProperty.Create("InheritScale", typeof(bool), typeof(View), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.InheritScale = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.InheritScale;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty DrawModeProperty = BindableProperty.Create("DrawMode", typeof(DrawModeType), typeof(View), DrawModeType.Normal, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.DrawMode = (DrawModeType)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.DrawMode;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SizeModeFactorProperty = BindableProperty.Create("SizeModeFactor", typeof(Vector3), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.SizeModeFactor = (Vector3)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.SizeModeFactor;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty WidthResizePolicyProperty = BindableProperty.Create("WidthResizePolicy", typeof(ResizePolicyType), typeof(View), ResizePolicyType.Fixed, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.WidthResizePolicy = (ResizePolicyType)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.WidthResizePolicy;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty HeightResizePolicyProperty = BindableProperty.Create("HeightResizePolicy", typeof(ResizePolicyType), typeof(View), ResizePolicyType.Fixed, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.HeightResizePolicy = (ResizePolicyType)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.HeightResizePolicy;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SizeScalePolicyProperty = BindableProperty.Create("SizeScalePolicy", typeof(SizeScalePolicyType), typeof(View), SizeScalePolicyType.UseSizeSet, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.SizeScalePolicy = (SizeScalePolicyType)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.SizeScalePolicy;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty WidthForHeightProperty = BindableProperty.Create("WidthForHeight", typeof(bool), typeof(View), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.WidthForHeight = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.WidthForHeight;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty HeightForWidthProperty = BindableProperty.Create("HeightForWidth", typeof(bool), typeof(View), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.HeightForWidth = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.HeightForWidth;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty PaddingProperty = BindableProperty.Create("Padding", typeof(Extents), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.Padding = (Extents)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.Padding;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SizeProperty = BindableProperty.Create("Size", typeof(Size), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.Size = (Size)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.Size;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty MinimumSizeProperty = BindableProperty.Create("MinimumSize", typeof(Size2D), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.MinimumSize = (Size2D)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.MinimumSize;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty MaximumSizeProperty = BindableProperty.Create("MaximumSize", typeof(Size2D), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.MaximumSize = (Size2D)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.MaximumSize;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty InheritPositionProperty = BindableProperty.Create("InheritPosition", typeof(bool), typeof(View), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.InheritPosition = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.InheritPosition;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ClippingModeProperty = BindableProperty.Create("ClippingMode", typeof(ClippingModeType), typeof(View), ClippingModeType.Disabled, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.ClippingMode = (ClippingModeType)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.ClippingMode;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty InheritLayoutDirectionProperty = BindableProperty.Create("InheritLayoutDirection", typeof(bool), typeof(View), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.InheritLayoutDirection = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.InheritLayoutDirection;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty LayoutDirectionProperty = BindableProperty.Create("LayoutDirection", typeof(ViewLayoutDirectionType), typeof(View), ViewLayoutDirectionType.LTR, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.LayoutDirection = (ViewLayoutDirectionType)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.LayoutDirection;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty MarginProperty = BindableProperty.Create("Margin", typeof(Extents), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = ((View)bindable).view;
+ view.Margin = (Extents)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = ((View)bindable).view;
+ return view.Margin;
+ });
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty StyleProperty = BindableProperty.Create("Style", typeof(Style), typeof(View), default(Style),
+ propertyChanged: (bindable, oldvalue, newvalue) => ((View)bindable).mergedStyle.Style = (Style)newvalue);
+
+ /// <summary>
+ /// Event argument passed through the ChildAdded event.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class ChildAddedEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Added child view at moment.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public View Added { get; set; }
+ }
+
+ /// <summary>
+ /// Event when a child is added.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler<ChildAddedEventArgs> ChildAdded;
+
+ // From Container Base class
+ /// <summary>
+ /// Adds a child view to this view.
+ /// </summary>
+ /// <seealso cref="Container.Add" />
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override void Add(View child)
+ {
+ (child as IElement).Parent = this;
+ view.Add(child.view);
+
+ if (ChildAdded != null)
+ {
+ ChildAddedEventArgs e = new ChildAddedEventArgs
+ {
+ Added = child
+ };
+ ChildAdded(this, e);
+ }
+ }
+
+ /// <summary>
+ /// Event argument passed through the ChildRemoved event.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class ChildRemovedEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Removed child view at moment.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public View Removed { get; set; }
+ }
+
+ /// <summary>
+ /// Event when a child is removed.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler<ChildRemovedEventArgs> ChildRemoved;
+
+
+ /// <summary>
+ /// Removes a child view from this View. If the view was not a child of this view, this is a no-op.
+ /// </summary>
+ /// <seealso cref="Container.Remove" />
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override void Remove(View child)
+ {
+ (child as IElement).Parent = null;
+ view.Remove(child.view);
+
+ if (ChildRemoved != null)
+ {
+ ChildRemovedEventArgs e = new ChildRemovedEventArgs
+ {
+ Removed = child
+ };
+ ChildRemoved(this, e);
+ }
+ }
+
+ /// <summary>
+ /// Retrieves a child view by index.
+ /// </summary>
+ /// <seealso cref="Container.GetChildAt" />
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override View GetChildAt(uint index)
+ {
+ if (index < view.Children.Count)
+ {
+ return BaseHandle.GetHandle(view.Children[Convert.ToInt32(index)]) as View;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /// <summary>
+ /// Retrieves the number of children held by the view.
+ /// </summary>
+ /// <seealso cref="Container.GetChildCount" />
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override uint GetChildCount()
+ {
+ return Convert.ToUInt32(view.Children.Count);
+ }
+
+ /// <summary>
+ /// Gets the views parent.
+ /// </summary>
+ /// <seealso cref="Container.GetParent()" />
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Container GetParent()
+ {
+ return BaseHandle.GetHandle(view.GetParent()) as Container;
+ }
+
+ /// <summary>
+ /// An event for the KeyInputFocusGained signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
+ /// The KeyInputFocusGained signal is emitted when the control gets the key input focus.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler FocusGained
+ {
+ add
+ {
+ view.FocusGained += value;
+ }
+
+ remove
+ {
+ view.FocusGained -= value;
+ }
+ }
+
+ /// <summary>
+ /// An event for the KeyInputFocusLost signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
+ /// The KeyInputFocusLost signal is emitted when the control loses the key input focus.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler FocusLost
+ {
+ add
+ {
+ view.FocusLost += value;
+ }
+
+ remove
+ {
+ view.FocusLost -= value;
+ }
+ }
+
+ /// <summary>
+ /// An event for the KeyPressed signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
+ /// The KeyPressed signal is emitted when the key event is received.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandlerWithReturnType<object, KeyEventArgs, bool> KeyEvent
+ {
+ add
+ {
+ view.KeyEvent += value;
+ }
+
+ remove
+ {
+ view.KeyEvent -= value;
+ }
+ }
+
+ /// <summary>
+ /// An event for the OnRelayout signal which can be used to subscribe or unsubscribe the event handler.<br />
+ /// The OnRelayout signal is emitted after the size has been set on the view during relayout.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler Relayout
+ {
+ add
+ {
+ view.Relayout += value;
+ }
+
+ remove
+ {
+ view.Relayout -= value;
+ }
+ }
+
+ /// <summary>
+ /// An event for the touched signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
+ /// The touched signal is emitted when the touch input is received.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandlerWithReturnType<object, TouchEventArgs, bool> TouchEvent
+ {
+ add
+ {
+ view.TouchEvent += value;
+ }
+
+ remove
+ {
+ view.TouchEvent -= value;
+ }
+ }
+
+ /// <summary>
+ /// An event for the hovered signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
+ /// The hovered signal is emitted when the hover input is received.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandlerWithReturnType<object, HoverEventArgs, bool> HoverEvent
+ {
+ add
+ {
+ view.HoverEvent += value;
+ }
+
+ remove
+ {
+ view.HoverEvent -= value;
+ }
+ }
+
+ /// <summary>
+ /// An event for the WheelMoved signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
+ /// The WheelMoved signal is emitted when the wheel event is received.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandlerWithReturnType<object, WheelEventArgs, bool> WheelEvent
+ {
+ add
+ {
+ view.WheelEvent += value;
+ }
+
+ remove
+ {
+ view.WheelEvent -= value;
+ }
+ }
+
+ /// <summary>
+ /// An event for the OnWindow signal which can be used to subscribe or unsubscribe the event handler.<br />
+ /// The OnWindow signal is emitted after the view has been connected to the window.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler AddedToWindow
+ {
+ add
+ {
+ view.AddedToWindow += value;
+ }
+
+ remove
+ {
+ view.AddedToWindow -= value;
+ }
+ }
+
+ /// <summary>
+ /// An event for the OffWindow signal, which can be used to subscribe or unsubscribe the event handler.<br />
+ /// OffWindow signal is emitted after the view has been disconnected from the window.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler RemovedFromWindow
+ {
+ add
+ {
+ view.RemovedFromWindow += value;
+ }
+
+ remove
+ {
+ view.RemovedFromWindow -= value;
+ }
+ }
+
+ /// <summary>
+ /// An event for visibility change which can be used to subscribe or unsubscribe the event handler.<br />
+ /// This signal is emitted when the visible property of this or a parent view is changed.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler<VisibilityChangedEventArgs> VisibilityChanged
+ {
+ add
+ {
+ view.VisibilityChanged += value;
+ }
+
+ remove
+ {
+ view.VisibilityChanged -= value;
+ }
+ }
+
+ /// <summary>
+ /// Event for layout direction change which can be used to subscribe/unsubscribe the event handler.<br />
+ /// This signal is emitted when the layout direction property of this or a parent view is changed.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler<LayoutDirectionChangedEventArgs> LayoutDirectionChanged
+ {
+ add
+ {
+ view.LayoutDirectionChanged += value;
+ }
+
+ remove
+ {
+ view.LayoutDirectionChanged -= value;
+ }
+ }
+
+ /// <summary>
+ /// An event for the ResourcesLoadedSignal signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
+ /// This signal is emitted after all resources required by a view are loaded and ready.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler ResourcesLoaded
+ {
+ add
+ {
+ view.ResourcesLoaded += value;
+ }
+
+ remove
+ {
+ view.ResourcesLoaded -= value;
+ }
+ }
+
+ /// <summary>
+ /// Queries whether the view has a focus.
+ /// </summary>
+ /// <returns>True if this view has a focus.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool HasFocus()
+ {
+ return view.HasFocus();
+ }
+
+ /// <summary>
+ /// Sets the name of the style to be applied to the view.
+ /// </summary>
+ /// <param name="styleName">A string matching a style described in a stylesheet.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetStyleName(string styleName)
+ {
+ view.SetStyleName(styleName);
+ }
+
+ /// <summary>
+ /// Retrieves the name of the style to be applied to the view (if any).
+ /// </summary>
+ /// <returns>A string matching a style, or an empty string.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string GetStyleName()
+ {
+ return view.GetStyleName();
+ }
+
+ /// <summary>
+ /// Clears the background.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void ClearBackground()
+ {
+ view.ClearBackground();
+ }
+
+ /// <summary>
+ /// The contents of ContentPage can be added into it.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public View Content
+ {
+ get { return (View)GetValue(ContentProperty); }
+ set { SetValue(ContentProperty, value); }
+ }
+
+ /// <summary>
+ /// The StyleName, type string.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string StyleName
+ {
+ get
+ {
+ return (string)GetValue(StyleNameProperty);
+ }
+ set
+ {
+ SetValue(StyleNameProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The mutually exclusive with BACKGROUND_IMAGE and BACKGROUND type Vector4.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Color BackgroundColor
+ {
+ get
+ {
+ return (Color)GetValue(BackgroundColorProperty);
+ }
+ set
+ {
+ SetValue(BackgroundColorProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Creates an animation to animate the background color visual. If there is no
+ /// background visual, creates one with transparent black as it's mixColor.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Animation AnimateBackgroundColor(object destinationValue,
+ int startTime,
+ int endTime,
+ AlphaFunction.BuiltinFunctions? alphaFunction = null,
+ object initialValue = null)
+ {
+ return view.AnimateBackgroundColor(destinationValue, startTime, endTime, alphaFunction, initialValue);
+ }
+
+ /// <summary>
+ /// Creates an animation to animate the mixColor of the named visual.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Animation AnimateColor(string targetVisual, object destinationColor, int startTime, int endTime, AlphaFunction.BuiltinFunctions? alphaFunction = null, object initialColor = null)
+ {
+ return view.AnimateColor(targetVisual, destinationColor, startTime, endTime, alphaFunction, initialColor);
+ }
+
+ /// <summary>
+ /// The mutually exclusive with BACKGROUND_COLOR and BACKGROUND type Map.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string BackgroundImage
+ {
+ get
+ {
+ return (string)GetValue(BackgroundImageProperty);
+ }
+ set
+ {
+ SetValue(BackgroundImageProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The background of view.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Tizen.NUI.PropertyMap Background
+ {
+ get
+ {
+ return (PropertyMap)GetValue(BackgroundProperty);
+ }
+ set
+ {
+ SetValue(BackgroundProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The current state of the view.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public States State
+ {
+ get
+ {
+ return (States)GetValue(StateProperty);
+ }
+ set
+ {
+ SetValue(StateProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The current sub state of the view.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public States SubState
+ {
+ get
+ {
+ return (States)GetValue(SubStateProperty);
+ }
+ set
+ {
+ SetValue(SubStateProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Displays a tooltip
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Tizen.NUI.PropertyMap Tooltip
+ {
+ get
+ {
+ return (PropertyMap)GetValue(TooltipProperty);
+ }
+ set
+ {
+ SetValue(TooltipProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Displays a tooltip as a text.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string TooltipText
+ {
+ set
+ {
+ view.TooltipText = value;
+ }
+ }
+
+ /// <summary>
+ /// The Child property of FlexContainer.<br />
+ /// The proportion of the free space in the container, the flex item will receive.<br />
+ /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float Flex
+ {
+ get
+ {
+ return (float)GetValue(FlexProperty);
+ }
+ set
+ {
+ SetValue(FlexProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The Child property of FlexContainer.<br />
+ /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int AlignSelf
+ {
+ get
+ {
+ return (int)GetValue(AlignSelfProperty);
+ }
+ set
+ {
+ SetValue(AlignSelfProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The Child property of FlexContainer.<br />
+ /// The space around the flex item.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector4 FlexMargin
+ {
+ get
+ {
+ return (Vector4)GetValue(FlexMarginProperty);
+ }
+ set
+ {
+ SetValue(FlexMarginProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The top-left cell this child occupies, if not set, the first available cell is used.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector2 CellIndex
+ {
+ get
+ {
+ return (Vector2)GetValue(CellIndexProperty);
+ }
+ set
+ {
+ SetValue(CellIndexProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The number of rows this child occupies, if not set, the default value is 1.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float RowSpan
+ {
+ get
+ {
+ return (float)GetValue(RowSpanProperty);
+ }
+ set
+ {
+ SetValue(RowSpanProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The number of columns this child occupies, if not set, the default value is 1.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float ColumnSpan
+ {
+ get
+ {
+ return (float)GetValue(ColumnSpanProperty);
+ }
+ set
+ {
+ SetValue(ColumnSpanProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
+ {
+ get
+ {
+ return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
+ }
+ set
+ {
+ SetValue(CellHorizontalAlignmentProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
+ {
+ get
+ {
+ return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
+ }
+ set
+ {
+ SetValue(CellVerticalAlignmentProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The left focusable view.<br />
+ /// This will return null if not set.<br />
+ /// This will also return null if the specified left focusable view is not on a window.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public View LeftFocusableView
+ {
+ // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
+ get
+ {
+ return (View)GetValue(LeftFocusableViewProperty);
+ }
+ set
+ {
+ SetValue(LeftFocusableViewProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The right focusable view.<br />
+ /// This will return null if not set.<br />
+ /// This will also return null if the specified right focusable view is not on a window.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public View RightFocusableView
+ {
+ // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
+ get
+ {
+ return (View)GetValue(RightFocusableViewProperty);
+ }
+ set
+ {
+ SetValue(RightFocusableViewProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The up focusable view.<br />
+ /// This will return null if not set.<br />
+ /// This will also return null if the specified up focusable view is not on a window.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public View UpFocusableView
+ {
+ // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
+ get
+ {
+ return (View)GetValue(UpFocusableViewProperty);
+ }
+ set
+ {
+ SetValue(UpFocusableViewProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The down focusable view.<br />
+ /// This will return null if not set.<br />
+ /// This will also return null if the specified down focusable view is not on a window.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public View DownFocusableView
+ {
+ // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
+ get
+ {
+ return (View)GetValue(DownFocusableViewProperty);
+ }
+ set
+ {
+ SetValue(DownFocusableViewProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Whether the view should be focusable by keyboard navigation.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool Focusable
+ {
+ set
+ {
+ SetValue(FocusableProperty, value);
+ }
+ get
+ {
+ return (bool)GetValue(FocusableProperty);
+ }
+ }
+
+ /// <summary>
+ /// Retrieves the position of the view.<br />
+ /// The coordinates are relative to the view's parent.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Position CurrentPosition
+ {
+ get
+ {
+ return view.CurrentPosition;
+ }
+ }
+
+ /// <summary>
+ /// Sets the size of a view for the width and the height.<br />
+ /// Geometry can be scaled to fit within this area.<br />
+ /// This does not interfere with the view's scale factor.<br />
+ /// The views default depth is the minimum of width and height.<br />
+ /// </summary>
+ /// <remarks>
+ /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
+ /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
+ /// Please note that this multi-cascade setting is especially possible for this NUI object (Size2D). <br />
+ /// This means by default others are impossible so it is recommended that NUI object typed properties are configured by their constructor with parameters. <br />
+ /// For example, this code is working fine : view.Scale = new Vector3( 2.0f, 1.5f, 0.0f); <br />
+ /// but this will not work! : view.Scale.X = 2.0f; view.Scale.Y = 1.5f; <br />
+ /// It may not match the current value in some cases, i.e. when the animation is progressing or the maximum or minimu size is set. <br />
+ /// </remarks>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Size2D Size2D
+ {
+ get
+ {
+ return (Size2D)GetValue(Size2DProperty);
+ }
+ set
+ {
+ SetValue(Size2DProperty, value);
+ }
+ }
+
+ private void OnSize2DChanged(int width, int height)
+ {
+ Size2D = new Size2D(width, height);
+ }
+
+ /// <summary>
+ /// Retrieves the size of the view.<br />
+ /// The coordinates are relative to the view's parent.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Size2D CurrentSize
+ {
+ get
+ {
+ return view.CurrentSize;
+ }
+ }
+
+ /// <summary>
+ /// Retrieves and sets the view's opacity.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float Opacity
+ {
+ get
+ {
+ return (float)GetValue(OpacityProperty);
+ }
+ set
+ {
+ SetValue(OpacityProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Sets the position of the view for X and Y.<br />
+ /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
+ /// If the position inheritance is disabled, sets the world position.<br />
+ /// </summary>
+ /// <remarks>
+ /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
+ /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
+ /// Please note that this multi-cascade setting is especially possible for this NUI object (Position2D). <br />
+ /// This means by default others are impossible so it is recommended that NUI object typed properties are configured by their constructor with parameters. <br />
+ /// For example, this code is working fine : view.Scale = new Vector3( 2.0f, 1.5f, 0.0f); <br />
+ /// but this will not work! : view.Scale.X = 2.0f; view.Scale.Y = 1.5f; <br />
+ /// </remarks>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Position2D Position2D
+ {
+ get
+ {
+ return (Position2D)GetValue(Position2DProperty);
+ }
+ set
+ {
+ SetValue(Position2DProperty, value);
+ }
+ }
+
+ private void OnPosition2DChanged(int x, int y)
+ {
+ Position2D = new Position2D(x, y);
+ }
+
+ /// <summary>
+ /// Retrieves the screen postion of the view.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector2 ScreenPosition
+ {
+ get
+ {
+ return view.ScreenPosition;
+ }
+ }
+
+ /// <summary>
+ /// Determines whether the pivot point should be used to determine the position of the view.
+ /// This is true by default.
+ /// </summary>
+ /// <remarks>If false, then the top-left of the view is used for the position.
+ /// Setting this to false will allow scaling or rotation around the anchor-point without affecting the view's position.
+ /// </remarks>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool PositionUsesPivotPoint
+ {
+ get
+ {
+ return (bool)GetValue(PositionUsesPivotPointProperty);
+ }
+ set
+ {
+ SetValue(PositionUsesPivotPointProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Please do not use! this will be deprecated.
+ /// </summary>
+ /// Please do not use! this will be deprecated!
+ /// Instead please use PositionUsesPivotPoint.
+ /// <since_tizen> 6 </since_tizen>
+ [Obsolete("Please do not use! This will be deprecated! Please use PositionUsesPivotPoint instead! " +
+ "Like: " +
+ "View view = new View(); " +
+ "view.PivotPoint = PivotPoint.Center; " +
+ "view.PositionUsesPivotPoint = true;")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool PositionUsesAnchorPoint
+ {
+ get
+ {
+ return view.PositionUsesPivotPoint;
+ }
+ set
+ {
+ view.PositionUsesPivotPoint = value;
+ }
+ }
+
+ /// <summary>
+ /// Queries whether the view is connected to the stage.<br />
+ /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool IsOnWindow
+ {
+ get
+ {
+ return view.IsOnWindow;
+ }
+ }
+
+ /// <summary>
+ /// Gets the depth in the hierarchy for the view.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int HierarchyDepth
+ {
+ get
+ {
+ return view.HierarchyDepth;
+ }
+ }
+
+ /// <summary>
+ /// Sets the sibling order of the view so the depth position can be defined within the same parent.
+ /// </summary>
+ /// <remarks>
+ /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
+ /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
+ /// The values set by this property will likely change.
+ /// </remarks>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int SiblingOrder
+ {
+ get
+ {
+ return (int)GetValue(SiblingOrderProperty);
+ }
+ set
+ {
+ SetValue(SiblingOrderProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Returns the natural size of the view.
+ /// </summary>
+ /// <remarks>
+ /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
+ /// </remarks>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector3 NaturalSize
+ {
+ get
+ {
+ return view.NaturalSize;
+ }
+ }
+
+ /// <summary>
+ /// Returns the natural size (Size2D) of the view.
+ /// </summary>
+ /// <remarks>
+ /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
+ /// </remarks>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Size2D NaturalSize2D
+ {
+ get
+ {
+ return view.NaturalSize2D;
+ }
+ }
+
+ /// <summary>
+ /// Shows the view.
+ /// </summary>
+ /// <remarks>
+ /// This is an asynchronous method.
+ /// </remarks>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Show()
+ {
+ view.Show();
+ }
+
+ /// <summary>
+ /// Hides the view.
+ /// </summary>
+ /// <remarks>
+ /// This is an asynchronous method.
+ /// If the view is hidden, then the view and its children will not be rendered.
+ /// This is regardless of the individual visibility of the children, i.e., the view will only be rendered if all of its parents are shown.
+ /// </remarks>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Hide()
+ {
+ view.Hide();
+ }
+
+ /// <summary>
+ /// Raises the view above all other views.
+ /// </summary>
+ /// <remarks>
+ /// Sibling order of views within the parent will be updated automatically.
+ /// Once a raise or lower API is used, that view will then have an exclusive sibling order independent of insertion.
+ /// </remarks>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void RaiseToTop()
+ {
+ view.RaiseToTop();
+ }
+
+ /// <summary>
+ /// Lowers the view to the bottom of all views.
+ /// </summary>
+ /// <remarks>
+ /// The sibling order of views within the parent will be updated automatically.
+ /// Once a raise or lower API is used that view will then have an exclusive sibling order independent of insertion.
+ /// </remarks>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void LowerToBottom()
+ {
+ view.LowerToBottom();
+ }
+
+ /// <summary>
+ /// Queries if all resources required by a view are loaded and ready.
+ /// </summary>
+ /// <remarks>Most resources are only loaded when the control is placed on the stage.
+ /// </remarks>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool IsResourceReady()
+ {
+ return view.IsResourceReady();
+ }
+
+ /// <summary>
+ /// Gets the parent layer of this view.If a view has no parent, this method does not do anything.
+ /// </summary>
+ /// <pre>The view has been initialized. </pre>
+ /// <returns>The parent layer of view </returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Layer GetLayer()
+ {
+ return BaseHandle.GetHandle(view.GetLayer()) as Layer;
+ }
+
+ /// <summary>
+ /// Removes a view from its parent view or layer. If a view has no parent, this method does nothing.
+ /// </summary>
+ /// <pre>The (child) view has been initialized. </pre>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Unparent()
+ {
+ view.GetParent()?.Remove(view);
+ }
+
+ /// <summary>
+ /// Search through this view's hierarchy for a view with the given name.
+ /// The view itself is also considered in the search.
+ /// </summary>
+ /// <pre>The view has been initialized.</pre>
+ /// <param name="viewName">The name of the view to find.</param>
+ /// <returns>A handle to the view if found, or an empty handle if not.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public View FindChildByName(string viewName)
+ {
+ return BaseHandle.GetHandle(view.FindChildByName(viewName)) as View;
+ }
+
+ /// <summary>
+ /// Converts screen coordinates into the view's coordinate system using the default camera.
+ /// </summary>
+ /// <pre>The view has been initialized.</pre>
+ /// <remarks>The view coordinates are relative to the top-left(0.0, 0.0, 0.5).</remarks>
+ /// <param name="localX">On return, the X-coordinate relative to the view.</param>
+ /// <param name="localY">On return, the Y-coordinate relative to the view.</param>
+ /// <param name="screenX">The screen X-coordinate.</param>
+ /// <param name="screenY">The screen Y-coordinate.</param>
+ /// <returns>True if the conversion succeeded.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool ScreenToLocal(out float localX, out float localY, float screenX, float screenY)
+ {
+ return view.ScreenToLocal(out localX, out localY, screenX, screenY);
+ }
+
+ /// <summary>
+ /// Sets the relative to parent size factor of the view.<br />
+ /// This factor is only used when ResizePolicy is set to either:
+ /// ResizePolicy::SIZE_RELATIVE_TO_PARENT or ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT.<br />
+ /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicy.<br />
+ /// </summary>
+ /// <pre>The view has been initialized.</pre>
+ /// <param name="factor">A Vector3 representing the relative factor to be applied to each axis.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetSizeModeFactor(Vector3 factor)
+ {
+ view.SetSizeModeFactor(factor);
+ }
+
+ /// <summary>
+ /// Calculates the height of the view given a width.<br />
+ /// The natural size is used for default calculation.<br />
+ /// Size 0 is treated as aspect ratio 1:1.<br />
+ /// </summary>
+ /// <param name="width">The width to use.</param>
+ /// <returns>The height based on the width.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float GetHeightForWidth(float width)
+ {
+ return view.GetHeightForWidth(width);
+ }
+
+ /// <summary>
+ /// Calculates the width of the view given a height.<br />
+ /// The natural size is used for default calculation.<br />
+ /// Size 0 is treated as aspect ratio 1:1.<br />
+ /// </summary>
+ /// <param name="height">The height to use.</param>
+ /// <returns>The width based on the height.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float GetWidthForHeight(float height)
+ {
+ return view.GetWidthForHeight(height);
+ }
+
+ /// <summary>
+ /// Return the amount of size allocated for relayout.
+ /// </summary>
+ /// <param name="dimension">The dimension to retrieve.</param>
+ /// <returns>Return the size.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float GetRelayoutSize(DimensionType dimension)
+ {
+ return view.GetRelayoutSize(dimension);
+ }
+
+ /// <summary>
+ /// Set the padding for the view.
+ /// </summary>
+ /// <param name="padding">Padding for the view.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetPadding(PaddingType padding)
+ {
+ view.SetPadding(padding);
+ }
+
+ /// <summary>
+ /// Return the value of padding for the view.
+ /// </summary>
+ /// <param name="paddingOut">the value of padding for the view</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void GetPadding(PaddingType paddingOut)
+ {
+ view.GetPadding(paddingOut);
+ }
+
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public uint AddRenderer(Renderer renderer)
+ {
+ return view.AddRenderer(renderer);
+ }
+
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Renderer GetRendererAt(uint index)
+ {
+ return view.GetRendererAt(index);
+ }
+
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void RemoveRenderer(Renderer renderer)
+ {
+ view.RemoveRenderer(renderer);
+ }
+
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void RemoveRenderer(uint index)
+ {
+ view.RemoveRenderer(index);
+ }
+
+ /// <summary>
+ /// Gets or sets the origin of a view within its parent's area.<br />
+ /// This is expressed in unit coordinates, such that (0.0, 0.0, 0.5) is the top-left corner of the parent, and (1.0, 1.0, 0.5) is the bottom-right corner.<br />
+ /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
+ /// A view's position is the distance between this origin and the view's anchor-point.<br />
+ /// </summary>
+ /// <pre>The view has been initialized.</pre>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Position ParentOrigin
+ {
+ get
+ {
+ return (Position)GetValue(ParentOriginProperty);
+ }
+ set
+ {
+ SetValue(ParentOriginProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the anchor-point of a view.<br />
+ /// This is expressed in unit coordinates, such that (0.0, 0.0, 0.5) is the top-left corner of the view, and (1.0, 1.0, 0.5) is the bottom-right corner.<br />
+ /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
+ /// A view position is the distance between its parent-origin and this anchor-point.<br />
+ /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
+ /// <pre>The view has been initialized.</pre>
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Position PivotPoint
+ {
+ get
+ {
+ return (Position)GetValue(PivotPointProperty);
+ }
+ set
+ {
+ SetValue(PivotPointProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the size width of the view.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float SizeWidth
+ {
+ get
+ {
+ return (float)GetValue(SizeWidthProperty);
+ }
+ set
+ {
+ SetValue(SizeWidthProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the size height of the view.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float SizeHeight
+ {
+ get
+ {
+ return (float)GetValue(SizeHeightProperty);
+ }
+ set
+ {
+ SetValue(SizeHeightProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the position of the view.<br />
+ /// By default, sets the position vector between the parent origin and pivot point (default).<br />
+ /// If the position inheritance is disabled, sets the world position.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Position Position
+ {
+ get
+ {
+ return (Position)GetValue(PositionProperty);
+ }
+ set
+ {
+ SetValue(PositionProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the position X of the view.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float PositionX
+ {
+ get
+ {
+ return (float)GetValue(PositionXProperty);
+ }
+ set
+ {
+ SetValue(PositionXProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the position Y of the view.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float PositionY
+ {
+ get
+ {
+ return (float)GetValue(PositionYProperty);
+ }
+ set
+ {
+ SetValue(PositionYProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the position Z of the view.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float PositionZ
+ {
+ get
+ {
+ return (float)GetValue(PositionZProperty);
+ }
+ set
+ {
+ SetValue(PositionZProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the world position of the view.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector3 WorldPosition
+ {
+ get
+ {
+ return view.WorldPosition;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the orientation of the view.<br />
+ /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
+ /// </summary>
+ /// <remarks>This is an asynchronous method.</remarks>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Rotation Orientation
+ {
+ get
+ {
+ return (Rotation)GetValue(OrientationProperty);
+ }
+ set
+ {
+ SetValue(OrientationProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the world orientation of the view.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Rotation WorldOrientation
+ {
+ get
+ {
+ return view.WorldOrientation;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the scale factor applied to the view.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector3 Scale
+ {
+ get
+ {
+ return (Vector3)GetValue(ScaleProperty);
+ }
+ set
+ {
+ SetValue(ScaleProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the scale X factor applied to the view.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float ScaleX
+ {
+ get
+ {
+ return (float)GetValue(ScaleXProperty);
+ }
+ set
+ {
+ SetValue(ScaleXProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the scale Y factor applied to the view.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float ScaleY
+ {
+ get
+ {
+ return (float)GetValue(ScaleYProperty);
+ }
+ set
+ {
+ SetValue(ScaleYProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the scale Z factor applied to the view.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float ScaleZ
+ {
+ get
+ {
+ return (float)GetValue(ScaleZProperty);
+ }
+ set
+ {
+ SetValue(ScaleZProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets the world scale of the view.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector3 WorldScale
+ {
+ get
+ {
+ return view.WorldScale;
+ }
+ }
+
+ /// <summary>
+ /// Retrieves the visibility flag of the view.
+ /// </summary>
+ /// <remarks>
+ /// If the view is not visible, then the view and its children will not be rendered.
+ /// This is regardless of the individual visibility values of the children, i.e., the view will only be rendered if all of its parents have visibility set to true.
+ /// </remarks>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool Visibility
+ {
+ get
+ {
+ return view.Visibility;
+ }
+ }
+
+ /// <summary>
+ /// Gets the view's world color.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector4 WorldColor
+ {
+ get
+ {
+ return view.WorldColor;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the view's name.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string Name
+ {
+ get
+ {
+ return (string)GetValue(NameProperty);
+ }
+ set
+ {
+ SetValue(NameProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Get the number of children held by the view.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new uint ChildCount
+ {
+ get
+ {
+ return GetChildCount();
+ }
+ }
+
+ /// <summary>
+ /// Gets the view's ID.
+ /// Readonly
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public uint ID
+ {
+ get
+ {
+ return view.ID;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the status of whether the view should emit touch or hover signals.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool Sensitive
+ {
+ get
+ {
+ return (bool)GetValue(SensitiveProperty);
+ }
+ set
+ {
+ SetValue(SensitiveProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the status of whether the view should receive a notification when touch or hover motion events leave the boundary of the view.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool LeaveRequired
+ {
+ get
+ {
+ return (bool)GetValue(LeaveRequiredProperty);
+ }
+ set
+ {
+ SetValue(LeaveRequiredProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the status of whether a child view inherits it's parent's orientation.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool InheritOrientation
+ {
+ get
+ {
+ return (bool)GetValue(InheritOrientationProperty);
+ }
+ set
+ {
+ SetValue(InheritOrientationProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the status of whether a child view inherits it's parent's scale.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool InheritScale
+ {
+ get
+ {
+ return (bool)GetValue(InheritScaleProperty);
+ }
+ set
+ {
+ SetValue(InheritScaleProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the status of how the view and its children should be drawn.<br />
+ /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
+ /// If an object is in a 3D layer, it will be depth-tested against other objects in the world, i.e., it may be obscured if other objects are in front.<br />
+ /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
+ /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
+ /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public DrawModeType DrawMode
+ {
+ get
+ {
+ return (DrawModeType)GetValue(DrawModeProperty);
+ }
+ set
+ {
+ SetValue(DrawModeProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the relative to parent size factor of the view.<br />
+ /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
+ /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector3 SizeModeFactor
+ {
+ get
+ {
+ return (Vector3)GetValue(SizeModeFactorProperty);
+ }
+ set
+ {
+ SetValue(SizeModeFactorProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the width resize policy to be used.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ResizePolicyType WidthResizePolicy
+ {
+ get
+ {
+ return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
+ }
+ set
+ {
+ SetValue(WidthResizePolicyProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the height resize policy to be used.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ResizePolicyType HeightResizePolicy
+ {
+ get
+ {
+ return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
+ }
+ set
+ {
+ SetValue(HeightResizePolicyProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the policy to use when setting size with size negotiation.<br />
+ /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public SizeScalePolicyType SizeScalePolicy
+ {
+ get
+ {
+ return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
+ }
+ set
+ {
+ SetValue(SizeScalePolicyProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the status of whether the width size is dependent on the height size.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool WidthForHeight
+ {
+ get
+ {
+ return (bool)GetValue(WidthForHeightProperty);
+ }
+ set
+ {
+ SetValue(WidthForHeightProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the status of whether the height size is dependent on the width size.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool HeightForWidth
+ {
+ get
+ {
+ return (bool)GetValue(HeightForWidthProperty);
+ }
+ set
+ {
+ SetValue(HeightForWidthProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the padding for use in layout.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Extents Padding
+ {
+ get
+ {
+ return (Extents)GetValue(PaddingProperty);
+ }
+ set
+ {
+ SetValue(PaddingProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the minimum size the view can be assigned in size negotiation.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Size2D MinimumSize
+ {
+ get
+ {
+ return (Size2D)GetValue(MinimumSizeProperty);
+ }
+ set
+ {
+ SetValue(MinimumSizeProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the maximum size the view can be assigned in size negotiation.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Size2D MaximumSize
+ {
+ get
+ {
+ return (Size2D)GetValue(MaximumSizeProperty);
+ }
+ set
+ {
+ // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
+ // MATCH_PARENT spec + parent container size can be used to limit
+ SetValue(MaximumSizeProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets whether a child view inherits it's parent's position.<br />
+ /// Default is to inherit.<br />
+ /// Switching this off means that using position sets the view's world position, i.e., translates from the world origin (0,0,0) to the pivot point of the view.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool InheritPosition
+ {
+ get
+ {
+ return (bool)GetValue(InheritPositionProperty);
+ }
+ set
+ {
+ SetValue(InheritPositionProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the clipping behavior (mode) of it's children.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ClippingModeType ClippingMode
+ {
+ get
+ {
+ return (ClippingModeType)GetValue(ClippingModeProperty);
+ }
+ set
+ {
+ SetValue(ClippingModeProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets the number of renderers held by the view.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public uint RendererCount
+ {
+ get
+ {
+ return view.RendererCount;
+ }
+ }
+
+ /// <summary>
+ /// [Obsolete("Please do not use! this will be deprecated")]
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// Please do not use! this will be deprecated!
+ /// Instead please use PivotPoint.
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [Obsolete("Please do not use! This will be deprecated! Please use PivotPoint instead! " +
+ "Like: " +
+ "View view = new View(); " +
+ "view.PivotPoint = PivotPoint.Center; " +
+ "view.PositionUsesPivotPoint = true;")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Position AnchorPoint
+ {
+ get
+ {
+ return view.AnchorPoint;
+ }
+ set
+ {
+ view.AnchorPoint = value;
+ }
+ }
+
+ /// <summary>
+ /// Sets the size of a view for the width, the height and the depth.<br />
+ /// Geometry can be scaled to fit within this area.<br />
+ /// This does not interfere with the view's scale factor.<br />
+ /// The views default depth is the minimum of width and height.<br />
+ /// </summary>
+ /// <remarks>
+ /// Please note that multi-cascade setting is not possible for this NUI object. <br />
+ /// It is recommended that NUI object typed properties are configured by their constructor with parameters. <br />
+ /// For example, this code is working fine : view.Size = new Size( 1.0f, 1.0f, 0.0f); <br />
+ /// but this will not work! : view.Size.Width = 2.0f; view.Size.Height = 2.0f; <br />
+ /// It may not match the current value in some cases, i.e. when the animation is progressing or the maximum or minimu size is set. <br />
+ /// </remarks>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Size Size
+ {
+ get
+ {
+ return (Size)GetValue(SizeProperty);
+ }
+ set
+ {
+ SetValue(SizeProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// "Please DO NOT use! This will be deprecated! Please use 'Container GetParent() for derived class' instead!"
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [Obsolete("Please do not use! This will be deprecated! Please use 'Container GetParent() for derived class' instead! " +
+ "Like: " +
+ "Container parent = view.GetParent(); " +
+ "View view = parent as View;")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new View Parent
+ {
+ get
+ {
+ return BaseHandle.GetHandle(view.Parent) as View;
+ }
+ }
+
+ /// <summary>
+ /// Gets/Sets whether inherit parent's the layout Direction.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool InheritLayoutDirection
+ {
+ get
+ {
+ return (bool)GetValue(InheritLayoutDirectionProperty);
+ }
+ set
+ {
+ SetValue(InheritLayoutDirectionProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets/Sets the layout Direction.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Tizen.NUI.BaseComponents.ViewLayoutDirectionType LayoutDirection
+ {
+ get
+ {
+ return (Tizen.NUI.BaseComponents.ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
+ }
+ set
+ {
+ SetValue(LayoutDirectionProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the Margin for use in layout.
+ /// </summary>
+ /// <remarks>
+ /// Margin property is supported by Layout algorithms and containers.
+ /// Please Set Layout if you want to use Margin property.
+ /// </remarks>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Extents Margin
+ {
+ get
+ {
+ return (Extents)GetValue(MarginProperty);
+ }
+ set
+ {
+ SetValue(MarginProperty, value);
+ }
+ }
+
+ private MergedStyle _mergedStyle = null;
+ internal MergedStyle mergedStyle
+ {
+ get
+ {
+ if (_mergedStyle == null)
+ {
+ _mergedStyle = new MergedStyle(GetType(), this);
+ }
+
+ return _mergedStyle;
+ }
+ }
+
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Style Style
+ {
+ get
+ {
+ return (Style)GetValue(StyleProperty);
+ }
+ set
+ {
+ SetValue(StyleProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// [Obsolete("Please do not use! this will be deprecated")]
+ /// </summary>
+ /// Please do not use! this will be deprecated!
+ /// Instead please use Padding.
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [Obsolete("Please do not use! this will be deprecated, instead please use Padding.")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Extents PaddingEX
+ {
+ get
+ {
+ return view.PaddingEX;
+ }
+ set
+ {
+ view.PaddingEX = value;
+ }
+ }
+
+ /// <summary>
+ /// Perform an action on a visual registered to this view. <br />
+ /// Visuals will have actions. This API is used to perform one of these actions with the given attributes.
+ /// </summary>
+ /// <param name="propertyIndexOfVisual">The Property index of the visual.</param>
+ /// <param name="propertyIndexOfActionId">The action to perform. See Visual to find the supported actions.</param>
+ /// <param name="attributes">Optional attributes for the action.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void DoAction(int propertyIndexOfVisual, int propertyIndexOfActionId, PropertyValue attributes)
+ {
+ view.DoAction(propertyIndexOfVisual, propertyIndexOfActionId, attributes);
+ }
+ }
+}
--- /dev/null
+// Copyright (c) 2017 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.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+using System;
+using System.Text;
+using System.Runtime.InteropServices;
+using System.Collections.Generic;
+using System.Linq;
+using System.ComponentModel;
+
+namespace Tizen.NUI.Xaml.Forms.BaseComponents
+{
+ /// <summary>
+ /// A visual view control if a user adds any visual to it.
+ /// </summary>
+ /// <example>
+ /// Example:
+ /// <code>
+ /// VisualView _visualView = new VisualView();
+ /// ImageVisualMap imageVisualMap1 = new ImageVisualMap();
+ /// imageVisualMap1.URL = "./NUISample/res/images/image-1.jpg";
+ /// imageVisualMap1.VisualSize = new Vector2( 300.0f, 300.0f );
+ /// imageVisualMap1.Offset = new Vector2( 50.0f, 50.0f );
+ /// imageVisualMap1.OffsetSizeMode = new Vector4( 1.0f, 1.0f, 1.0f, 1.0f );
+ /// imageVisualMap1.Origin = AlignType.TOP_BEGIN;
+ /// imageVisualMap1.AnchorPoint = AlignType.TOP_BEGIN;
+ /// _visualView.AddVisual("imageVisual1", imageVisualMap1);
+ /// </code>
+ /// </example>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class VisualView : CustomView
+ {
+ private Tizen.NUI.BaseComponents.VisualView _visualView;
+ internal Tizen.NUI.BaseComponents.VisualView visualView
+ {
+ get
+ {
+ if (null == _visualView)
+ {
+ _visualView = handleInstance as Tizen.NUI.BaseComponents.VisualView;
+ }
+
+ return _visualView;
+ }
+ }
+
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public VisualView() : base(typeof(VisualView).FullName, CustomViewBehaviour.ViewBehaviourDefault | CustomViewBehaviour.RequiresTouchEventsSupport)
+ {
+ }
+
+ /// <summary>
+ /// Gets the total number of visuals which are added by users.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int NumberOfVisuals
+ {
+ get
+ {
+ return visualView.NumberOfVisuals;
+ }
+ }
+
+ /// <summary>
+ /// Adds or updates a visual to visual view.
+ /// </summary>
+ /// <param name="visualName">The name of a visual to add. If a name is added to an existing visual name, the visual will be replaced.</param>
+ /// <param name="visualMap">The property map of a visual to create.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void AddVisual(string visualName, VisualMap visualMap)
+ {
+ visualView.AddVisual(visualName, visualMap);
+ }
+
+ /// <summary>
+ /// Removes a visual by name.
+ /// </summary>
+ /// <param name="visualName">The name of a visual to remove.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void RemoveVisual(string visualName)
+ {
+ visualView.RemoveVisual(visualName);
+ }
+
+ /// <summary>
+ /// Removes all visuals of the visual view.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void RemoveAll()
+ {
+ visualView.RemoveAll();
+ }
+
+ /// <summary>
+ /// Overrides the method of OnRelayout() for CustomView class.<br />
+ /// Called after the size negotiation has been finished for this control.<br />
+ /// The control is expected to assign this given size to itself or its children.<br />
+ /// Should be overridden by derived classes if they need to layout actors differently after certain operations like add or remove actors, resize, or after changing specific properties.<br />
+ /// </summary>
+ /// <remarks>As this function is called from inside the size negotiation algorithm, you cannot call RequestRelayout (the call would just be ignored).</remarks>
+ /// <param name="size">The allocated size.</param>
+ /// <param name="container">The control should add actors to this container that it is not able to allocate a size for.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override void OnRelayout(Vector2 size, RelayoutContainer container)
+ {
+ visualView.OnRelayout(size, container);
+ }
+
+ /// <summary>
+ /// Creates a visual animation (transition) with the input parameters.
+ /// </summary>
+ /// <param name="target">The visual map to animation.</param>
+ /// <param name="property">The property of visual to animation.</param>
+ /// <param name="destinationValue">The destination value of property after animation.</param>
+ /// <param name="startTime">The start time of visual animation.</param>
+ /// <param name="endTime">The end time of visual animation.</param>
+ /// <param name="alphaFunction">The alpha function of visual animation.</param>
+ /// <param name="initialValue">The initial property value of visual animation.</param>
+ /// <returns>Animation instance</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Animation AnimateVisual(VisualMap target, string property, object destinationValue, int startTime, int endTime, AlphaFunction.BuiltinFunctions? alphaFunction = null, object initialValue = null)
+ {
+ return visualView.AnimateVisual(target, property, destinationValue, startTime, endTime, alphaFunction, initialValue);
+ }
+
+ /// <summary>
+ /// Adds a group visual animation (transition) map with the input parameters.
+ /// </summary>
+ /// <param name="target">The visual map to animation.</param>
+ /// <param name="property">The property of visual to animation.</param>
+ /// <param name="destinationValue">The destination value of property after animation.</param>
+ /// <param name="startTime">The start time of visual animation.</param>
+ /// <param name="endTime">The end time of visual animation.</param>
+ /// <param name="alphaFunction">The alpha function of visual animation.</param>
+ /// <param name="initialValue">The initial property value of visual animation.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void AnimateVisualAdd(VisualMap target, string property, object destinationValue, int startTime, int endTime, AlphaFunction.BuiltinFunctions? alphaFunction = null, object initialValue = null)
+ {
+ visualView.AnimateVisualAdd(target, property, destinationValue, startTime, endTime, alphaFunction, initialValue);
+ }
+
+ /// <summary>
+ /// Finishes to add a visual animation (transition) map and creates a transition animation.
+ /// </summary>
+ /// <returns>Animation instance.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Animation AnimateVisualAddFinish()
+ {
+ return visualView.AnimateVisualAddFinish();
+ }
+
+ /// <summary>
+ /// temporary fix to pass TCT.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Animation VisualAnimate(Tizen.NUI.VisualAnimator visualMap)
+ {
+ return visualView.VisualAnimate(visualMap);
+ }
+ //temporary fix to pass TCT
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright(c) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using Tizen.NUI;
+using Tizen.NUI.XamlBinding;
+
+namespace Tizen.NUI.Xaml.Forms
+{
+ /// <summary>
+ /// BaseHandle is a handle to an internal Dali resource.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class BaseHandle : Element, global::System.IDisposable
+ {
+ static private Dictionary<Tizen.NUI.BaseHandle, BaseHandle> nuiInstanceToInstanceDict = new Dictionary<Tizen.NUI.BaseHandle, BaseHandle>();
+
+ /// <summary>
+ /// Get Xaml handle by nui handle.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ static public BaseHandle GetHandle(Tizen.NUI.BaseHandle nuiInstance)
+ {
+ BaseHandle ret;
+ nuiInstanceToInstanceDict.TryGetValue(nuiInstance, out ret);
+
+ return ret;
+ }
+
+ static private void RemoveHandle(Tizen.NUI.BaseHandle nuiInstance)
+ {
+ nuiInstanceToInstanceDict.Remove(nuiInstance);
+ }
+
+ private Tizen.NUI.BaseHandle handle;
+
+ /// <summary>
+ /// Get nui handle.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Tizen.NUI.BaseHandle handleInstance
+ {
+ get
+ {
+ return handle;
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected void SetNUIInstance(Tizen.NUI.BaseHandle _handle)
+ {
+ if (handle != _handle)
+ {
+ handle = _handle;
+
+ if (null != handle)
+ {
+ nuiInstanceToInstanceDict.Add(handle, this);
+ }
+ }
+ }
+
+ internal BaseHandle(Tizen.NUI.BaseHandle nuiInstance)
+ {
+ SetNUIInstance(nuiInstance);
+ }
+
+ /// <summary>
+ /// Event when a property is set.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event PropertyChangedEventHandler PropertySet
+ {
+ add
+ {
+ handle.PropertySet += value;
+ }
+ remove
+ {
+ handle.PropertySet -= value;
+ }
+ }
+
+ /// <summary>
+ /// Returns the bool value true to indicate that an operand is true and returns false otherwise.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static bool operator true(BaseHandle handle)
+ {
+ if (BaseHandle.ReferenceEquals(handle, null))
+ {
+ return false;
+ }
+ else
+ {
+ return handle.handle.HasBody();
+ }
+ }
+
+ /// <summary>
+ /// Returns the bool false to indicate that an operand is false and returns true otherwise.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static bool operator false(BaseHandle handle)
+ {
+ if (BaseHandle.ReferenceEquals(handle, null))
+ {
+ return true;
+ }
+ else
+ {
+ return !handle.handle.HasBody();
+ }
+ }
+
+ /// <summary>
+ /// Explicit conversion from Handle to bool.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static explicit operator bool(BaseHandle handle)
+ {
+ if (BaseHandle.ReferenceEquals(handle, null))
+ {
+ return false;
+ }
+ else
+ {
+ return handle.handle.HasBody();
+ }
+ }
+
+ /// <summary>
+ /// Equality operator
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static bool operator ==(BaseHandle x, BaseHandle y)
+ {
+ if (BaseHandle.ReferenceEquals(x, null) && BaseHandle.ReferenceEquals(y, null))
+ {
+ return true;
+ }
+ else if (BaseHandle.ReferenceEquals(x, null) || BaseHandle.ReferenceEquals(y, null))
+ {
+ return false;
+ }
+ else
+ {
+ return x.handle == y.handle;
+ }
+ }
+
+ /// <summary>
+ /// Inequality operator. Returns Null if either operand is Null
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static bool operator !=(BaseHandle x, BaseHandle y)
+ {
+ return !(x == y);
+ }
+
+ /// <summary>
+ /// Logical AND operator.<br />
+ /// It's possible when doing a operator this function (opBitwiseAnd) is never called due to short circuiting.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static BaseHandle operator &(BaseHandle x, BaseHandle y)
+ {
+ if (x == y)
+ {
+ return x;
+ }
+ return null;
+ }
+
+ /// <summary>
+ /// Logical OR operator for ||.<br />
+ /// It's possible when doing a || this function (opBitwiseOr) is never called due to short circuiting.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static BaseHandle operator |(BaseHandle x, BaseHandle y)
+ {
+ if (!BaseHandle.ReferenceEquals(x, null) || !BaseHandle.ReferenceEquals(y, null))
+ {
+ if (x.HasBody())
+ {
+ return x;
+ }
+ if (y.HasBody())
+ {
+ return y;
+ }
+ return null;
+ }
+ return null;
+ }
+
+ /// <summary>
+ /// Logical ! operator
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static bool operator !(BaseHandle x)
+ {
+ // if the C# object is null, return true
+ if (BaseHandle.ReferenceEquals(x, null))
+ {
+ return true;
+ }
+ if (x.HasBody())
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /// <summary>
+ /// Equals
+ /// </summary>
+ /// <param name="o">The object should be compared.</param>
+ /// <returns>True if equal.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object o)
+ {
+ return base.Equals(o);
+ }
+
+ /// <summary>
+ /// Gets the the hash code of this baseHandle.
+ /// </summary>
+ /// <returns>The hash code.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+
+ /// <summary>
+ /// Dispose.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Dispose()
+ {
+ BaseHandle.RemoveHandle(handle);
+ handle.Dispose();
+ }
+
+ /// <summary>
+ /// Performs an action on this object with the given action name and attributes.
+ /// </summary>
+ /// <param name="actionName">The command for the action.</param>
+ /// <param name="attributes">The list of attributes for the action.</param>
+ /// <returns>The action is performed by the object or not.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool DoAction(string actionName, PropertyMap attributes)
+ {
+ return handle.DoAction(actionName, attributes);
+ }
+
+ /// <summary>
+ /// Returns the type name for the Handle.<br />
+ /// Will return an empty string if the typename does not exist. This will happen for types that
+ /// have not registered with type-registry.
+ /// </summary>
+ /// <returns>The type name. Empty string if the typename does not exist.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string GetTypeName()
+ {
+ return handle.GetTypeName();
+ }
+
+ /// <summary>
+ /// Returns the type info for the Handle.<br />
+ /// </summary>
+ /// <param name="info">The type information.</param>
+ /// <returns>True If get the type info.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool GetTypeInfo(TypeInfo info)
+ {
+ return handle.GetTypeInfo(info);
+ }
+
+ /// <summary>
+ /// Resets the handle.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Reset()
+ {
+ handle.Reset();
+ }
+
+ /// <summary>
+ /// To check the BaseHandle instance is equal or not.
+ /// </summary>
+ /// <param name="rhs">The baseHandle instance.</param>
+ /// <returns>True If equal.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool EqualTo(BaseHandle rhs)
+ {
+ return handle.EqualTo(rhs.handle);
+ }
+
+ /// <summary>
+ /// To check the BaseHandle instance is equal or not.
+ /// </summary>
+ /// <param name="rhs">The baseHandle instance.</param>
+ /// <returns>True If not equal.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool NotEqualTo(BaseHandle rhs)
+ {
+ return handle.NotEqualTo(rhs.handle);
+ }
+
+ /// <summary>
+ /// To check the BaseHandle instance has body or not.
+ /// </summary>
+ /// <returns>True If the baseHandle instance has body.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool HasBody()
+ {
+ if (BaseHandle.ReferenceEquals(handle, null))
+ {
+ return false;
+ }
+ else
+ {
+ return handle.HasBody();
+ }
+ }
+
+ /// <summary>
+ /// To check the BaseHandle instance is equal or not.
+ /// </summary>
+ /// <param name="rhs">The baseHandle instance.</param>
+ /// <returns>True If equal.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool IsEqual(BaseHandle rhs)
+ {
+ return handle.IsEqual(rhs.handle);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using Tizen.NUI.Xaml.Forms.BaseComponents;
+using Tizen.NUI.XamlBinding;
+using System.ComponentModel;
+
+namespace Tizen.NUI.Xaml.Forms
+{
+ /// <summary>
+ /// The Container is an abstract class to be inherited from by classes that desire to have views
+ /// added to them.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [ContentProperty("Children")]
+ public abstract class Container : BaseHandle
+ {
+ private Tizen.NUI.Container instance;
+
+ internal Container(Tizen.NUI.Container nuiInstance) : base(nuiInstance)
+ {
+ instance = nuiInstance;
+ SetNUIInstance(nuiInstance);
+ }
+
+ /// <summary>
+ /// Gets the parent container.
+ /// Read only
+ /// </summary>
+ /// <pre>The child container has been initialized.</pre>
+ /// <returns>The parent container.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new Container Parent
+ {
+ get
+ {
+ return GetParent();
+ }
+ }
+
+ /// <summary>
+ /// Gets the number of children for this container.
+ /// Read only
+ /// </summary>
+ /// <pre>The container has been initialized.</pre>
+ /// <returns>The number of children.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public uint ChildCount
+ {
+ get
+ {
+ return GetChildCount();
+ }
+ }
+
+ /// <summary>
+ /// Adds a child view to this Container.
+ /// </summary>
+ /// <pre>This Container (the parent) has been initialized. The child view has been initialized. The child view is not the same as the parent view.</pre>
+ /// <post>The child will be referenced by its parent. This means that the child will be kept alive, even if the handle passed into this method is reset or destroyed.</post>
+ /// <remarks>If the child already has a parent, it will be removed from the old parent and reparented to this view. This may change child's position, color, scale, etc. as it now inherits them from this view.</remarks>
+ /// <param name="view">The child view to add.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public abstract void Add(View view);
+
+ /// <summary>
+ /// Removes a child view from this view. If the view was not a child of this view, this is a no-op.
+ /// </summary>
+ /// <pre>This View(the parent) has been initialized. The child view is not the same as the parent view.</pre>
+ /// <param name="view">The view to remove</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public abstract void Remove(View view);
+
+ /// <summary>
+ /// Retrieves the child view by the index.
+ /// </summary>
+ /// <pre>The view has been initialized.</pre>
+ /// <param name="index">The index of the child to retrieve.</param>
+ /// <returns>The view for the given index or empty handle if children are not initialized.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public abstract View GetChildAt(uint index);
+
+ /// <summary>
+ /// Gets the parent of this container.
+ /// </summary>
+ /// <pre>The child container has been initialized.</pre>
+ /// <returns>The parent container.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public abstract Container GetParent();
+
+ /// <summary>
+ /// Gets the number of children for this container.
+ /// </summary>
+ /// <pre>The container has been initialized.</pre>
+ /// <returns>The number of children.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public abstract UInt32 GetChildCount();
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public List<View> Children
+ {
+ get
+ {
+ List<View> children = new List<View>();
+
+ foreach (Tizen.NUI.BaseComponents.View view in instance.Children)
+ {
+ View realView = BaseHandle.GetHandle(view) as View;
+ children.Add(realView);
+ }
+
+ return children;
+ }
+ }
+ }
+} // namespace Tizen.NUI
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System;
+using Tizen.NUI.Xaml.Forms.BaseComponents;
+using System.ComponentModel;
+using Tizen.NUI;
+
+namespace Tizen.NUI.Xaml.Forms
+{
+ /// <summary>
+ /// Layers provide a mechanism for overlaying groups of actors on top of each other.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class Layer : Container
+ {
+ private Tizen.NUI.Layer _layer;
+ private Tizen.NUI.Layer layer
+ {
+ get
+ {
+ if (null == _layer)
+ {
+ _layer = handleInstance as Tizen.NUI.Layer;
+ }
+
+ return _layer;
+ }
+ }
+
+ /// <summary>
+ /// Creates a Xaml Layer object.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Layer() : this(new Tizen.NUI.Layer())
+ {
+ }
+
+ internal Layer(Tizen.NUI.Layer nuiInstance) : base(nuiInstance)
+ {
+ SetNUIInstance(nuiInstance);
+ }
+
+ /// <summary>
+ /// Layer behavior, type String (Layer.LayerBehavior).
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Tizen.NUI.Layer.LayerBehavior Behavior
+ {
+ get
+ {
+ return layer.Behavior;
+ }
+ set
+ {
+ layer.Behavior = value;
+ }
+ }
+
+ /// <summary>
+ /// Sets the viewport (in window coordinates), type rectangle.
+ /// The contents of the layer will not be visible outside this box, when ViewportEnabled is true.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Rectangle Viewport
+ {
+ get
+ {
+ return layer.Viewport;
+ }
+ set
+ {
+ layer.Viewport = value;
+ }
+ }
+
+ /// <summary>
+ /// Retrieves and sets the layer's opacity.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float Opacity
+ {
+ get
+ {
+ return layer.Opacity;
+ }
+ set
+ {
+ layer.Opacity = value;
+ }
+ }
+
+ /// <summary>
+ /// Retrieves and sets the layer's visibility.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool Visibility
+ {
+ get
+ {
+ return layer.Visibility;
+ }
+ set
+ {
+ layer.Visibility = value;
+ }
+ }
+
+ /// <summary>
+ /// Get the number of children held by the layer.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new uint ChildCount
+ {
+ get
+ {
+ return Convert.ToUInt32(layer.Children.Count);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the layer's name.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string Name
+ {
+ get
+ {
+ return layer.Name;
+ }
+ set
+ {
+ layer.Name = value;
+ }
+ }
+
+ /// <summary>
+ /// Queries the depth of the layer.<br />
+ /// 0 is the bottommost layer, higher number is on the top.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public uint Depth
+ {
+ get
+ {
+ return layer.Depth;
+ }
+ }
+
+ /// From the Container base class.
+
+ /// <summary>
+ /// Adds a child view to this layer.
+ /// </summary>
+ /// <seealso cref="Container.Add">
+ /// </seealso>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override void Add(View child)
+ {
+ layer.Add(child.view);
+ }
+
+ /// <summary>
+ /// Removes a child view from this layer. If the view was not a child of this layer, this is a no-op.
+ /// </summary>
+ /// <seealso cref="Container.Remove">
+ /// </seealso>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override void Remove(View child)
+ {
+ layer.Remove(child.view);
+ }
+
+ /// <summary>
+ /// Retrieves a child view by the index.
+ /// </summary>
+ /// <pre>The view has been initialized.</pre>
+ /// <param name="index">The index of the child to retrieve.</param>
+ /// <returns>The view for the given index or empty handle if children not initialized.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override View GetChildAt(uint index)
+ {
+ Tizen.NUI.BaseComponents.View ret = layer.GetChildAt(index);
+ return BaseHandle.GetHandle(ret) as View;
+ }
+
+ /// <summary>
+ /// Get parent of the layer.
+ /// </summary>
+ /// <returns>The view's container</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Container GetParent()
+ {
+ return null;
+ }
+
+ /// <summary>
+ /// Get the child count of the layer.
+ /// </summary>
+ /// <returns>The child count of the layer.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override uint GetChildCount()
+ {
+ return Convert.ToUInt32(layer.Children.Count);
+ }
+
+ /// <summary>
+ /// Downcasts a handle to layer handle.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// Please do not use! this will be deprecated!
+ /// Instead please use as keyword.
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [Obsolete("Please do not use! This will be deprecated! Please use as keyword instead!")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static Layer DownCast(BaseHandle handle)
+ {
+ Tizen.NUI.Layer ret = Tizen.NUI.Layer.DownCast(handle.handleInstance);
+ return BaseHandle.GetHandle(ret) as Layer;
+ }
+
+ /// <summary>
+ /// Search through this layer's hierarchy for a view with the given unique ID.
+ /// </summary>
+ /// <pre>This layer (the parent) has been initialized.</pre>
+ /// <remarks>The actor itself is also considered in the search.</remarks>
+ /// <param name="id">The id of the child to find</param>
+ /// <returns> A handle to the view if found, or an empty handle if not. </returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public View FindChildById(uint id)
+ {
+ Tizen.NUI.BaseComponents.View ret = layer.FindChildById(id);
+ return BaseHandle.GetHandle(ret) as View;
+ }
+
+ /// <summary>
+ /// Increments the depth of the layer.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Raise()
+ {
+ layer.Raise();
+ }
+
+ /// <summary>
+ /// Decrements the depth of the layer.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Lower()
+ {
+ layer.Lower();
+ }
+
+ /// <summary>
+ /// Raises the layer to the top.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void RaiseToTop()
+ {
+ layer.RaiseToTop();
+ }
+
+ /// <summary>
+ /// Lowers the layer to the bottom.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void LowerToBottom()
+ {
+ layer.LowerToBottom();
+ }
+
+ /// <summary>
+ /// Moves the layer directly above the given layer.<br />
+ /// After the call, this layer's depth will be immediately above target.<br />
+ /// </summary>
+ /// <param name="target">The layer to get on top of.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void MoveAbove(Layer target)
+ {
+ layer.MoveAbove(target.layer);
+ }
+
+ /// <summary>
+ /// Moves the layer directly below the given layer.<br />
+ /// After the call, this layer's depth will be immediately below target.<br />
+ /// </summary>
+ /// <param name="target">The layer to get below of.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void MoveBelow(Layer target)
+ {
+ layer.MoveBelow(target.layer);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright(c) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System;
+using System.ComponentModel;
+using System.Runtime.InteropServices;
+using Tizen.NUI;
+using Tizen.NUI.XamlBinding;
+using static Tizen.NUI.UIComponents.Button;
+
+namespace Tizen.NUI.Xaml.UIComponents
+{
+ /// <summary>
+ /// The Button class is a base class for different kinds of buttons.<br />
+ /// This class provides the disabled property and the clicked signal.<br />
+ /// The clicked event handler is emitted when the button is touched, and the touch point doesn't leave the boundary of the button.<br />
+ /// When the disabled property is set to true, no signal is emitted.<br />
+ /// The 'Visual' describes not just traditional images like PNG and BMP, but also refers to whatever is used to show the button. It could be a color, gradient, or some other kind of renderer.<br />
+ /// The button's appearance can be modified by setting properties for the various visuals or images.<br />
+ /// It is not mandatory to set all the visuals. A button could be defined only by setting its background visual, or by setting its background and selected visuals.<br />
+ /// The button visual is shown over the background visual.<br />
+ /// When pressed, the unselected visuals are replaced by the selected visuals.<br />
+ /// The text label is always placed on the top of all images.<br />
+ /// When the button is disabled, the background button and the selected visuals are replaced by their disabled visuals.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class Button : Tizen.NUI.Xaml.Forms.BaseComponents.View
+ {
+ private Tizen.NUI.UIComponents.Button _button;
+ internal Tizen.NUI.UIComponents.Button button
+ {
+ get
+ {
+ if (null == _button)
+ {
+ _button = handleInstance as Tizen.NUI.UIComponents.Button;
+ }
+
+ return _button;
+ }
+ }
+
+ /// <summary>
+ /// Creates an uninitialized button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Button() : this(new Tizen.NUI.UIComponents.Button())
+ {
+ }
+
+ internal Button(Tizen.NUI.UIComponents.Button nuiInstance) : base(nuiInstance)
+ {
+ SetNUIInstance(nuiInstance);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty UnselectedVisualProperty = BindableProperty.Create("UnselectedVisual", typeof(PropertyMap), typeof(Button), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var button = ((Button)bindable).button;
+ button.UnselectedVisual = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var button = ((Button)bindable).button;
+ return button.UnselectedVisual;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SelectedVisualProperty = BindableProperty.Create("SelectedVisual", typeof(PropertyMap), typeof(Button), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var button = ((Button)bindable).button;
+ button.SelectedVisual = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var button = ((Button)bindable).button;
+ return button.SelectedVisual;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty DisabledSelectedVisualProperty = BindableProperty.Create("DisabledSelectedVisual", typeof(PropertyMap), typeof(Button), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var button = ((Button)bindable).button;
+ button.DisabledSelectedVisual = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var button = ((Button)bindable).button;
+ return button.DisabledSelectedVisual;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty DisabledUnselectedVisualProperty = BindableProperty.Create("DisabledUnselectedVisual", typeof(PropertyMap), typeof(Button), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var button = ((Button)bindable).button;
+ button.DisabledUnselectedVisual = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var button = ((Button)bindable).button;
+ return button.DisabledUnselectedVisual;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty UnselectedBackgroundVisualProperty = BindableProperty.Create("UnselectedBackgroundVisual", typeof(PropertyMap), typeof(Button), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var button = ((Button)bindable).button;
+ button.UnselectedBackgroundVisual = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var button = ((Button)bindable).button;
+ return button.UnselectedBackgroundVisual;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SelectedBackgroundVisualProperty = BindableProperty.Create("SelectedBackgroundVisual", typeof(PropertyMap), typeof(Button), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var button = ((Button)bindable).button;
+ button.SelectedBackgroundVisual = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var button = ((Button)bindable).button;
+ return button.SelectedBackgroundVisual;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty DisabledUnselectedBackgroundVisualProperty = BindableProperty.Create("DisabledUnselectedBackgroundVisual", typeof(PropertyMap), typeof(Button), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var button = ((Button)bindable).button;
+ button.DisabledUnselectedBackgroundVisual = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var button = ((Button)bindable).button;
+ return button.DisabledUnselectedBackgroundVisual;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty DisabledSelectedBackgroundVisualProperty = BindableProperty.Create("DisabledSelectedBackgroundVisual", typeof(PropertyMap), typeof(Button), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var button = ((Button)bindable).button;
+ button.DisabledSelectedBackgroundVisual = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var button = ((Button)bindable).button;
+ return button.DisabledSelectedBackgroundVisual;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty LabelRelativeAlignmentProperty = BindableProperty.Create("LabelRelativeAlignment", typeof(Align), typeof(Button), Align.End, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var button = ((Button)bindable).button;
+ button.LabelRelativeAlignment = (Align)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var button = ((Button)bindable).button;
+ return button.LabelRelativeAlignment;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty LabelPaddingProperty = BindableProperty.Create("LabelPadding", typeof(Vector4), typeof(Button), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var button = ((Button)bindable).button;
+ button.LabelPadding = (Vector4)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var button = ((Button)bindable).button;
+ return button.LabelPadding;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ForegroundVisualPaddingProperty = BindableProperty.Create("ForegroundVisualPadding", typeof(Vector4), typeof(Button), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var button = ((Button)bindable).button;
+ button.ForegroundVisualPadding = (Vector4)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var button = ((Button)bindable).button;
+ return button.ForegroundVisualPadding;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty AutoRepeatingProperty = BindableProperty.Create("AutoRepeating", typeof(bool), typeof(Button), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var button = ((Button)bindable).button;
+ button.AutoRepeating = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var button = ((Button)bindable).button;
+ return button.AutoRepeating;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty InitialAutoRepeatingDelayProperty = BindableProperty.Create("InitialAutoRepeatingDelay", typeof(float), typeof(Button), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var button = ((Button)bindable).button;
+ button.InitialAutoRepeatingDelay = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var button = ((Button)bindable).button;
+ return button.InitialAutoRepeatingDelay;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty NextAutoRepeatingDelayProperty = BindableProperty.Create("NextAutoRepeatingDelay", typeof(float), typeof(Button), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var button = ((Button)bindable).button;
+ button.NextAutoRepeatingDelay = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var button = ((Button)bindable).button;
+ return button.NextAutoRepeatingDelay;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty TogglableProperty = BindableProperty.Create("Togglable", typeof(bool), typeof(Button), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var button = ((Button)bindable).button;
+ button.Togglable = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var button = ((Button)bindable).button;
+ return button.Togglable;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SelectedProperty = BindableProperty.Create("Selected", typeof(bool), typeof(Button), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var button = ((Button)bindable).button;
+ button.Selected = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var button = ((Button)bindable).button;
+ return button.Selected;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty UnselectedColorProperty = BindableProperty.Create("UnselectedColor", typeof(Color), typeof(Button), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var button = ((Button)bindable).button;
+ button.UnselectedColor = (Color)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var button = ((Button)bindable).button;
+ return button.UnselectedColor;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SelectedColorProperty = BindableProperty.Create("SelectedColor", typeof(Color), typeof(Button), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var button = ((Button)bindable).button;
+ button.SelectedColor = (Color)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var button = ((Button)bindable).button;
+ return button.SelectedColor;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty LabelProperty = BindableProperty.Create("Label", typeof(PropertyMap), typeof(Button), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var button = ((Button)bindable).button;
+ button.Label = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var button = ((Button)bindable).button;
+ return button.Label;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty LabelTextProperty = BindableProperty.Create("LabelText", typeof(string), typeof(Button), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var button = ((Button)bindable).button;
+ button.LabelText = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var button = ((Button)bindable).button;
+ return button.LabelText;
+ });
+
+ /// <summary>
+ /// The Clicked event will be triggered when the button is touched and the touch point doesn't leave the boundary of the button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandlerWithReturnType<object, EventArgs, bool> Clicked
+ {
+ add
+ {
+ button.Clicked += value;
+ }
+
+ remove
+ {
+ button.Clicked -= value;
+ }
+ }
+
+ /// <summary>
+ /// The Pressed event will be triggered when the button is touched.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandlerWithReturnType<object, EventArgs, bool> Pressed
+ {
+ add
+ {
+ button.Pressed += value;
+ }
+
+ remove
+ {
+ button.Pressed -= value;
+ }
+ }
+
+ /// <summary>
+ /// The Released event will be triggered when the button is touched and the touch point leaves the boundary of the button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandlerWithReturnType<object, EventArgs, bool> Released
+ {
+ add
+ {
+ button.Released += value;
+ }
+
+ remove
+ {
+ button.Released -= value;
+ }
+ }
+
+ /// <summary>
+ /// The StateChanged event will be triggered when the button's state is changed.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandlerWithReturnType<object, EventArgs, bool> StateChanged
+ {
+ add
+ {
+ button.StateChanged += value;
+ }
+
+ remove
+ {
+ button.StateChanged -= value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the unselected button foreground or icon visual.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap UnselectedVisual
+ {
+ get
+ {
+ return (PropertyMap)GetValue(UnselectedVisualProperty);
+ }
+ set
+ {
+ SetValue(UnselectedVisualProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the selected button foreground or icon visual.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap SelectedVisual
+ {
+ get
+ {
+ return (PropertyMap)GetValue(SelectedVisualProperty);
+ }
+ set
+ {
+ SetValue(SelectedVisualProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the disabled selected state foreground or icon button visual.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap DisabledSelectedVisual
+ {
+ get
+ {
+ return (PropertyMap)GetValue(DisabledSelectedVisualProperty);
+ }
+ set
+ {
+ SetValue(DisabledSelectedVisualProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the disabled unselected state foreground or icon visual.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap DisabledUnselectedVisual
+ {
+ get
+ {
+ return (PropertyMap)GetValue(DisabledUnselectedVisualProperty);
+ }
+ set
+ {
+ SetValue(DisabledUnselectedVisualProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the disabled unselected state background button visual.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap UnselectedBackgroundVisual
+ {
+ get
+ {
+ return (PropertyMap)GetValue(UnselectedBackgroundVisualProperty);
+ }
+ set
+ {
+ SetValue(UnselectedBackgroundVisualProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the selected background button visual.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap SelectedBackgroundVisual
+ {
+ get
+ {
+ return (PropertyMap)GetValue(SelectedBackgroundVisualProperty);
+ }
+ set
+ {
+ SetValue(SelectedBackgroundVisualProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the disabled while unselected background button visual.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap DisabledUnselectedBackgroundVisual
+ {
+ get
+ {
+ return (PropertyMap)GetValue(DisabledUnselectedBackgroundVisualProperty);
+ }
+ set
+ {
+ SetValue(DisabledUnselectedBackgroundVisualProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the disabled while selected background button visual.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap DisabledSelectedBackgroundVisual
+ {
+ get
+ {
+ return (PropertyMap)GetValue(DisabledSelectedBackgroundVisualProperty);
+ }
+ set
+ {
+ SetValue(DisabledSelectedBackgroundVisualProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the position of the the label in relation to the foreground or icon, if both present.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Align LabelRelativeAlignment
+ {
+ get
+ {
+ return (Align)GetValue(LabelRelativeAlignmentProperty);
+ }
+ set
+ {
+ SetValue(LabelRelativeAlignmentProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the padding around the text.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector4 LabelPadding
+ {
+ get
+ {
+ return (Vector4)GetValue(LabelPaddingProperty);
+ }
+ set
+ {
+ SetValue(LabelPaddingProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the padding around the foreground visual.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector4 ForegroundVisualPadding
+ {
+ get
+ {
+ return (Vector4)GetValue(ForegroundVisualPaddingProperty);
+ }
+ set
+ {
+ SetValue(ForegroundVisualPaddingProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// If the autorepeating property is set to true, then the togglable property is set to false.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool AutoRepeating
+ {
+ get
+ {
+ return (bool)GetValue(AutoRepeatingProperty);
+ }
+ set
+ {
+ SetValue(AutoRepeatingProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// By default, this value is set to 0.15 seconds.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float InitialAutoRepeatingDelay
+ {
+ get
+ {
+ return (float)GetValue(InitialAutoRepeatingDelayProperty);
+ }
+ set
+ {
+ SetValue(InitialAutoRepeatingDelayProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// By default, this value is set to 0.05 seconds.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float NextAutoRepeatingDelay
+ {
+ get
+ {
+ return (float)GetValue(NextAutoRepeatingDelayProperty);
+ }
+ set
+ {
+ SetValue(NextAutoRepeatingDelayProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// If the togglable property is set to true, then the autorepeating property is set to false.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool Togglable
+ {
+ get
+ {
+ return (bool)GetValue(TogglableProperty);
+ }
+ set
+ {
+ SetValue(TogglableProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the togglable button as either selected or unselected, togglable property must be set to true.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool Selected
+ {
+ get
+ {
+ return (bool)GetValue(SelectedProperty);
+ }
+ set
+ {
+ SetValue(SelectedProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the unselected color.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Color UnselectedColor
+ {
+ get
+ {
+ return (Color)GetValue(UnselectedColorProperty);
+ }
+ set
+ {
+ SetValue(UnselectedColorProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the selected color.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Color SelectedColor
+ {
+ get
+ {
+ return (Color)GetValue(SelectedColorProperty);
+ }
+ set
+ {
+ SetValue(SelectedColorProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the label.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap Label
+ {
+ get
+ {
+ return (PropertyMap)GetValue(LabelProperty);
+ }
+ set
+ {
+ SetValue(LabelProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the text of the label.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string LabelText
+ {
+ get
+ {
+ return (string)GetValue(LabelTextProperty);
+ }
+ set
+ {
+ SetValue(LabelTextProperty, value);
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System.ComponentModel;
+
+namespace Tizen.NUI.Xaml.UIComponents
+{
+
+ /// <summary>
+ /// The CheckBoxButton provides a checkbox button which the user can check or uncheck.<br />
+ /// By default, the CheckBoxButton emits a Button.Clicked event when the button changes its state to selected or unselected.<br />
+ /// The button's appearance could be modified by Button.UnselectedImage, Button.BackgroundImage, Button.SelectedImage, Button.SelectedBackgroundImage, Button.DisabledBackgroundImage, Button.DisabledImage, and Button.DisabledSelectedImage.<br />
+ /// When the button is not disabled, if it's not selected, it only shows the background image.<br />
+ /// The selected image is shown over the background image when the box is selected (background image is not replaced by \e selected image).<br />
+ /// When the button is disabled, the background image and the selected image are replaced by disabled images.<br />
+ /// /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class CheckBoxButton : Button
+ {
+ private Tizen.NUI.UIComponents.CheckBoxButton _checkBoxButton;
+ internal Tizen.NUI.UIComponents.CheckBoxButton checkBoxButton
+ {
+ get
+ {
+ if (null == _checkBoxButton)
+ {
+ _checkBoxButton = handleInstance as Tizen.NUI.UIComponents.CheckBoxButton;
+ }
+
+ return _checkBoxButton;
+ }
+ }
+
+ /// <summary>
+ /// Creates an initialized CheckBoxButton.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public CheckBoxButton() : this(new Tizen.NUI.UIComponents.CheckBoxButton())
+ {
+ }
+
+ internal CheckBoxButton(Tizen.NUI.UIComponents.CheckBoxButton nuiInstance) : base(nuiInstance)
+ {
+ SetNUIInstance(nuiInstance);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System;
+using System.ComponentModel;
+using System.Runtime.InteropServices;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.XamlBinding;
+using static Tizen.NUI.UIComponents.Popup;
+
+namespace Tizen.NUI.Xaml.UIComponents
+{
+ /// <summary>
+ /// The Popup widget provides a configurable popup dialog with a built-in layout of three main fields.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class Popup : Tizen.NUI.Xaml.Forms.BaseComponents.View
+ {
+ private Tizen.NUI.UIComponents.Popup _popup;
+ internal Tizen.NUI.UIComponents.Popup popup
+ {
+ get
+ {
+ if (null == _popup)
+ {
+ _popup = handleInstance as Tizen.NUI.UIComponents.Popup;
+ }
+
+ return _popup;
+ }
+ }
+
+ /// <summary>
+ /// Creates the popup.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Popup() : this(new Tizen.NUI.UIComponents.Popup())
+ {
+ }
+
+ internal Popup(Tizen.NUI.UIComponents.Popup nuiInstance) : base(nuiInstance)
+ {
+ SetNUIInstance(nuiInstance);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty TitleProperty = BindableProperty.Create("Title", typeof(PropertyMap), typeof(Popup), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ popup.Title = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ return popup.Title;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty FooterProperty = BindableProperty.Create("Footer", typeof(PropertyMap), typeof(Popup), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ popup.Footer = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ return popup.Footer;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty DisplayStateProperty = BindableProperty.Create("DisplayState", typeof(DisplayStateType), typeof(Popup), DisplayStateType.Hidden, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ popup.DisplayState = (DisplayStateType)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ return popup.DisplayState;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty TouchTransparentProperty = BindableProperty.Create("TouchTransparent", typeof(bool), typeof(Popup), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ popup.TouchTransparent = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ return popup.TouchTransparent;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty TailVisibilityProperty = BindableProperty.Create("TailVisibility", typeof(bool), typeof(Popup), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ popup.TailVisibility = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ return popup.TailVisibility;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty TailPositionProperty = BindableProperty.Create("TailPosition", typeof(Vector3), typeof(Popup), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ popup.TailPosition = (Vector3)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ return popup.TailPosition;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ContextualModeProperty = BindableProperty.Create("ContextualMode", typeof(ContextualModeType), typeof(Popup), ContextualModeType.Below, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ popup.ContextualMode = (ContextualModeType)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ return popup.ContextualMode;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty AnimationDurationProperty = BindableProperty.Create("AnimationDuration", typeof(float), typeof(Popup), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ popup.AnimationDuration = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ return popup.AnimationDuration;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty AnimationModeProperty = BindableProperty.Create("AnimationMode", typeof(AnimationModeType), typeof(Popup), AnimationModeType.Fade, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ popup.AnimationMode = (AnimationModeType)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ return popup.AnimationMode;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty EntryAnimationProperty = BindableProperty.Create("EntryAnimation", typeof(PropertyMap), typeof(Popup), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ popup.EntryAnimation = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ return popup.EntryAnimation;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ExitAnimationProperty = BindableProperty.Create("ExitAnimation", typeof(PropertyMap), typeof(Popup), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ popup.ExitAnimation = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ return popup.ExitAnimation;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty AutoHideDelayProperty = BindableProperty.Create("AutoHideDelay", typeof(int), typeof(Popup), default(int), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ popup.AutoHideDelay = (int)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ return popup.AutoHideDelay;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty BackingEnabledProperty = BindableProperty.Create("BackingEnabled", typeof(bool), typeof(Popup), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ popup.BackingEnabled = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ return popup.BackingEnabled;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty BackingColorProperty = BindableProperty.Create("BackingColor", typeof(Vector4), typeof(Popup), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ popup.BackingColor = (Vector4)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ return popup.BackingColor;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty PopupBackgroundImageProperty = BindableProperty.Create("PopupBackgroundImage", typeof(string), typeof(Popup), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ popup.PopupBackgroundImage = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ return popup.PopupBackgroundImage;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty PopupBackgroundBorderProperty = BindableProperty.Create("PopupBackgroundBorder", typeof(Rectangle), typeof(Popup), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ popup.PopupBackgroundBorder = (Rectangle)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ return popup.PopupBackgroundBorder;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty TailUpImageProperty = BindableProperty.Create("TailUpImage", typeof(string), typeof(Popup), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ popup.TailUpImage = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ return popup.TailUpImage;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty TailDownImageProperty = BindableProperty.Create("TailDownImage", typeof(string), typeof(Popup), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ popup.TailDownImage = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ return popup.TailDownImage;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty TailLeftImageProperty = BindableProperty.Create("TailLeftImage", typeof(string), typeof(Popup), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ popup.TailLeftImage = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ return popup.TailLeftImage;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty TailRightImageProperty = BindableProperty.Create("TailRightImage", typeof(string), typeof(Popup), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ popup.TailRightImage = (string)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var popup = ((Popup)bindable).popup;
+ return popup.TailRightImage;
+ });
+
+ /// <summary>
+ /// An event is sent when the user has touched outside the dialog.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler<TouchedOutsideEventArgs> TouchedOutside
+ {
+ add
+ {
+ popup.TouchedOutside += value;
+ }
+ remove
+ {
+ popup.TouchedOutside -= value;
+ }
+ }
+
+ /// <summary>
+ /// An event is sent when the popup starts showing.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler<ShowingEventArgs> Showing
+ {
+ add
+ {
+ popup.Showing += value;
+ }
+ remove
+ {
+ popup.Showing -= value;
+ }
+ }
+
+ /// <summary>
+ /// An event is sent when the popup has been fully displayed.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler<ShownEventArgs> Shown
+ {
+ add
+ {
+ popup.Shown += value;
+ }
+ remove
+ {
+ popup.Shown -= value;
+ }
+ }
+
+ /// <summary>
+ /// An event is sent when the popup starts to hide.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler<HidingEventArgs> Hiding
+ {
+ add
+ {
+ popup.Hiding += value;
+ }
+ remove
+ {
+ popup.Hiding -= value;
+ }
+ }
+
+ /// <summary>
+ /// An event is sent when the popup has been completely hidden.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler<HiddenEventArgs> Hidden
+ {
+ add
+ {
+ popup.Hidden += value;
+ }
+ remove
+ {
+ popup.Hidden -= value;
+ }
+ }
+
+ /// <summary>
+ /// Sets the content actor.
+ /// </summary>
+ /// <param name="content">The actor to use.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetContent(Tizen.NUI.Xaml.Forms.BaseComponents.View content)
+ {
+ popup.SetContent(content.handleInstance as View);
+ }
+
+ /// <summary>
+ /// Sets the content actor.
+ /// </summary>
+ /// <param name="content">The actor to use.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetContent(View content)
+ {
+ popup.SetContent(content);
+ }
+
+ /// <summary>
+ /// Sets the actor to use for the footer in this popup.
+ /// </summary>
+ /// <param name="footer">The footer actor to be added to this popup.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetFooter(Tizen.NUI.Xaml.Forms.BaseComponents.View footer)
+ {
+ popup.SetFooter(footer.handleInstance as View);
+ }
+
+ /// <summary>
+ /// Sets the actor to use for the footer in this popup.
+ /// </summary>
+ /// <param name="footer">The footer actor to be added to this popup.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetFooter(View footer)
+ {
+ popup.SetFooter(footer);
+ }
+
+ /// <summary>
+ /// Sets the display state of popup.<br />
+ /// There are 4 total display states.<br />
+ /// Only 2 can be set, but all four can be read for better inspection of the current popup state.<br />
+ /// <br />
+ /// The other two states are getable, but not setable, and are there for consistency.<br />
+ /// <br />
+ /// | Value | Setting the state | Getting the state |<br />
+ /// |----------|--------------------------------|--------------------------------|<br />
+ /// | SHOWN | Show the popup | The popup is fully shown |<br />
+ /// | HIDDEN | Hide the popup | The popup is fully hidden |<br />
+ /// | SHOWING | | The popup is transitioning in |<br />
+ /// | HIDING | | The popup is transitioning out |<br />
+ /// <br />
+ /// All 4 states changes cause notifications via 4 respective signals that can be connected to.<br />
+ /// </summary>
+ /// <param name="displayState">The desired display state to change to.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetDisplayState(DisplayStateType displayState)
+ {
+ popup.SetDisplayState(displayState);
+ }
+
+ /// <summary>
+ /// The popup title.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap Title
+ {
+ get
+ {
+ return (PropertyMap)GetValue(TitleProperty);
+ }
+ set
+ {
+ SetValue(TitleProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The popup footer.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap Footer
+ {
+ get
+ {
+ return (PropertyMap)GetValue(FooterProperty);
+ }
+ set
+ {
+ SetValue(FooterProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The popup display state.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public DisplayStateType DisplayState
+ {
+ get
+ {
+ return (DisplayStateType)GetValue(DisplayStateProperty);
+ }
+ set
+ {
+ SetValue(DisplayStateProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The touch transparent.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool TouchTransparent
+ {
+ get
+ {
+ return (bool)GetValue(TouchTransparentProperty);
+ }
+ set
+ {
+ SetValue(TouchTransparentProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The popup tail visibility.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool TailVisibility
+ {
+ get
+ {
+ return (bool)GetValue(TailVisibilityProperty);
+ }
+ set
+ {
+ SetValue(TailVisibilityProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The popup tail position.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector3 TailPosition
+ {
+ get
+ {
+ return (Vector3)GetValue(TailPositionProperty);
+ }
+ set
+ {
+ SetValue(TailPositionProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The contextual mode.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ContextualModeType ContextualMode
+ {
+ get
+ {
+ return (ContextualModeType)GetValue(ContextualModeProperty);
+ }
+ set
+ {
+ SetValue(ContextualModeProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The animation duration.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float AnimationDuration
+ {
+ get
+ {
+ return (float)GetValue(AnimationDurationProperty);
+ }
+ set
+ {
+ SetValue(AnimationDurationProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The animation mode.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public AnimationModeType AnimationMode
+ {
+ get
+ {
+ return (AnimationModeType)GetValue(AnimationModeProperty);
+ }
+ set
+ {
+ SetValue(AnimationModeProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The entry animation.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap EntryAnimation
+ {
+ get
+ {
+ return (PropertyMap)GetValue(EntryAnimationProperty);
+ }
+ set
+ {
+ SetValue(EntryAnimationProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The exit animation.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap ExitAnimation
+ {
+ get
+ {
+ return (PropertyMap)GetValue(ExitAnimationProperty);
+ }
+ set
+ {
+ SetValue(ExitAnimationProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The auto hide delay.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int AutoHideDelay
+ {
+ get
+ {
+ return (int)GetValue(AutoHideDelayProperty);
+ }
+ set
+ {
+ SetValue(AutoHideDelayProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The backing enabled.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool BackingEnabled
+ {
+ get
+ {
+ return (bool)GetValue(BackingEnabledProperty);
+ }
+ set
+ {
+ SetValue(BackingEnabledProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The backing color.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector4 BackingColor
+ {
+ get
+ {
+ return (Vector4)GetValue(BackingColorProperty);
+ }
+ set
+ {
+ SetValue(BackingColorProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The background image.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string PopupBackgroundImage
+ {
+ get
+ {
+ return (string)GetValue(PopupBackgroundImageProperty);
+ }
+ set
+ {
+ SetValue(PopupBackgroundImageProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The background border.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Rectangle PopupBackgroundBorder
+ {
+ get
+ {
+ return (Rectangle)GetValue(PopupBackgroundBorderProperty);
+ }
+ set
+ {
+ SetValue(PopupBackgroundBorderProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The tail up image.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string TailUpImage
+ {
+ get
+ {
+ return (string)GetValue(TailUpImageProperty);
+ }
+ set
+ {
+ SetValue(TailUpImageProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The tail down image.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string TailDownImage
+ {
+ get
+ {
+ return (string)GetValue(TailDownImageProperty);
+ }
+ set
+ {
+ SetValue(TailDownImageProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The tail left image.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string TailLeftImage
+ {
+ get
+ {
+ return (string)GetValue(TailLeftImageProperty);
+ }
+ set
+ {
+ SetValue(TailLeftImageProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The tail right image.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string TailRightImage
+ {
+ get
+ {
+ return (string)GetValue(TailRightImageProperty);
+ }
+ set
+ {
+ SetValue(TailRightImageProperty, value);
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System;
+using System.ComponentModel;
+using System.Runtime.InteropServices;
+using Tizen.NUI;
+using Tizen.NUI.XamlBinding;
+using Tizen.NUI.Xaml.Forms.BaseComponents;
+using static Tizen.NUI.UIComponents.ProgressBar;
+
+namespace Tizen.NUI.Xaml.UIComponents
+{
+ /// <summary>
+ /// The ProgressBar is a control to give the user an indication of the progress of an operation.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class ProgressBar : View
+ {
+ private Tizen.NUI.UIComponents.ProgressBar _progressBar;
+ internal Tizen.NUI.UIComponents.ProgressBar progressBar
+ {
+ get
+ {
+ if (null == _progressBar)
+ {
+ _progressBar = handleInstance as Tizen.NUI.UIComponents.ProgressBar;
+ }
+
+ return _progressBar;
+ }
+ }
+
+ /// <summary>
+ /// Creates the ProgressBar.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ProgressBar() : this(new Tizen.NUI.UIComponents.ProgressBar())
+ {
+ }
+
+ internal ProgressBar(Tizen.NUI.UIComponents.ProgressBar nuiInstance) : base(nuiInstance)
+ {
+ SetNUIInstance(nuiInstance);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ProgressValueProperty = BindableProperty.Create("ProgressValue", typeof(float), typeof(ProgressBar), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var progressBar = ((ProgressBar)bindable).progressBar;
+ progressBar.ProgressValue = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var progressBar = ((ProgressBar)bindable).progressBar;
+ return progressBar.ProgressValue;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SecondaryProgressValueProperty = BindableProperty.Create("SecondaryProgressValue", typeof(float), typeof(ProgressBar), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var progressBar = ((ProgressBar)bindable).progressBar;
+ progressBar.SecondaryProgressValue = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var progressBar = ((ProgressBar)bindable).progressBar;
+ return progressBar.SecondaryProgressValue;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty IndeterminateProperty = BindableProperty.Create("Indeterminate", typeof(bool), typeof(ProgressBar), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var progressBar = ((ProgressBar)bindable).progressBar;
+ progressBar.Indeterminate = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var progressBar = ((ProgressBar)bindable).progressBar;
+ return progressBar.Indeterminate;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty TrackVisualProperty = BindableProperty.Create("TrackVisual", typeof(PropertyMap), typeof(ProgressBar), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var progressBar = ((ProgressBar)bindable).progressBar;
+ progressBar.TrackVisual = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var progressBar = ((ProgressBar)bindable).progressBar;
+ return progressBar.TrackVisual;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ProgressVisualProperty = BindableProperty.Create("ProgressVisual", typeof(PropertyMap), typeof(ProgressBar), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var progressBar = ((ProgressBar)bindable).progressBar;
+ progressBar.ProgressVisual = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var progressBar = ((ProgressBar)bindable).progressBar;
+ return progressBar.ProgressVisual;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SecondaryProgressVisualProperty = BindableProperty.Create("SecondaryProgressVisual", typeof(PropertyMap), typeof(ProgressBar), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var progressBar = ((ProgressBar)bindable).progressBar;
+ progressBar.SecondaryProgressVisual = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var progressBar = ((ProgressBar)bindable).progressBar;
+ return progressBar.SecondaryProgressVisual;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty IndeterminateVisualProperty = BindableProperty.Create("IndeterminateVisual", typeof(PropertyMap), typeof(ProgressBar), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var progressBar = ((ProgressBar)bindable).progressBar;
+ progressBar.IndeterminateVisual = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var progressBar = ((ProgressBar)bindable).progressBar;
+ return progressBar.IndeterminateVisual;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty IndeterminateVisualAnimationProperty = BindableProperty.Create("IndeterminateVisualAnimation", typeof(PropertyArray), typeof(ProgressBar), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var progressBar = ((ProgressBar)bindable).progressBar;
+ progressBar.IndeterminateVisualAnimation = (PropertyArray)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var progressBar = ((ProgressBar)bindable).progressBar;
+ return progressBar.IndeterminateVisualAnimation;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty LabelVisualProperty = BindableProperty.Create("LabelVisual", typeof(PropertyMap), typeof(ProgressBar), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var progressBar = ((ProgressBar)bindable).progressBar;
+ progressBar.LabelVisual = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var progressBar = ((ProgressBar)bindable).progressBar;
+ return progressBar.LabelVisual;
+ });
+
+ /// <summary>
+ /// The event is sent when the ProgressBar value changes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler<ValueChangedEventArgs> ValueChanged
+ {
+ add
+ {
+ progressBar.ValueChanged += value;
+ }
+ remove
+ {
+ progressBar.ValueChanged -= value;
+ }
+ }
+
+ /// <summary>
+ /// The progress value of the progress bar, the progress runs from 0 to 1.<br />
+ /// If the value is set to 0, then the progress bar will be set to beginning.<br />
+ /// If the value is set to 1, then the progress bar will be set to end.<br />
+ /// Any value outside the range is ignored.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float ProgressValue
+ {
+ get
+ {
+ return (float)GetValue(ProgressValueProperty);
+ }
+ set
+ {
+ SetValue(ProgressValueProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The secondary progress value of the progress bar, the secondary progress runs from 0 to 1.<br />
+ /// Optional. If not supplied, the default is 0.<br />
+ /// If the value is set to 0, then the progress bar will be set secondary progress to beginning.<br />
+ /// If the value is set to 1, then the progress bar will be set secondary progress to end.<br />
+ /// Any value outside of the range is ignored.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float SecondaryProgressValue
+ {
+ get
+ {
+ return (float)GetValue(SecondaryProgressValueProperty);
+ }
+ set
+ {
+ SetValue(SecondaryProgressValueProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Sets the progress bar as \e indeterminate state.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool Indeterminate
+ {
+ get
+ {
+ return (bool)GetValue(IndeterminateProperty);
+ }
+ set
+ {
+ SetValue(IndeterminateProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The track visual value of progress bar, it's full progress area, and it's shown behind the PROGRESS_VISUAL.<br />
+ /// Optional. If not supplied, the default track visual will be shown.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap TrackVisual
+ {
+ get
+ {
+ return (PropertyMap)GetValue(TrackVisualProperty);
+ }
+ set
+ {
+ SetValue(TrackVisualProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The progress visual value of the progress bar, the size of the progress visual is changed based on the PROGRESS_VALUE.<br />
+ /// Optional. If not supplied, then the default progress visual will be shown.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap ProgressVisual
+ {
+ get
+ {
+ return (PropertyMap)GetValue(ProgressVisualProperty);
+ }
+ set
+ {
+ SetValue(ProgressVisualProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The secondary progress visual of the progress bar, the size of the secondary progress visual is changed based on the SECONDARY_PROGRESS_VALUE.<br />
+ /// Optional. If not supplied, then the secondary progress visual will not be shown.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap SecondaryProgressVisual
+ {
+ get
+ {
+ return (PropertyMap)GetValue(SecondaryProgressVisualProperty);
+ }
+ set
+ {
+ SetValue(SecondaryProgressVisualProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The indeterminate visual of the progress bar.<br />
+ /// Optional. If not supplied, then the default indeterminate visual will be shown.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap IndeterminateVisual
+ {
+ get
+ {
+ return (PropertyMap)GetValue(IndeterminateVisualProperty);
+ }
+ set
+ {
+ SetValue(IndeterminateVisualProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The transition data for the indeterminate visual animation.<br />
+ /// Optional. If not supplied, then the default animation will be played.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyArray IndeterminateVisualAnimation
+ {
+ get
+ {
+ return (PropertyArray)GetValue(IndeterminateVisualAnimationProperty);
+ }
+ set
+ {
+ SetValue(IndeterminateVisualAnimationProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The label visual of the progress bar.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap LabelVisual
+ {
+ get
+ {
+ return (PropertyMap)GetValue(LabelVisualProperty);
+ }
+ set
+ {
+ SetValue(LabelVisualProperty, value);
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+using System.ComponentModel;
+using System.Windows.Input;
+using Tizen.NUI.XamlBinding;
+
+namespace Tizen.NUI.Xaml.UIComponents
+{
+ /// <summary>
+ /// The PushButton changes its appearance when it is pressed, and returns to its original when it is released.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class PushButton : Button
+ {
+ private Tizen.NUI.UIComponents.PushButton _pushButton;
+ internal Tizen.NUI.UIComponents.PushButton pushButton
+ {
+ get
+ {
+ if (null == _pushButton)
+ {
+ _pushButton = handleInstance as Tizen.NUI.UIComponents.PushButton;
+ }
+
+ return _pushButton;
+ }
+ }
+
+ /// <summary>
+ /// Creates the PushButton.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PushButton() : this(new Tizen.NUI.UIComponents.PushButton())
+ {
+ }
+
+ internal PushButton(Tizen.NUI.UIComponents.PushButton nuiInstance) : base(nuiInstance)
+ {
+ SetNUIInstance(nuiInstance);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty CommandProperty = BindableProperty.Create("Command", typeof(ICommand), typeof(PushButton), null,
+ BindingMode.OneWay, null, null, null, null, null as BindableProperty.CreateDefaultValueDelegate);
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty CommandParameterProperty = BindableProperty.Create("CommandParameter", typeof(object), typeof(PushButton), null,
+ BindingMode.OneWay, null, null, null, null, null as BindableProperty.CreateDefaultValueDelegate);
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ICommand Command
+ {
+ get
+ {
+ return (ICommand)base.GetValue(PushButton.CommandProperty);
+ }
+ set
+ {
+ base.SetValue(PushButton.CommandProperty, value);
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object CommandParameter
+ {
+ get
+ {
+ return base.GetValue(PushButton.CommandParameterProperty);
+ }
+ set
+ {
+ base.SetValue(PushButton.CommandParameterProperty, value);
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System.ComponentModel;
+
+namespace Tizen.NUI.Xaml.UIComponents
+{
+
+ /// <summary>
+ /// A RadioButton provides a radio button with two states, \e selected or \e unselected.<br />
+ /// Radio buttons are designed to select one of the many options at the same time.<br />
+ /// A RadioButton can change its current state using the selected.<br />
+ /// <br />
+ /// RadioButtons can be grouped.<br />
+ /// Two or more RadioButtons are in one group when they have this same parent.<br />
+ /// In each groups only one RadioButton can be \e selected at a given time.<br />
+ /// So when a RadioButton is set to \e selected, other RadioButtons in its group are set to \e unselected.<br />
+ /// When \e selected RadioButton is set to \e unselected, no other RadioButtons in this group are set to \e selected.<br />
+ /// <br />
+ /// The StateChanged event is emitted when the RadioButton change its state to \e selected or \e unselected.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class RadioButton : Button
+ {
+ private Tizen.NUI.UIComponents.RadioButton _radioButton;
+ internal Tizen.NUI.UIComponents.RadioButton radioButton
+ {
+ get
+ {
+ if (null == _radioButton)
+ {
+ _radioButton = handleInstance as Tizen.NUI.UIComponents.RadioButton;
+ }
+
+ return _radioButton;
+ }
+ }
+
+ /// <summary>
+ /// Creates an uninitialized RadioButton.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public RadioButton() : this(new Tizen.NUI.UIComponents.RadioButton())
+ {
+ }
+
+ internal RadioButton(Tizen.NUI.UIComponents.RadioButton nuiInstance) : base(nuiInstance)
+ {
+ SetNUIInstance(nuiInstance);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System;
+using System.ComponentModel;
+using System.Runtime.InteropServices;
+using Tizen.NUI;
+using Tizen.NUI.XamlBinding;
+using Tizen.NUI.Xaml.Forms.BaseComponents;
+using static Tizen.NUI.UIComponents.ScrollBar;
+
+namespace Tizen.NUI.Xaml.UIComponents
+{
+ /// <summary>
+ /// The ScrollBar is a UI component that can be linked to the scrollable objects
+ /// indicating the current scroll position of the scrollable object.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class ScrollBar : View
+ {
+ private Tizen.NUI.UIComponents.ScrollBar _scrollBar;
+ internal Tizen.NUI.UIComponents.ScrollBar scrollBar
+ {
+ get
+ {
+ if (null == _scrollBar)
+ {
+ _scrollBar = handleInstance as Tizen.NUI.UIComponents.ScrollBar;
+ }
+
+ return _scrollBar;
+ }
+ }
+
+ /// <summary>
+ /// Creates an uninitialized scrollbar.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ScrollBar() : this(new Tizen.NUI.UIComponents.ScrollBar())
+ {
+ }
+
+ internal ScrollBar(Tizen.NUI.UIComponents.ScrollBar nuiInstance) : base(nuiInstance)
+ {
+ SetNUIInstance(nuiInstance);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ScrollDirectionProperty = BindableProperty.Create("ScrollDirection", typeof(Direction), typeof(ScrollBar), Direction.Vertical, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollBar = ((ScrollBar)bindable).scrollBar;
+ scrollBar.ScrollDirection = (Direction)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollBar = ((ScrollBar)bindable).scrollBar;
+ return scrollBar.ScrollDirection;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty IndicatorHeightPolicyProperty = BindableProperty.Create("IndicatorHeightPolicy", typeof(IndicatorHeightPolicyType), typeof(ScrollBar), IndicatorHeightPolicyType.Variable, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollBar = ((ScrollBar)bindable).scrollBar;
+ scrollBar.IndicatorHeightPolicy = (IndicatorHeightPolicyType)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollBar = ((ScrollBar)bindable).scrollBar;
+ return scrollBar.IndicatorHeightPolicy;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty IndicatorFixedHeightProperty = BindableProperty.Create("IndicatorFixedHeight", typeof(float), typeof(ScrollBar), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollBar = ((ScrollBar)bindable).scrollBar;
+ scrollBar.IndicatorFixedHeight = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollBar = ((ScrollBar)bindable).scrollBar;
+ return scrollBar.IndicatorFixedHeight;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty IndicatorShowDurationProperty = BindableProperty.Create("IndicatorShowDuration", typeof(float), typeof(ScrollBar), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollBar = ((ScrollBar)bindable).scrollBar;
+ scrollBar.IndicatorShowDuration = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollBar = ((ScrollBar)bindable).scrollBar;
+ return scrollBar.IndicatorShowDuration;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty IndicatorHideDurationProperty = BindableProperty.Create("IndicatorHideDuration", typeof(float), typeof(ScrollBar), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollBar = ((ScrollBar)bindable).scrollBar;
+ scrollBar.IndicatorHideDuration = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollBar = ((ScrollBar)bindable).scrollBar;
+ return scrollBar.IndicatorHideDuration;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ScrollPositionIntervalsProperty = BindableProperty.Create("ScrollPositionIntervals", typeof(PropertyArray), typeof(ScrollBar), new PropertyArray(), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollBar = ((ScrollBar)bindable).scrollBar;
+ scrollBar.ScrollPositionIntervals = (PropertyArray)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollBar = ((ScrollBar)bindable).scrollBar;
+ return scrollBar.ScrollPositionIntervals;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty IndicatorMinimumHeightProperty = BindableProperty.Create("IndicatorMinimumHeight", typeof(float), typeof(ScrollBar), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollBar = ((ScrollBar)bindable).scrollBar;
+ scrollBar.IndicatorMinimumHeight = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollBar = ((ScrollBar)bindable).scrollBar;
+ return scrollBar.IndicatorMinimumHeight;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty IndicatorStartPaddingProperty = BindableProperty.Create("IndicatorStartPadding", typeof(float), typeof(ScrollBar), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollBar = ((ScrollBar)bindable).scrollBar;
+ scrollBar.IndicatorStartPadding = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollBar = ((ScrollBar)bindable).scrollBar;
+ return scrollBar.IndicatorStartPadding;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty IndicatorEndPaddingProperty = BindableProperty.Create("IndicatorEndPadding", typeof(float), typeof(ScrollBar), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollBar = ((ScrollBar)bindable).scrollBar;
+ scrollBar.IndicatorEndPadding = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollBar = ((ScrollBar)bindable).scrollBar;
+ return scrollBar.IndicatorEndPadding;
+ });
+
+ /// <summary>
+ /// The event emitted when panning is finished on the scroll indicator.
+ /// </summary>
+ /// <remarks>Event only emitted when the source of the scroll position properties are set.</remarks>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler<PanFinishedEventArgs> PanFinished
+ {
+ add
+ {
+ scrollBar.PanFinished += value;
+ }
+ remove
+ {
+ scrollBar.PanFinished -= value;
+ }
+ }
+
+ /// <summary>
+ /// This is the event emitted when the current scroll position of the scrollable content goes above or below the values specified by ScrollPositionIntervals property.
+ /// </summary>
+ /// <remarks>Event only emitted when the source of the scroll position properties are set.</remarks>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler<ScrollIntervalEventArgs> ScrollInterval
+ {
+ add
+ {
+ scrollBar.ScrollInterval += value;
+ }
+ remove
+ {
+ scrollBar.ScrollInterval -= value;
+ }
+ }
+
+ /// <summary>
+ /// Sets the source of the scroll position properties.
+ /// </summary>
+ /// <param name="handle">The handle of the object owing the scroll properties.</param>
+ /// <param name="propertyScrollPosition">The index of the scroll position property(The scroll position, type float).</param>
+ /// <param name="propertyMinScrollPosition">The index of the minimum scroll position property(The minimum scroll position, type float).</param>
+ /// <param name="propertyMaxScrollPosition">The index of the maximum scroll position property(The maximum scroll position, type float).</param>
+ /// <param name="propertyScrollContentSize">The index of the scroll content size property(The size of the scrollable content in actor coordinates, type float).</param>
+ /// <remarks>The handle to the object owing the scroll properties has been initialised and the property index must be valid.</remarks>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetScrollPropertySource(Animatable handle, int propertyScrollPosition, int propertyMinScrollPosition, int propertyMaxScrollPosition, int propertyScrollContentSize)
+ {
+ scrollBar.SetScrollPropertySource(handle, propertyScrollPosition, propertyMinScrollPosition, propertyMaxScrollPosition, propertyScrollContentSize);
+ }
+
+ /// <summary>
+ /// The direction of the scrollbar.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Direction ScrollDirection
+ {
+ get
+ {
+
+ return (Direction)GetValue(ScrollDirectionProperty);
+ }
+ set
+ {
+ SetValue(ScrollDirectionProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The indicator height policy.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public IndicatorHeightPolicyType IndicatorHeightPolicy
+ {
+ get
+ {
+ return (IndicatorHeightPolicyType)GetValue(IndicatorHeightPolicyProperty);
+ }
+ set
+ {
+ SetValue(IndicatorHeightPolicyProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The fixed height of the scroll indicator.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float IndicatorFixedHeight
+ {
+ get
+ {
+ return (float)GetValue(IndicatorFixedHeightProperty);
+ }
+ set
+ {
+ SetValue(IndicatorFixedHeightProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The duration in seconds for the scroll indicator to become fully visible.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float IndicatorShowDuration
+ {
+ get
+ {
+ return (float)GetValue(IndicatorShowDurationProperty);
+ }
+ set
+ {
+ SetValue(IndicatorShowDurationProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The duration in seconds for the scroll indicator to become fully invisible.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float IndicatorHideDuration
+ {
+ get
+ {
+ return (float)GetValue(IndicatorHideDurationProperty);
+ }
+ set
+ {
+ SetValue(IndicatorHideDurationProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The list of values to get the notification when the current scroll position of the scrollable object goes above or below any of these values.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyArray ScrollPositionIntervals
+ {
+ get
+ {
+ return (PropertyArray)GetValue(ScrollPositionIntervalsProperty);
+ }
+ set
+ {
+ SetValue(ScrollPositionIntervalsProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The minimum height for a variable size indicator.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float IndicatorMinimumHeight
+ {
+ get
+ {
+ return (float)GetValue(IndicatorMinimumHeightProperty);
+ }
+ set
+ {
+ SetValue(IndicatorMinimumHeightProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The padding at the start of the indicator. For example, the top if the scrollDirection is vertical.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float IndicatorStartPadding
+ {
+ get
+ {
+ return (float)GetValue(IndicatorStartPaddingProperty);
+ }
+ set
+ {
+ SetValue(IndicatorStartPaddingProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The padding at the end of the indicator. For example, the bottom if the scrollDirection is vertical.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float IndicatorEndPadding
+ {
+ get
+ {
+ return (float)GetValue(IndicatorEndPaddingProperty);
+ }
+ set
+ {
+ SetValue(IndicatorEndPaddingProperty, value);
+ }
+ }
+
+ }
+
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System;
+using System.ComponentModel;
+using System.Runtime.InteropServices;
+using Tizen.NUI;
+using Tizen.NUI.XamlBinding;
+using Tizen.NUI.Xaml.Forms.BaseComponents;
+using static Tizen.NUI.ScrollView;
+using Tizen.NUI.UIComponents;
+
+namespace Tizen.NUI.Xaml.UIComponents
+{
+ /// <summary>
+ /// ScrollView contains views that can be scrolled manually (via touch).
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class ScrollView : Scrollable
+ {
+ private Tizen.NUI.ScrollView _scrollView;
+ internal Tizen.NUI.ScrollView scrollView
+ {
+ get
+ {
+ if (null == _scrollView)
+ {
+ _scrollView = handleInstance as Tizen.NUI.ScrollView;
+ }
+
+ return _scrollView;
+ }
+ }
+
+ /// <summary>
+ /// Create an instance of ScrollView.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ScrollView() : this(new Tizen.NUI.ScrollView())
+ {
+ }
+
+ internal ScrollView(Tizen.NUI.ScrollView nuiInstance) : base(nuiInstance)
+ {
+ SetNUIInstance(nuiInstance);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty WrapEnabledProperty = BindableProperty.Create("WrapEnabled", typeof(bool), typeof(ScrollView), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ scrollView.WrapEnabled = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ return scrollView.WrapEnabled;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty PanningEnabledProperty = BindableProperty.Create("PanningEnabled", typeof(bool), typeof(ScrollView), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ scrollView.PanningEnabled = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ return scrollView.PanningEnabled;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty AxisAutoLockEnabledProperty = BindableProperty.Create("AxisAutoLockEnabled", typeof(bool), typeof(ScrollView), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ scrollView.AxisAutoLockEnabled = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ return scrollView.AxisAutoLockEnabled;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty WheelScrollDistanceStepProperty = BindableProperty.Create("WheelScrollDistanceStep", typeof(Vector2), typeof(ScrollView), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ scrollView.WheelScrollDistanceStep = (Vector2)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ return scrollView.WheelScrollDistanceStep;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ScrollPositionProperty = BindableProperty.Create("ScrollPosition", typeof(Vector2), typeof(ScrollView), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ scrollView.ScrollPosition = (Vector2)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ return scrollView.ScrollPosition;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ScrollPrePositionProperty = BindableProperty.Create("ScrollPrePosition", typeof(Vector2), typeof(ScrollView), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ scrollView.ScrollPrePosition = (Vector2)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ return scrollView.ScrollPrePosition;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ScrollPrePositionMaxProperty = BindableProperty.Create("ScrollPrePositionMax", typeof(Vector2), typeof(ScrollView), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ scrollView.ScrollPrePositionMax = (Vector2)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ return scrollView.ScrollPrePositionMax;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty OvershootXProperty = BindableProperty.Create("OvershootX", typeof(float), typeof(ScrollView), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ scrollView.OvershootX = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ return scrollView.OvershootX;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty OvershootYProperty = BindableProperty.Create("OvershootY", typeof(float), typeof(ScrollView), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ scrollView.OvershootY = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ return scrollView.OvershootY;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ScrollFinalProperty = BindableProperty.Create("ScrollFinal", typeof(Vector2), typeof(ScrollView), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ scrollView.ScrollFinal = (Vector2)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ return scrollView.ScrollFinal;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty WrapProperty = BindableProperty.Create("Wrap", typeof(bool), typeof(ScrollView), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ scrollView.Wrap = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ return scrollView.Wrap;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty PanningProperty = BindableProperty.Create("Panning", typeof(bool), typeof(ScrollView), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ scrollView.Panning = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ return scrollView.Panning;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ScrollingProperty = BindableProperty.Create("Scrolling", typeof(bool), typeof(ScrollView), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ scrollView.Scrolling = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ return scrollView.Scrolling;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ScrollDomainSizeProperty = BindableProperty.Create("ScrollDomainSize", typeof(Vector2), typeof(ScrollView), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ scrollView.ScrollDomainSize = (Vector2)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ return scrollView.ScrollDomainSize;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ScrollDomainOffsetProperty = BindableProperty.Create("ScrollDomainOffset", typeof(Vector2), typeof(ScrollView), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ scrollView.ScrollDomainOffset = (Vector2)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ return scrollView.ScrollDomainOffset;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ScrollPositionDeltaProperty = BindableProperty.Create("ScrollPositionDelta", typeof(Vector2), typeof(ScrollView), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ scrollView.ScrollPositionDelta = (Vector2)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ return scrollView.ScrollPositionDelta;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty StartPagePositionProperty = BindableProperty.Create("StartPagePosition", typeof(Vector3), typeof(ScrollView), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ scrollView.StartPagePosition = (Vector3)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ return scrollView.StartPagePosition;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ScrollModeProperty = BindableProperty.Create("ScrollMode", typeof(PropertyMap), typeof(ScrollView), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ scrollView.ScrollMode = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var scrollView = ((ScrollView)bindable).scrollView;
+ return scrollView.ScrollMode;
+ });
+
+ /// <summary>
+ /// SnapStarted can be used to subscribe or unsubscribe the event handler
+ /// The SnapStarted signal is emitted when the ScrollView has started to snap or flick (it tells the target
+ /// position, scale, rotation for the snap or flick).
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event DaliEventHandler<object, SnapStartedEventArgs> SnapStarted
+ {
+ add
+ {
+ scrollView.SnapStarted += value;
+ }
+
+ remove
+ {
+ scrollView.SnapStarted -= value;
+ }
+ }
+
+ /// <summary>
+ /// Gets snap-animation's AlphaFunction.
+ /// </summary>
+ /// <returns>Current easing alpha function of the snap animation.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public AlphaFunction GetScrollSnapAlphaFunction()
+ {
+ return scrollView.GetScrollSnapAlphaFunction();
+ }
+
+ /// <summary>
+ /// Sets snap-animation's AlphaFunction.
+ /// </summary>
+ /// <param name="alpha">Easing alpha function of the snap animation.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetScrollSnapAlphaFunction(AlphaFunction alpha)
+ {
+ scrollView.SetScrollSnapAlphaFunction(alpha);
+ }
+
+ /// <summary>
+ /// Gets flick-animation's AlphaFunction.
+ /// </summary>
+ /// <returns>Current easing alpha function of the flick animation.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public AlphaFunction GetScrollFlickAlphaFunction()
+ {
+ return scrollView.GetScrollFlickAlphaFunction();
+ }
+
+ /// <summary>
+ /// Sets flick-animation's AlphaFunction.
+ /// </summary>
+ /// <param name="alpha">Easing alpha function of the flick animation.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetScrollFlickAlphaFunction(AlphaFunction alpha)
+ {
+ scrollView.SetScrollFlickAlphaFunction(alpha);
+ }
+
+ /// <summary>
+ /// Gets the time for the scroll snap-animation.
+ /// </summary>
+ /// <returns>The time in seconds for the animation to take.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float GetScrollSnapDuration()
+ {
+ return scrollView.GetScrollSnapDuration();
+ }
+
+ /// <summary>
+ /// Sets the time for the scroll snap-animation.
+ /// </summary>
+ /// <param name="time">The time in seconds for the animation to take.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetScrollSnapDuration(float time)
+ {
+ scrollView.SetScrollSnapDuration(time);
+ }
+
+ /// <summary>
+ /// Gets the time for the scroll flick-animation.
+ /// </summary>
+ /// <returns>The time in seconds for the animation to take.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float GetScrollFlickDuration()
+ {
+ return scrollView.GetScrollFlickDuration();
+ }
+
+ /// <summary>
+ /// Sets the time for the scroll snap-animation.
+ /// </summary>
+ /// <param name="time">The time in seconds for the animation to take.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetScrollFlickDuration(float time)
+ {
+ scrollView.SetScrollFlickDuration(time);
+ }
+
+ /// <summary>
+ /// Sets scroll sensibility of pan gesture.
+ /// </summary>
+ /// <param name="sensitive">True to enable scroll, false to disable scrolling.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetScrollSensitive(bool sensitive)
+ {
+ scrollView.SetScrollSensitive(sensitive);
+ }
+
+ /// <summary>
+ /// Sets maximum overshoot amount.
+ /// </summary>
+ /// <param name="overshootX">The maximum number of horizontally scrolled pixels before overshoot X reaches 1.0f.</param>
+ /// <param name="overshootY">The maximum number of vertically scrolled pixels before overshoot X reaches 1.0f.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetMaxOvershoot(float overshootX, float overshootY)
+ {
+ scrollView.SetMaxOvershoot(overshootX, OvershootY);
+ }
+
+ /// <summary>
+ /// Sets Snap Overshoot animation's AlphaFunction.
+ /// </summary>
+ /// <param name="alpha">Easing alpha function of the overshoot snap animation.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetSnapOvershootAlphaFunction(AlphaFunction alpha)
+ {
+ scrollView.SetSnapOvershootAlphaFunction(alpha);
+ }
+
+ /// <summary>
+ /// Sets Snap Overshoot animation's Duration.
+ /// </summary>
+ /// <param name="duration">duration The duration of the overshoot snap animation.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetSnapOvershootDuration(float duration)
+ {
+ scrollView.SetSnapOvershootDuration(duration);
+ }
+
+ /// <summary>
+ /// Enables or Disables Actor Auto-Snap mode.<br />
+ /// When Actor Auto-Snap mode has been enabled, ScrollView will automatically,
+ /// snap to the closest actor (The closest actor will appear in the center of the ScrollView).
+ /// </summary>
+ /// <param name="enable">Enables (true), or disables (false) Actor AutoSnap.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetViewAutoSnap(bool enable)
+ {
+ scrollView.SetViewAutoSnap(enable);
+ }
+
+ /// <summary>
+ /// Enables or Disables Wrap mode for ScrollView contents.<br />
+ /// When enabled, the ScrollView contents are wrapped over the X/Y Domain.
+ /// </summary>
+ /// <param name="enable">Enables (true), or disables (false) Wrap Mode.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetWrapMode(bool enable)
+ {
+ scrollView.SetWrapMode(enable);
+ }
+
+ /// <summary>
+ /// Gets the current distance needed to scroll for ScrollUpdatedSignal to be emitted.
+ /// </summary>
+ /// <returns>Current scroll update distance.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int GetScrollUpdateDistance()
+ {
+ return scrollView.GetScrollUpdateDistance();
+ }
+
+ /// <summary>
+ /// Sets the distance needed to scroll for ScrollUpdatedSignal to be emitted.<br />
+ /// The scroll update distance tells ScrollView how far to move before ScrollUpdatedSignal the informs application.<br />
+ /// Each time the ScrollView crosses this distance the signal will be emitted.<br />
+ /// </summary>
+ /// <param name="distance">The distance for ScrollView to move before emitting update signal.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetScrollUpdateDistance(int distance)
+ {
+ scrollView.SetScrollUpdateDistance(distance);
+ }
+
+ /// <summary>
+ /// Returns state of Axis Auto Lock mode.
+ /// </summary>
+ /// <returns>Whether Axis Auto Lock mode has been enabled or not.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool GetAxisAutoLock()
+ {
+ return scrollView.GetAxisAutoLock();
+ }
+
+ /// <summary>
+ /// Enables or Disables Axis Auto Lock mode for panning within the ScrollView.<br />
+ /// When enabled, any pan gesture that appears mostly horizontal or mostly
+ /// vertical, will be automatically restricted to horizontal only or vertical
+ /// only panning, until the pan gesture has completed.
+ /// </summary>
+ /// <param name="enable">Enables (true), or disables (false) AxisAutoLock mode.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetAxisAutoLock(bool enable)
+ {
+ scrollView.SetAxisAutoLock(enable);
+ }
+
+ /// <summary>
+ /// Gets the gradient threshold at which a panning gesture should be locked to the Horizontal or Vertical axis.
+ /// </summary>
+ /// <returns>The gradient, a value between 0.0 and 1.0f.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float GetAxisAutoLockGradient()
+ {
+ return scrollView.GetAxisAutoLockGradient();
+ }
+
+ /// <summary>
+ /// Sets the gradient threshold at which a panning gesture should be locked to the Horizontal or Vertical axis.<br />
+ /// By default, this is 0.36 (0.36:1) which means angles less than 20 degrees to an axis will lock to that axis.<br />
+ /// </summary>
+ /// <param name="gradient">gradient A value between 0.0 and 1.0 (auto-lock for all angles).</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetAxisAutoLockGradient(float gradient)
+ {
+ scrollView.SetAxisAutoLockGradient(gradient);
+ }
+
+ /// <summary>
+ /// Gets the friction coefficient setting for ScrollView when flicking in free panning mode.
+ /// This is a value in stage-diagonals per second^2, stage-diagonal = Length( stage.width, stage.height )
+ /// </summary>
+ /// <returns>Friction coefficient is returned.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float GetFrictionCoefficient()
+ {
+ return scrollView.GetFrictionCoefficient();
+ }
+
+ /// <summary>
+ /// Sets the friction coefficient for ScrollView when flicking.<br />
+ /// </summary>
+ /// <param name="friction">Friction coefficient must be greater than 0.0 (default = 1.0).</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetFrictionCoefficient(float friction)
+ {
+ scrollView.SetFrictionCoefficient(friction);
+ }
+
+ /// <summary>
+ /// Gets the flick speed coefficient for ScrollView when flicking in free panning mode.<br />
+ /// This is a constant which multiplies the input touch flick velocity to determine the actual velocity at which to move the scrolling area.
+ /// </summary>
+ /// <returns>The flick speed coefficient is returned.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float GetFlickSpeedCoefficient()
+ {
+ return scrollView.GetFlickSpeedCoefficient();
+ }
+
+ /// <summary>
+ /// Sets the flick speed coefficient for ScrollView when flicking in free panning mode.<br />
+ /// This is a constant which multiplies the input touch flick velocity to determine the actual velocity at
+ /// which to move the scrolling area.<br />
+ /// </summary>
+ /// <param name="speed">The flick speed coefficient (default = 1.0).</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetFlickSpeedCoefficient(float speed)
+ {
+ scrollView.SetFlickSpeedCoefficient(speed);
+ }
+
+ /// <summary>
+ /// Gets the minimum pan distance required for a flick gesture in pixels.<br />
+ /// </summary>
+ /// <returns>Minimum pan distance vector with separate x and y distance.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector2 GetMinimumDistanceForFlick()
+ {
+ return scrollView.GetMinimumDistanceForFlick();
+ }
+
+ /// <summary>
+ /// Sets the minimum pan distance required for a flick in pixels.<br />
+ /// Takes a Vector2 containing separate x and y values. As long as the pan distance exceeds one of these axes, a flick will be allowed.
+ /// </summary>
+ /// <param name="distance">The flick speed coefficient (default = 1.0).</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetMinimumDistanceForFlick(Vector2 distance)
+ {
+ scrollView.SetMinimumDistanceForFlick(distance);
+ }
+
+ /// <summary>
+ /// Returns the minimum pan speed required for a flick gesture in pixels per second.
+ /// </summary>
+ /// <returns>Minimum pan speed.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float GetMinimumSpeedForFlick()
+ {
+ return scrollView.GetMinimumSpeedForFlick();
+ }
+
+ /// <summary>
+ /// Sets the minimum pan speed required for a flick in pixels per second.<br />
+ /// </summary>
+ /// <param name="speed">The minimum pan speed for a flick.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetMinimumSpeedForFlick(float speed)
+ {
+ scrollView.SetMinimumSpeedForFlick(speed);
+ }
+
+ /// <summary>
+ /// Gets the maximum flick speed setting for ScrollView when flicking in free panning mode.<br />
+ /// This is a value in stage-diagonals per second.
+ /// </summary>
+ /// <returns>Maximum flick speed is returned.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float GetMaxFlickSpeed()
+ {
+ return scrollView.GetMaxFlickSpeed();
+ }
+
+ /// <summary>
+ /// Sets the maximum flick speed for the ScrollView when flicking in free panning mode.<br />
+ /// This is a value in stage-diagonals per second. stage-diagonal = Length( stage.width, stage.height ).<br />
+ /// </summary>
+ /// <param name="speed">Maximum flick speed (default = 3.0).</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetMaxFlickSpeed(float speed)
+ {
+ scrollView.SetMaxFlickSpeed(speed);
+ }
+
+ /// <summary>
+ /// Gets the step of scroll distance in actor coordinates for each wheel event received in free panning mode.<br />
+ /// </summary>
+ /// <returns>The step of scroll distance(pixel) in X and Y axes.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector2 GetWheelScrollDistanceStep()
+ {
+ return scrollView.GetWheelScrollDistanceStep();
+ }
+
+ /// <summary>
+ /// Sets the step of scroll distance in actor coordinates for each wheel event received in free panning mode.<br />
+ /// </summary>
+ /// <param name="step">step The step of scroll distance(pixel) in X and Y axes.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetWheelScrollDistanceStep(Vector2 step)
+ {
+ scrollView.SetWheelScrollDistanceStep(step);
+ }
+
+ /// <summary>
+ /// Retrieves current scroll position.<br />
+ /// </summary>
+ /// <returns>The current scroll position.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector2 GetCurrentScrollPosition()
+ {
+ return scrollView.GetCurrentScrollPosition();
+ }
+
+ /// <summary>
+ /// Retrieves current scroll page based on ScrollView dimensions being the size of one page, and all pages laid out in<br />
+ /// a grid fashion, increasing from left to right until the end of the X-domain.
+ /// </summary>
+ /// <returns>The current scroll position.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public uint GetCurrentPage()
+ {
+ return scrollView.GetCurrentPage();
+ }
+
+ /// <summary>
+ /// Scrolls View to position specified (contents will scroll to this position).
+ /// </summary>
+ /// <param name="position">The position to scroll to.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void ScrollTo(Vector2 position)
+ {
+ scrollView.ScrollTo(position);
+ }
+
+ /// <summary>
+ /// Scrolls View to position specified (contents will scroll to this position).
+ /// </summary>
+ /// <param name="position">The position to scroll to.</param>
+ /// <param name="duration">The duration of the animation in seconds.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void ScrollTo(Vector2 position, float duration)
+ {
+ scrollView.ScrollTo(position, duration);
+ }
+
+ /// <summary>
+ /// Scrolls View to position specified (contents will scroll to this position).
+ /// </summary>
+ /// <param name="position">The position to scroll to.</param>
+ /// <param name="duration">The duration of the animation in seconds.</param>
+ /// <param name="alpha">The alpha function to use.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void ScrollTo(Vector2 position, float duration, AlphaFunction alpha)
+ {
+ scrollView.ScrollTo(position, duration, alpha);
+ }
+
+ /// <summary>
+ /// Scrolls View to position specified (contents will scroll to this position).
+ /// </summary>
+ /// <param name="position">The position to scroll to.</param>
+ /// <param name="duration">The duration of the animation in seconds.</param>
+ /// <param name="horizontalBias">Whether to bias scrolling to left or right.</param>
+ /// <param name="verticalBias">Whether to bias scrolling to top or bottom.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void ScrollTo(Vector2 position, float duration, DirectionBias horizontalBias, DirectionBias verticalBias)
+ {
+ scrollView.ScrollTo(position, duration, horizontalBias, verticalBias);
+ }
+
+ /// <summary>
+ /// Scrolls View to position specified (contents will scroll to this position).
+ /// </summary>
+ /// <param name="position">The position to scroll to.</param>
+ /// <param name="duration">The duration of the animation in seconds.</param>
+ /// <param name="alpha">Alpha function to use.</param>
+ /// <param name="horizontalBias">Whether to bias scrolling to left or right.</param>
+ /// <param name="verticalBias">Whether to bias scrolling to top or bottom.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void ScrollTo(Vector2 position, float duration, AlphaFunction alpha, DirectionBias horizontalBias, DirectionBias verticalBias)
+ {
+ scrollView.ScrollTo(position, duration, alpha, horizontalBias, verticalBias);
+ }
+
+ /// <summary>
+ /// Scrolls View to position specified (contents will scroll to this position).
+ /// </summary>
+ /// <param name="page">The page to scroll to.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void ScrollTo(uint page)
+ {
+ scrollView.ScrollTo(page);
+ }
+
+ /// <summary>
+ /// Scrolls View to position specified (contents will scroll to this position).
+ /// </summary>
+ /// <param name="page">The page to scroll to.</param>
+ /// <param name="duration">The duration of the animation in seconds.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void ScrollTo(uint page, float duration)
+ {
+ scrollView.ScrollTo(page, duration);
+ }
+
+ /// <summary>
+ /// Scrolls View to position specified (contents will scroll to this position).
+ /// </summary>
+ /// <param name="page">The page to scroll to.</param>
+ /// <param name="duration">The duration of the animation in seconds.</param>
+ /// <param name="bias">Whether to bias scrolling to left or right.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void ScrollTo(uint page, float duration, DirectionBias bias)
+ {
+ scrollView.ScrollTo(page, duration, bias);
+ }
+
+ /// <summary>
+ /// Scrolls View to position specified (contents will scroll to this position).
+ /// </summary>
+ /// <param name="view">The view to center in on (via Scrolling).</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void ScrollTo(View view)
+ {
+ scrollView.ScrollTo(view.handleInstance as Tizen.NUI.BaseComponents.View);
+ }
+
+ /// <summary>
+ /// Scrolls View to position specified (contents will scroll to this position).
+ /// </summary>
+ /// <param name="view">The view to center in on (via Scrolling).</param>
+ /// <param name="duration">The duration of the animation in seconds.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void ScrollTo(View view, float duration)
+ {
+ scrollView.ScrollTo(view.handleInstance as Tizen.NUI.BaseComponents.View, duration);
+ }
+
+ /// <summary>
+ /// Scrolls View to the nearest snap points as specified by the Rulers.<br />
+ /// If already at snap points, then will return false, and not scroll.<br />
+ /// </summary>
+ /// <returns>True if Snapping necessary.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool ScrollToSnapPoint()
+ {
+ return scrollView.ScrollToSnapPoint();
+ }
+
+ /// <summary>
+ /// Applies Effect to ScrollView.
+ /// </summary>
+ /// <param name="effect">The effect to apply to scroll view.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void ApplyEffect(ScrollViewEffect effect)
+ {
+ scrollView.ApplyEffect(effect);
+ }
+
+ /// <summary>
+ /// Removes Effect from ScrollView.
+ /// </summary>
+ /// <param name="effect">The effect to remove.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void RemoveEffect(ScrollViewEffect effect)
+ {
+ scrollView.RemoveEffect(effect);
+ }
+
+ /// <summary>
+ /// Remove All Effects from ScrollView.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void RemoveAllEffects()
+ {
+ scrollView.RemoveAllEffects();
+ }
+
+ /// <summary>
+ /// Binds view to this ScrollView.
+ /// Once an actor is bound to a ScrollView, it will be subject to that ScrollView's properties.
+ /// </summary>
+ /// <param name="child">The view to add to this ScrollView.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void BindView(View child)
+ {
+ scrollView.BindView(child.handleInstance as Tizen.NUI.BaseComponents.View);
+ }
+
+ /// <summary>
+ /// Unbinds view to this ScrollView.
+ /// Once an actor is bound to a ScrollView, it will be subject to that ScrollView's properties.
+ /// </summary>
+ /// <param name="child">The view to remove to this ScrollView.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void UnbindView(View child)
+ {
+ scrollView.UnbindView(child.handleInstance as Tizen.NUI.BaseComponents.View);
+ }
+
+ /// <summary>
+ /// Allows the user to constrain the scroll view in a particular direction.
+ /// </summary>
+ /// <param name="direction">The axis to constrain the scroll-view to.</param>
+ /// <param name="threshold">The threshold to apply around the axis.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetScrollingDirection(Radian direction, Radian threshold)
+ {
+ scrollView.SetScrollingDirection(direction, threshold);
+ }
+
+ /// <summary>
+ /// Allows the user to constrain the scroll view in a particular direction.
+ /// </summary>
+ /// <param name="direction">The axis to constrain the scroll-view to.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetScrollingDirection(Radian direction)
+ {
+ scrollView.SetScrollingDirection(direction);
+ }
+
+ /// <summary>
+ /// Removes a direction constraint from the scroll view.
+ /// </summary>
+ /// <param name="direction">The axis to constrain the scroll-view to.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void RemoveScrollingDirection(Radian direction)
+ {
+ scrollView.RemoveScrollingDirection(direction);
+ }
+
+ /// <summary>
+ /// Sets and Gets WrapEnabled property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool WrapEnabled
+ {
+ get
+ {
+ return (bool)GetValue(WrapEnabledProperty);
+ }
+ set
+ {
+ SetValue(WrapEnabledProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Sets and Gets PanningEnabled property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool PanningEnabled
+ {
+ get
+ {
+ return (bool)GetValue(PanningEnabledProperty);
+ }
+ set
+ {
+ SetValue(PanningEnabledProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Sets and Gets AxisAutoLockEnabled property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool AxisAutoLockEnabled
+ {
+ get
+ {
+ return (bool)GetValue(AxisAutoLockEnabledProperty);
+ }
+ set
+ {
+ SetValue(AxisAutoLockEnabledProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Sets and Gets WheelScrollDistanceStep property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector2 WheelScrollDistanceStep
+ {
+ get
+ {
+ return (Vector2)GetValue(WheelScrollDistanceStepProperty);
+ }
+ set
+ {
+ SetValue(WheelScrollDistanceStepProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Sets and Gets ScrollPosition property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector2 ScrollPosition
+ {
+ get
+ {
+ return (Vector2)GetValue(ScrollPositionProperty);
+ }
+ set
+ {
+ SetValue(ScrollPositionProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Sets and Gets ScrollPrePosition property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector2 ScrollPrePosition
+ {
+ get
+ {
+ return (Vector2)GetValue(ScrollPrePositionProperty);
+ }
+ set
+ {
+ SetValue(ScrollPrePositionProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Sets and Gets ScrollPrePositionMax property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector2 ScrollPrePositionMax
+ {
+ get
+ {
+ return (Vector2)GetValue(ScrollPrePositionMaxProperty);
+ }
+ set
+ {
+ SetValue(ScrollPrePositionMaxProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Sets and Gets OvershootX property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float OvershootX
+ {
+ get
+ {
+ return (float)GetValue(OvershootXProperty);
+ }
+ set
+ {
+ SetValue(OvershootXProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Sets and Gets OvershootY property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float OvershootY
+ {
+ get
+ {
+ return (float)GetValue(OvershootYProperty);
+ }
+ set
+ {
+ SetValue(OvershootYProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Sets and Gets ScrollFinal property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector2 ScrollFinal
+ {
+ get
+ {
+ return (Vector2)GetValue(ScrollFinalProperty);
+ }
+ set
+ {
+ SetValue(ScrollFinalProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Sets and Gets Wrap property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool Wrap
+ {
+ get
+ {
+ return (bool)GetValue(WrapProperty);
+ }
+ set
+ {
+ SetValue(WrapProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Sets and Gets Panning property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool Panning
+ {
+ get
+ {
+ return (bool)GetValue(PanningProperty);
+ }
+ set
+ {
+ SetValue(PanningProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Sets and Gets Scrolling property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool Scrolling
+ {
+ get
+ {
+ return (bool)GetValue(ScrollingProperty);
+ }
+ set
+ {
+ SetValue(ScrollingProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Sets and Gets ScrollDomainSize property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector2 ScrollDomainSize
+ {
+ get
+ {
+ return (Vector2)GetValue(ScrollDomainSizeProperty);
+ }
+ set
+ {
+ SetValue(ScrollDomainSizeProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Sets and Gets ScrollDomainOffset property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector2 ScrollDomainOffset
+ {
+ get
+ {
+ return (Vector2)GetValue(ScrollDomainOffsetProperty);
+ }
+ set
+ {
+ SetValue(ScrollDomainOffsetProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Sets and Gets ScrollPositionDelta property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector2 ScrollPositionDelta
+ {
+ get
+ {
+ return (Vector2)GetValue(ScrollPositionDeltaProperty);
+ }
+ set
+ {
+ SetValue(ScrollPositionDeltaProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Sets and Gets StartPagePosition property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector3 StartPagePosition
+ {
+ get
+ {
+ return (Vector3)GetValue(StartPagePositionProperty);
+ }
+ set
+ {
+ SetValue(StartPagePositionProperty, value);
+ }
+ }
+
+
+ /// <summary>
+ /// Sets and Gets ScrollMode property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap ScrollMode
+ {
+ get
+ {
+ return (PropertyMap)GetValue(ScrollModeProperty);
+ }
+ set
+ {
+ SetValue(ScrollModeProperty, value);
+ }
+ }
+
+ }
+
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System;
+using System.Runtime.InteropServices;
+using System.ComponentModel;
+using Tizen.NUI.Xaml.Forms.BaseComponents;
+using Tizen.NUI.XamlBinding;
+using Tizen.NUI;
+using static Tizen.NUI.UIComponents.Slider;
+
+namespace Tizen.NUI.Xaml.UIComponents
+{
+ /// <summary>
+ /// The slider is a control to enable sliding an indicator between two values.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class Slider : View
+ {
+ private Tizen.NUI.UIComponents.Slider _slider;
+ internal Tizen.NUI.UIComponents.Slider slider
+ {
+ get
+ {
+ if (null == _slider)
+ {
+ _slider = handleInstance as Tizen.NUI.UIComponents.Slider;
+ }
+
+ return _slider;
+ }
+ }
+
+ /// <summary>
+ /// Creates the slider control.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Slider() : this(new Tizen.NUI.UIComponents.Slider())
+ {
+ }
+
+ internal Slider(Tizen.NUI.UIComponents.Slider nuiInstance) : base(nuiInstance)
+ {
+ SetNUIInstance(nuiInstance);
+
+ nuiInstance.ValueChanged += (object source, ValueChangedEventArgs e) =>
+ {
+ Slider thisSlider = Tizen.NUI.Xaml.Forms.BaseHandle.GetHandle((Tizen.NUI.BaseHandle)source) as Slider;
+ thisSlider.ForceNotify(ValueProperty);
+ return true;
+ };
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty LowerBoundProperty = BindableProperty.Create("LowerBound", typeof(float), typeof(Slider), 0.0f, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var slider = ((Slider)bindable).slider;
+ slider.LowerBound = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var slider = ((Slider)bindable).slider;
+ return slider.LowerBound;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty UpperBoundProperty = BindableProperty.Create("UpperBound", typeof(float), typeof(Slider), 1.0f, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var slider = ((Slider)bindable).slider;
+ slider.UpperBound = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var slider = ((Slider)bindable).slider;
+ return slider.UpperBound;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ValueProperty = BindableProperty.Create("Value", typeof(float), typeof(Slider), default(float), BindingMode.TwoWay, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var slider = ((Slider)bindable).slider;
+ slider.Value = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var slider = ((Slider)bindable).slider;
+ return slider.Value;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty TrackVisualProperty = BindableProperty.Create("TrackVisual", typeof(PropertyMap), typeof(Slider), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var slider = ((Slider)bindable).slider;
+ slider.TrackVisual = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var slider = ((Slider)bindable).slider;
+ return slider.TrackVisual;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty HandleVisualProperty = BindableProperty.Create("HandleVisual", typeof(PropertyMap), typeof(Slider), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var slider = ((Slider)bindable).slider;
+ slider.HandleVisual = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var slider = ((Slider)bindable).slider;
+ return slider.HandleVisual;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ProgressVisualProperty = BindableProperty.Create("ProgressVisual", typeof(PropertyMap), typeof(Slider), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var slider = ((Slider)bindable).slider;
+ slider.ProgressVisual = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var slider = ((Slider)bindable).slider;
+ return slider.ProgressVisual;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty PopupVisualProperty = BindableProperty.Create("PopupVisual", typeof(PropertyMap), typeof(Slider), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var slider = ((Slider)bindable).slider;
+ slider.PopupVisual = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var slider = ((Slider)bindable).slider;
+ return slider.PopupVisual;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty PopupArrowVisualProperty = BindableProperty.Create("PopupArrowVisual", typeof(PropertyMap), typeof(Slider), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var slider = ((Slider)bindable).slider;
+ slider.PopupArrowVisual = (PropertyMap)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var slider = ((Slider)bindable).slider;
+ return slider.PopupArrowVisual;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty DisabledColorProperty = BindableProperty.Create("DisabledColor", typeof(Vector4), typeof(Slider), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var slider = ((Slider)bindable).slider;
+ slider.DisabledColor = (Vector4)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var slider = ((Slider)bindable).slider;
+ return slider.DisabledColor;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ValuePrecisionProperty = BindableProperty.Create("ValuePrecision", typeof(int), typeof(Slider), default(int), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var slider = ((Slider)bindable).slider;
+ slider.ValuePrecision = (int)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var slider = ((Slider)bindable).slider;
+ return slider.ValuePrecision;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ShowPopupProperty = BindableProperty.Create("ShowPopup", typeof(bool), typeof(Slider), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var slider = ((Slider)bindable).slider;
+ slider.ShowPopup = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var slider = ((Slider)bindable).slider;
+ return slider.ShowPopup;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ShowValueProperty = BindableProperty.Create("ShowValue", typeof(bool), typeof(Slider), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var slider = ((Slider)bindable).slider;
+ slider.ShowValue = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var slider = ((Slider)bindable).slider;
+ return slider.ShowValue;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty MarksProperty = BindableProperty.Create("Marks", typeof(PropertyArray), typeof(Slider), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var slider = ((Slider)bindable).slider;
+ slider.Marks = (PropertyArray)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var slider = ((Slider)bindable).slider;
+ return slider.Marks;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty MarkToleranceProperty = BindableProperty.Create("MarkTolerance", typeof(float), typeof(Slider), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var slider = ((Slider)bindable).slider;
+ slider.MarkTolerance = (float)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var slider = ((Slider)bindable).slider;
+ return slider.MarkTolerance;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty SnapToMarksProperty = BindableProperty.Create("SnapToMarks", typeof(bool), typeof(Slider), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var slider = ((Slider)bindable).slider;
+ slider.SnapToMarks = (bool)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var slider = ((Slider)bindable).slider;
+ return slider.SnapToMarks;
+ });
+
+
+ /// <summary>
+ /// An event emitted when the slider value changes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandlerWithReturnType<object, ValueChangedEventArgs, bool> ValueChanged
+ {
+ add
+ {
+ slider.ValueChanged += value;
+ }
+ remove
+ {
+ slider.ValueChanged -= value;
+ }
+ }
+
+ /// <summary>
+ /// An event emitted when the sliding is finished.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandlerWithReturnType<object, SlidingFinishedEventArgs, bool> SlidingFinished
+ {
+ add
+ {
+ slider.SlidingFinished += value;
+ }
+ remove
+ {
+ slider.SlidingFinished -= value;
+ }
+ }
+
+ /// <summary>
+ /// An event emitted when the slider handle reaches a mark.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandlerWithReturnType<object, MarkReachedEventArgs, bool> MarkReached
+ {
+ add
+ {
+ slider.MarkReached += value;
+ }
+ remove
+ {
+ slider.MarkReached -= value;
+ }
+ }
+
+ /// <summary>
+ /// Downcasts an object handle to the slider.<br />
+ /// If the handle points to a slider, then the downcast produces a valid handle.<br />
+ /// If not, then the returned handle is left uninitialized.<br />
+ /// </summary>
+ /// <param name="handle">The handle to an object.</param>
+ /// <returns>The handle to a slider or an uninitialized handle.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static Slider DownCast(Tizen.NUI.Xaml.Forms.BaseHandle handle)
+ {
+ return Tizen.NUI.Xaml.Forms.BaseHandle.GetHandle(handle.handleInstance) as Slider;
+ }
+
+ /// <summary>
+ /// The lower bound property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float LowerBound
+ {
+ get
+ {
+ return (float)GetValue(LowerBoundProperty);
+ }
+ set
+ {
+ SetValue(LowerBoundProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The upper bound property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float UpperBound
+ {
+ get
+ {
+ return (float)GetValue(UpperBoundProperty);
+ }
+ set
+ {
+ SetValue(UpperBoundProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The value property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float Value
+ {
+ get
+ {
+ return (float)GetValue(ValueProperty);
+ }
+ set
+ {
+ SetValue(ValueProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The track visual property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap TrackVisual
+ {
+ get
+ {
+ return (PropertyMap)GetValue(TrackVisualProperty);
+ }
+ set
+ {
+ SetValue(TrackVisualProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The handle visual property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap HandleVisual
+ {
+ get
+ {
+ return (PropertyMap)GetValue(HandleVisualProperty);
+ }
+ set
+ {
+ SetValue(HandleVisualProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The progress visual property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap ProgressVisual
+ {
+ get
+ {
+ return (PropertyMap)GetValue(ProgressVisualProperty);
+ }
+ set
+ {
+ SetValue(ProgressVisualProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The popup visual property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap PopupVisual
+ {
+ get
+ {
+ return (PropertyMap)GetValue(PopupVisualProperty);
+ }
+ set
+ {
+ SetValue(PopupVisualProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The popup arrow visual property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyMap PopupArrowVisual
+ {
+ get
+ {
+ return (PropertyMap)GetValue(PopupArrowVisualProperty);
+ }
+ set
+ {
+ SetValue(PopupArrowVisualProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The disable color property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector4 DisabledColor
+ {
+ get
+ {
+ return (Vector4)GetValue(DisabledColorProperty);
+ }
+ set
+ {
+ SetValue(DisabledColorProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The value precision property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int ValuePrecision
+ {
+ get
+ {
+ return (int)GetValue(ValuePrecisionProperty);
+ }
+ set
+ {
+ SetValue(ValuePrecisionProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The show popup property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool ShowPopup
+ {
+ get
+ {
+ return (bool)GetValue(ShowPopupProperty);
+ }
+ set
+ {
+ SetValue(ShowPopupProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The show value property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool ShowValue
+ {
+ get
+ {
+ return (bool)GetValue(ShowValueProperty);
+ }
+ set
+ {
+ SetValue(ShowValueProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The marks property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyArray Marks
+ {
+ get
+ {
+ return (PropertyArray)GetValue(MarksProperty);
+ }
+ set
+ {
+ SetValue(MarksProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The snap to marks property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool SnapToMarks
+ {
+ get
+ {
+ return (bool)GetValue(SnapToMarksProperty);
+ }
+ set
+ {
+ SetValue(SnapToMarksProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The mark tolerance property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float MarkTolerance
+ {
+ get
+ {
+ return (float)GetValue(MarkToleranceProperty);
+ }
+ set
+ {
+ SetValue(MarkToleranceProperty, value);
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System.ComponentModel;
+using Tizen.NUI;
+using Tizen.NUI.XamlBinding;
+
+namespace Tizen.NUI.Xaml.UIComponents
+{
+
+ /// <summary>
+ /// A ToggleButton allows the user to change a setting between two or more states.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class ToggleButton : Button
+ {
+ private Tizen.NUI.ToggleButton _toggleButton;
+ internal Tizen.NUI.ToggleButton toggleButton
+ {
+ get
+ {
+ if (null == _toggleButton)
+ {
+ _toggleButton = handleInstance as Tizen.NUI.ToggleButton;
+ }
+
+ return _toggleButton;
+ }
+ }
+
+ /// <summary>
+ /// Create an instance for toggleButton.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ToggleButton() : this(new Tizen.NUI.ToggleButton())
+ {
+ }
+
+ internal ToggleButton(Tizen.NUI.ToggleButton nuiInstance) : base(nuiInstance)
+ {
+ SetNUIInstance(nuiInstance);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty StateVisualsProperty = BindableProperty.Create("StateVisuals", typeof(PropertyArray), typeof(ToggleButton), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var toggleButton = ((ToggleButton)bindable).toggleButton;
+ toggleButton.StateVisuals = (PropertyArray)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var toggleButton = ((ToggleButton)bindable).toggleButton;
+ return toggleButton.StateVisuals;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty TooltipsProperty = BindableProperty.Create("Tooltips", typeof(PropertyArray), typeof(ToggleButton), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var toggleButton = ((ToggleButton)bindable).toggleButton;
+ toggleButton.Tooltips = (PropertyArray)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var toggleButton = ((ToggleButton)bindable).toggleButton;
+ return toggleButton.Tooltips;
+ });
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty CurrentStateIndexProperty = BindableProperty.Create("CurrentStateIndex", typeof(int), typeof(ToggleButton), default(int), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var toggleButton = ((ToggleButton)bindable).toggleButton;
+ toggleButton.CurrentStateIndex = (int)newValue;
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var toggleButton = ((ToggleButton)bindable).toggleButton;
+ return toggleButton.CurrentStateIndex;
+ });
+
+ /// <summary>
+ /// Gets and Sets the state visual array of toggle button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyArray StateVisuals
+ {
+ get
+ {
+ return (PropertyArray)GetValue(StateVisualsProperty);
+ }
+ set
+ {
+ SetValue(StateVisualsProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets and Sets the tooltips of toggle button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyArray Tooltips
+ {
+ get
+ {
+ return (PropertyArray)GetValue(TooltipsProperty);
+ }
+ set
+ {
+ SetValue(TooltipsProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// Gets and Sets the current state index of toggle button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int CurrentStateIndex
+ {
+ get
+ {
+ return (int)GetValue(CurrentStateIndexProperty);
+ }
+ set
+ {
+ SetValue(CurrentStateIndexProperty, value);
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using System.ComponentModel;
+
+namespace Tizen.NUI.Xaml
+{
+ /// <summary>
+ /// The interface IMarkupExtension.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public interface IMarkupExtension<out T> : IMarkupExtension
+ {
+ /// <summary>
+ /// The API ProvideValue.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ new T ProvideValue(IServiceProvider serviceProvider);
+ }
+
+ /// <summary>
+ /// The interface IMarkupExtension.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public interface IMarkupExtension
+ {
+ /// <summary>
+ /// The API ProvideValue.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ object ProvideValue(IServiceProvider serviceProvider);
+ }
+
+ /// <summary>
+ /// The class AcceptEmptyServiceProviderAttribute.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [AttributeUsage(AttributeTargets.Class, Inherited = false)]
+ public sealed class AcceptEmptyServiceProviderAttribute : Attribute
+ {
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.ComponentModel;
+
+namespace Tizen.NUI.Xaml
+{
+ /// <summary>
+ /// The interface IProvideValueTarget.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public interface IProvideValueTarget
+ {
+ /// <summary>
+ /// The API TargetObject.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ object TargetObject { get; }
+
+ /// <summary>
+ /// The API TargetObject.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ object TargetProperty { get; }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.ComponentModel;
+
+namespace Tizen.NUI.Xaml
+{
+ /// <summary>
+ /// The interface IReferenceProvider.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public interface IReferenceProvider
+ {
+ /// <summary>
+ /// Find provider by name.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ object FindByName(string name);
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.ComponentModel;
+
+namespace Tizen.NUI.Xaml
+{
+ /// <summary>
+ /// The interface IValueProvider.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public interface IValueProvider
+ {
+ /// <summary>
+ /// Provider value.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ object ProvideValue(IServiceProvider serviceProvider);
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.ComponentModel;
+
+namespace Tizen.NUI.Xaml
+{
+ /// <summary>
+ /// The interface IXamlTypeResolver.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public interface IXamlTypeResolver
+ {
+ /// <summary>
+ /// Resolve xaml.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Type Resolve(string qualifiedTypeName, IServiceProvider serviceProvider = null);
+
+ /// <summary>
+ /// Resolve xaml and out put the type.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ bool TryResolve(string qualifiedTypeName, out Type type);
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.ComponentModel;
+using System.Xml;
+
+namespace Tizen.NUI.Xaml
+{
+ /// <summary>
+ /// The interface IXmlLineInfoProvider.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public interface IXmlLineInfoProvider
+ {
+ /// <summary>
+ /// Attribute XmlLineInfo.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ IXmlLineInfo XmlLineInfo { get; }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel;
+using Tizen.NUI.XamlBinding;
+
+namespace Tizen.NUI.Xaml
+{
+ /// <summary>
+ /// The class ArrayExtension.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [ContentProperty("Items")]
+ [AcceptEmptyServiceProvider]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class ArrayExtension : IMarkupExtension<Array>
+ {
+ /// <summary>
+ /// Create a new ArrayExtension.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ArrayExtension()
+ {
+ Items = new List<object>();
+ }
+
+ /// <summary>
+ /// Attribute Items.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public IList Items { get; }
+
+ /// <summary>
+ /// Attribute Type.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Type Type { get; set; }
+
+ /// <summary>
+ /// Provide value tye service provideer.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Array ProvideValue(IServiceProvider serviceProvider)
+ {
+ if (Type == null)
+ throw new InvalidOperationException("Type argument mandatory for x:Array extension");
+
+ if (Items == null)
+ return null;
+
+ var array = Array.CreateInstance(Type, Items.Count);
+ for (var i = 0; i < Items.Count; i++)
+ ((IList)array)[i] = Items[i];
+
+ return array;
+ }
+
+ object IMarkupExtension.ProvideValue(IServiceProvider serviceProvider)
+ {
+ return (this as IMarkupExtension<Array>).ProvideValue(serviceProvider);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using Tizen.NUI.XamlBinding.Internals;
+using Tizen.NUI.XamlBinding;
+using System.ComponentModel;
+
+namespace Tizen.NUI.Xaml
+{
+ /// <summary>
+ /// The class BindingExtension.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [ContentProperty("Path")]
+ [AcceptEmptyServiceProvider]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public sealed class BindingExtension : IMarkupExtension<BindingBase>
+ {
+ /// <summary>
+ /// Attribute Path.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string Path { get; set; } = Tizen.NUI.XamlBinding.Binding.SelfPath;
+
+ /// <summary>
+ /// Attribute Mode.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public BindingMode Mode { get; set; } = BindingMode.Default;
+
+ /// <summary>
+ /// Attribute Converter.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public IValueConverter Converter { get; set; }
+
+ /// <summary>
+ /// Attribute Converterparameter.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object ConverterParameter { get; set; }
+
+ /// <summary>
+ /// Attribute StringFormat.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string StringFormat { get; set; }
+
+ /// <summary>
+ /// Attribute Source.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object Source { get; set; }
+
+ /// <summary>
+ /// Attribute UpdateSourceEventName.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string UpdateSourceEventName { get; set; }
+
+ /// <summary>
+ /// Attribute TargetNullValue.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object TargetNullValue { get; set; }
+
+ /// <summary>
+ /// Attribute FallbackValue.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object FallbackValue { get; set; }
+
+ /// <summary>
+ /// Attribute TypedBinding.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public TypedBindingBase TypedBinding { get; set; }
+
+ BindingBase IMarkupExtension<BindingBase>.ProvideValue(IServiceProvider serviceProvider)
+ {
+ if (TypedBinding == null)
+ return new Tizen.NUI.XamlBinding.Binding(Path, Mode, Converter, ConverterParameter, StringFormat, Source)
+ {
+ UpdateSourceEventName = UpdateSourceEventName,
+ FallbackValue = FallbackValue,
+ TargetNullValue = TargetNullValue,
+ };
+
+ TypedBinding.Mode = Mode;
+ TypedBinding.Converter = Converter;
+ TypedBinding.ConverterParameter = ConverterParameter;
+ TypedBinding.StringFormat = StringFormat;
+ TypedBinding.Source = Source;
+ TypedBinding.UpdateSourceEventName = UpdateSourceEventName;
+ TypedBinding.FallbackValue = FallbackValue;
+ TypedBinding.TargetNullValue = TargetNullValue;
+ return TypedBinding;
+ }
+
+ object IMarkupExtension.ProvideValue(IServiceProvider serviceProvider)
+ {
+ return (this as IMarkupExtension<BindingBase>).ProvideValue(serviceProvider);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.ComponentModel;
+using Tizen.NUI.XamlBinding;
+using Tizen.NUI.XamlBinding.Internals;
+
+namespace Tizen.NUI.Xaml
+{
+ /// <summary>
+ /// The class DynamicResourceExtension.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [ContentProperty("Key")]
+ public sealed class DynamicResourceExtension : IMarkupExtension<DynamicResource>
+ {
+ /// <summary>
+ /// Attribute Key.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string Key { get; set; }
+
+ /// <summary>
+ /// Provide value tye service provideer.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object ProvideValue(IServiceProvider serviceProvider)
+ {
+ return ((IMarkupExtension<DynamicResource>)this).ProvideValue(serviceProvider);
+ }
+
+ DynamicResource IMarkupExtension<DynamicResource>.ProvideValue(IServiceProvider serviceProvider)
+ {
+ if (Key == null)
+ {
+ var lineInfoProvider = serviceProvider.GetService(typeof (IXmlLineInfoProvider)) as IXmlLineInfoProvider;
+ var lineInfo = (lineInfoProvider != null) ? lineInfoProvider.XmlLineInfo : new XmlLineInfo();
+ throw new XamlParseException("DynamicResource markup require a Key", lineInfo);
+ }
+ return new DynamicResource(Key);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.ComponentModel;
+
+namespace Tizen.NUI.Xaml
+{
+ /// <summary>
+ /// The class NullExtension.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [ProvideCompiled("Tizen.NUI.Xaml.Build.Tasks.NullExtension")]
+ [AcceptEmptyServiceProvider]
+ public class NullExtension : IMarkupExtension
+ {
+ /// <summary>
+ /// Provide value tye service provideer.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object ProvideValue(IServiceProvider serviceProvider)
+ {
+ return null;
+ }
+ }
+}
--- /dev/null
+using System;
+using Tizen.NUI.XamlBinding.Internals;
+using Tizen.NUI.Xaml.Internals;
+using Tizen.NUI.XamlBinding;
+using System.ComponentModel;
+
+namespace Tizen.NUI.Xaml
+{
+ /// <summary>
+ /// The class ReferenceExtension.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [ContentProperty("Name")]
+ public class ReferenceExtension : IMarkupExtension
+ {
+ /// <summary>
+ /// Attribute Name
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string Name { get; set; }
+
+ /// <summary>
+ /// Provide value tye service provideer.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object ProvideValue(IServiceProvider serviceProvider)
+ {
+ if (serviceProvider == null)
+ throw new ArgumentNullException(nameof(serviceProvider));
+ var valueProvider = serviceProvider.GetService(typeof (IProvideValueTarget)) as IProvideParentValues;
+ if (valueProvider == null)
+ throw new ArgumentException("serviceProvider does not provide an IProvideValueTarget");
+ var namescopeprovider = serviceProvider.GetService(typeof (INameScopeProvider)) as INameScopeProvider;
+ if (namescopeprovider != null && namescopeprovider.NameScope != null)
+ {
+ var value = namescopeprovider.NameScope.FindByName(Name);
+ if (value != null)
+ return value;
+ }
+
+ foreach (var target in valueProvider.ParentObjects)
+ {
+ var ns = target as INameScope;
+ if (ns == null)
+ continue;
+ var value = ns.FindByName(Name);
+ if (value != null)
+ return value;
+ }
+
+ var lineInfo = (serviceProvider?.GetService(typeof(IXmlLineInfoProvider)) as IXmlLineInfoProvider)?.XmlLineInfo ?? new XmlLineInfo();
+ throw new XamlParseException($"Can not find the object referenced by `{Name}`", lineInfo);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.ComponentModel;
+using System.Linq;
+using System.Reflection;
+using System.Xml;
+using Tizen.NUI.XamlBinding;
+
+namespace Tizen.NUI.Xaml
+{
+ /// <summary>
+ /// The class StaticExtension.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [ContentProperty(nameof(Member))]
+ [ProvideCompiled("Tizen.NUI.Xaml.Build.Tasks.StaticExtension")]
+ public class StaticExtension : IMarkupExtension
+ {
+ /// <summary>
+ /// Attribute Member
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string Member { get; set; }
+
+ /// <summary>
+ /// Provide value tye service provideer.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object ProvideValue(IServiceProvider serviceProvider)
+ {
+ IXmlLineInfoProvider lineInfoProvider;
+ IXmlLineInfo lineInfo;
+
+ if (serviceProvider == null)
+ throw new ArgumentNullException(nameof(serviceProvider));
+ var typeResolver = serviceProvider.GetService(typeof (IXamlTypeResolver)) as IXamlTypeResolver;
+ if (typeResolver == null)
+ throw new ArgumentException("No IXamlTypeResolver in IServiceProvider");
+
+ if (string.IsNullOrEmpty(Member) || !Member.Contains("."))
+ {
+ lineInfoProvider = serviceProvider.GetService(typeof (IXmlLineInfoProvider)) as IXmlLineInfoProvider;
+ lineInfo = (lineInfoProvider != null) ? lineInfoProvider.XmlLineInfo : new XmlLineInfo();
+ throw new XamlParseException("Syntax for x:Static is [Member=][prefix:]typeName.staticMemberName", lineInfo);
+ }
+
+ var dotIdx = Member.LastIndexOf('.');
+ var typename = Member.Substring(0, dotIdx);
+ var membername = Member.Substring(dotIdx + 1);
+
+ var type = typeResolver.Resolve(typename, serviceProvider);
+
+ var pinfo = type.GetRuntimeProperties().FirstOrDefault(pi => pi.GetMethod != null && pi.Name == membername && pi.GetMethod.IsStatic);
+ if (pinfo != null)
+ return pinfo.GetMethod?.Invoke(null, Array.Empty<object>());
+
+ var finfo = type.GetRuntimeFields().FirstOrDefault(fi => fi.Name == membername && fi.IsStatic);
+ if (finfo != null)
+ return finfo.GetValue(null);
+
+ lineInfoProvider = serviceProvider.GetService(typeof (IXmlLineInfoProvider)) as IXmlLineInfoProvider;
+ lineInfo = (lineInfoProvider != null) ? lineInfoProvider.XmlLineInfo : new XmlLineInfo();
+ throw new XamlParseException($"No static member found for {Member}", lineInfo);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Xml;
+using System.Reflection;
+using System.Linq;
+using Tizen.NUI.XamlBinding;
+using System.ComponentModel;
+
+namespace Tizen.NUI.Xaml
+{
+ /// <summary>
+ /// The class StaticResourceExtension.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [ContentProperty("Key")]
+ public sealed class StaticResourceExtension : IMarkupExtension
+ {
+ /// <summary>
+ /// Attribute Key
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string Key { get; set; }
+
+ /// <summary>
+ /// Provide value tye service provideer.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object ProvideValue(IServiceProvider serviceProvider)
+ {
+ if (serviceProvider == null)
+ throw new ArgumentNullException(nameof(serviceProvider));
+ if (Key == null) {
+ var lineInfoProvider = serviceProvider.GetService(typeof(IXmlLineInfoProvider)) as IXmlLineInfoProvider;
+ var lineInfo = (lineInfoProvider != null) ? lineInfoProvider.XmlLineInfo : new XmlLineInfo();
+ throw new XamlParseException("you must specify a key in {StaticResource}", lineInfo);
+ }
+ var valueProvider = serviceProvider.GetService(typeof(IProvideValueTarget)) as IProvideParentValues;
+ if (valueProvider == null)
+ throw new ArgumentException();
+ var xmlLineInfoProvider = serviceProvider.GetService(typeof(IXmlLineInfoProvider)) as IXmlLineInfoProvider;
+ var xmlLineInfo = xmlLineInfoProvider != null ? xmlLineInfoProvider.XmlLineInfo : null;
+ object resource = null;
+
+ foreach (var p in valueProvider.ParentObjects) {
+ var irp = p as Tizen.NUI.Binding.IResourcesProvider;
+ var resDict = irp != null && irp.IsResourcesCreated ? irp.XamlResources : p as ResourceDictionary;
+ if (resDict == null)
+ continue;
+ if (resDict.TryGetValue(Key, out resource))
+ break;
+ }
+ resource = resource ?? GetApplicationLevelResource(Key, xmlLineInfo);
+
+ var bp = valueProvider.TargetProperty as BindableProperty;
+ var pi = valueProvider.TargetProperty as PropertyInfo;
+ var propertyType = bp?.ReturnType ?? pi?.PropertyType;
+ if (propertyType == null) {
+ if (resource != null) {
+ if (resource.GetType().GetTypeInfo().IsGenericType && (resource.GetType().GetGenericTypeDefinition() == typeof(OnPlatform<>) || resource.GetType().GetGenericTypeDefinition() == typeof(OnIdiom<>))) {
+ // This is only there to support our backward compat story with pre 2.3.3 compiled Xaml project who was not providing TargetProperty
+ var method = resource.GetType().GetRuntimeMethod("op_Implicit", new[] { resource.GetType() });
+ if (method != null) {
+ resource = method.Invoke(null, new[] { resource });
+ }
+ }
+ }
+ return resource;
+ }
+ if (propertyType.IsAssignableFrom(resource?.GetType()))
+ return resource;
+ var implicit_op = resource?.GetType().GetImplicitConversionOperator(fromType: resource?.GetType(), toType: propertyType)
+ ?? propertyType.GetImplicitConversionOperator(fromType: resource?.GetType(), toType: propertyType);
+ if (implicit_op != null)
+ return implicit_op.Invoke(resource, new [] { resource });
+
+ if (resource != null) {
+ //Special case for https://bugzilla.xamarin.com/show_bug.cgi?id=59818
+ //On OnPlatform, check for an opImplicit from the targetType
+ if ( Device.Flags != null
+ && Device.Flags.Contains("xamlDoubleImplicitOpHack")
+ && resource.GetType().GetTypeInfo().IsGenericType
+ && (resource.GetType().GetGenericTypeDefinition() == typeof(OnPlatform<>))) {
+ var tType = resource.GetType().GenericTypeArguments[0];
+ var opImplicit = tType.GetImplicitConversionOperator(fromType: tType, toType: propertyType)
+ ?? propertyType.GetImplicitConversionOperator(fromType: tType, toType: propertyType);
+
+ if (opImplicit != null) {
+ //convert the OnPlatform<T> to T
+ var opPlatformImplicitConversionOperator = resource?.GetType().GetImplicitConversionOperator(fromType: resource?.GetType(), toType: tType);
+ resource = opPlatformImplicitConversionOperator?.Invoke(null, new[] { resource });
+
+ //and convert to toType
+ resource = opImplicit.Invoke(null, new[] { resource });
+ return resource;
+ }
+ }
+ }
+ return resource;
+ }
+
+ internal object GetApplicationLevelResource(string key, IXmlLineInfo xmlLineInfo)
+ {
+ object resource = null;
+ if (Application.Current == null || !((Tizen.NUI.Binding.IResourcesProvider)Application.Current).IsResourcesCreated || !Application.Current.XamlResources.TryGetValue(Key, out resource))
+ throw new XamlParseException($"StaticResource not found for key {Key}", xmlLineInfo);
+ return resource;
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Xml;
+using Tizen.NUI.StyleSheets;
+using System.Reflection;
+using System.IO;
+using Tizen.NUI.XamlBinding;
+using System.ComponentModel;
+
+namespace Tizen.NUI.Xaml
+{
+ /// <summary>
+ /// The class StyleSheetExtension.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [ContentProperty(nameof(Style))]
+ [ProvideCompiled("Tizen.NUI.XamlC.StyleSheetProvider")]
+ public sealed class StyleSheetExtension : IValueProvider
+ {
+ /// <summary>
+ /// Attribute Style
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string Style { get; set; }
+
+ /// <summary>
+ /// Attribute Source
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Uri Source { get; set; }
+
+ object IValueProvider.ProvideValue(IServiceProvider serviceProvider)
+ {
+ IXmlLineInfo lineInfo;
+
+ if (!string.IsNullOrEmpty(Style) && Source != null) {
+ lineInfo = (serviceProvider.GetService(typeof(IXmlLineInfoProvider)) as IXmlLineInfoProvider)?.XmlLineInfo;
+ throw new XamlParseException($"StyleSheet can not have both a Source and a content", lineInfo);
+ }
+
+ if (Source != null) {
+ lineInfo = (serviceProvider.GetService(typeof(IXmlLineInfoProvider)) as IXmlLineInfoProvider)?.XmlLineInfo;
+ if (Source.IsAbsoluteUri)
+ throw new XamlParseException($"Source only accepts Relative URIs", lineInfo);
+
+ var rootObjectType = (serviceProvider.GetService(typeof(IRootObjectProvider)) as IRootObjectProvider)?.RootObject.GetType();
+ if (rootObjectType == null)
+ return null;
+ var rootTargetPath = XamlResourceIdAttribute.GetPathForType(rootObjectType);
+ var resourcePath = ResourceDictionary.RDSourceTypeConverter.GetResourcePath(Source, rootTargetPath);
+ var resString = DependencyService.Get<IResourcesLoader>()?.GetResource(resourcePath, rootObjectType.GetTypeInfo().Assembly, lineInfo);
+ return StyleSheet.FromString(resString);
+ }
+
+ if (!string.IsNullOrEmpty(Style)) {
+ using (var reader = new StringReader(Style))
+ return StyleSheet.FromReader(reader);
+ }
+
+ lineInfo = (serviceProvider.GetService(typeof(IXmlLineInfoProvider)) as IXmlLineInfoProvider)?.XmlLineInfo;
+ throw new XamlParseException($"StyleSheet require either a Source or a content", lineInfo);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.ComponentModel;
+using Tizen.NUI.XamlBinding;
+
+namespace Tizen.NUI.Xaml
+{
+ /// <summary>
+ /// The class TemplateBindingExtension.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [ContentProperty("Path")]
+ [AcceptEmptyServiceProvider]
+ public sealed class TemplateBindingExtension : IMarkupExtension<BindingBase>
+ {
+ internal TemplateBindingExtension()
+ {
+ Mode = BindingMode.Default;
+ Path = Tizen.NUI.XamlBinding.Binding.SelfPath;
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string Path { get; set; }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public BindingMode Mode { get; set; }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public IValueConverter Converter { get; set; }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object ConverterParameter { get; set; }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string StringFormat { get; set; }
+
+ BindingBase IMarkupExtension<BindingBase>.ProvideValue(IServiceProvider serviceProvider)
+ {
+ return new TemplateBinding(Path, Mode, Converter, ConverterParameter, StringFormat);
+ }
+
+ object IMarkupExtension.ProvideValue(IServiceProvider serviceProvider)
+ {
+ return (this as IMarkupExtension<BindingBase>).ProvideValue(serviceProvider);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.ComponentModel;
+using Tizen.NUI.XamlBinding;
+
+namespace Tizen.NUI.Xaml
+{
+ /// <summary>
+ /// The class TemplateBindingExtension.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [ContentProperty(nameof(TypeName))]
+ [ProvideCompiled("Tizen.NUI.Xaml.Build.Tasks.TypeExtension")]
+ public class TypeExtension : IMarkupExtension<Type>
+ {
+ /// <summary>
+ /// Attribute TypeName
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string TypeName { get; set; }
+
+ /// <summary>
+ /// Provide value tye service provideer.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Type ProvideValue(IServiceProvider serviceProvider)
+ {
+ if (string.IsNullOrEmpty(TypeName))
+ throw new InvalidOperationException("TypeName isn't set.");
+ if (serviceProvider == null)
+ throw new ArgumentNullException(nameof(serviceProvider));
+ var typeResolver = serviceProvider.GetService(typeof (IXamlTypeResolver)) as IXamlTypeResolver;
+ if (typeResolver == null)
+ throw new ArgumentException("No IXamlTypeResolver in IServiceProvider");
+
+ return typeResolver.Resolve(TypeName, serviceProvider);
+ }
+
+ object IMarkupExtension.ProvideValue(IServiceProvider serviceProvider)
+ {
+ return (this as IMarkupExtension<Type>).ProvideValue(serviceProvider);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+//
+// ViewExtensions.cs
+//
+// Author:
+// Stephane Delcroix <stephane@mi8.be>
+//
+// Copyright (c) 2013 Mobile Inception
+// Copyright (c) 2013 Xamarin, Inc
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Reflection;
+using System.ComponentModel;
+using Tizen.NUI.XamlBinding;
+
+namespace Tizen.NUI.Xaml
+{
+ /// <summary>
+ /// Extension class for View defining Tizen.NUI.Xaml.Extensions.LoadFromXaml{TView} method.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static class Extensions
+ {
+ /// <summary>
+ /// Returns an initialized view by loading the specified xaml.
+ /// </summary>
+ /// <typeparam name="TXaml">The type of view to initialize with state from XAML.</typeparam>
+ /// <param name="view">The view on which this method operates.</param>
+ /// <param name="callingType">The type of the caller.</param>
+ /// <returns>A TXaml with the properties that are defined in the application manifest for callingType.</returns>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static TXaml LoadFromXaml<TXaml>(this TXaml view, Type callingType)
+ {
+ NameScopeExtensions.PushElement(view);
+ XamlLoader.Load(view, callingType);
+ NameScopeExtensions.PopElement();
+
+ return view;
+ }
+
+ /// <summary>
+ /// Returns an initialized view by loading the specified xaml.
+ /// </summary>
+ /// <typeparam name="TXaml">The type of view to initialize with state from XAML.</typeparam>
+ /// <param name="view">The view on which this method operates.</param>
+ /// <param name="callingType">The type of the caller.</param>
+ /// <returns>A TXaml with the properties that are defined in the application manifest for callingType.</returns>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static TXaml LoadFromXaml1<TXaml>(this TXaml view, Type callingType)
+ {
+ NameScopeExtensions.PushElement(view);
+ XamlLoader.Load(view, callingType);
+ NameScopeExtensions.PopElement();
+
+ return view;
+ }
+
+ /// <summary>
+ /// Returns a TXaml with the properties that are defined in the application manifest for callingType.
+ /// </summary>
+ /// <typeparam name="TXaml">The type of view to initialize with state from XAML.</typeparam>
+ /// <param name="view">The view on which this method operates.</param>
+ /// <param name="xaml">The XAML that encodes the view state.</param>
+ /// <returns>A TXaml with the properties that are defined in the application manifest for callingType.</returns>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static TXaml LoadFromXaml<TXaml>(this TXaml view, string xaml)
+ {
+ if (view is Element)
+ {
+ NameScopeExtensions.PushElement(view);
+ }
+
+ XamlLoader.Load(view, xaml);
+
+ if (view is Element)
+ {
+ NameScopeExtensions.PopElement();
+ }
+
+ return view;
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static T LoadObject<T>(string path)
+ {
+ return XamlLoader.LoadObject<T>(path);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.ComponentModel;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+namespace Tizen.NUI.Xaml
+{
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [Flags]
+ public enum XamlCompilationOptions
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Skip = 1 << 0,
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Compile = 1 << 1
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class, Inherited = false)]
+ public sealed class XamlCompilationAttribute : Attribute
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public XamlCompilationAttribute(XamlCompilationOptions xamlCompilationOptions)
+ {
+ XamlCompilationOptions = xamlCompilationOptions;
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public XamlCompilationOptions XamlCompilationOptions { get; set; }
+ }
+
+ internal static class XamlCExtensions
+ {
+ public static bool IsCompiled(this Type type)
+ {
+ var attr = type.GetTypeInfo().GetCustomAttribute<XamlCompilationAttribute>();
+ if (attr != null)
+ return attr.XamlCompilationOptions == XamlCompilationOptions.Compile;
+ attr = type.GetTypeInfo().Module.GetCustomAttribute<XamlCompilationAttribute>();
+ if (attr != null)
+ return attr.XamlCompilationOptions == XamlCompilationOptions.Compile;
+ attr = type.GetTypeInfo().Assembly.GetCustomAttribute<XamlCompilationAttribute>();
+ if (attr != null)
+ return attr.XamlCompilationOptions == XamlCompilationOptions.Compile;
+
+ return false;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+
+namespace Tizen.NUI.Xaml
+{
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
+ public sealed class XamlFilePathAttribute : Attribute
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public XamlFilePathAttribute([CallerFilePath] string filePath = "")
+ {
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.ComponentModel;
+using System.Reflection;
+
+namespace Tizen.NUI.Xaml
+{
+ /// <summary>
+ /// The class XamlResourceIdAttribute.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [AttributeUsage(AttributeTargets.Assembly, Inherited = false, AllowMultiple = true)]
+ public sealed class XamlResourceIdAttribute : Attribute
+ {
+ /// <summary>
+ /// Attribute ResourceId
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string ResourceId { get; set; }
+
+ /// <summary>
+ /// Attribute Path
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string Path { get; set; }
+
+ /// <summary>
+ /// Attribute Type
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Type Type { get; set; }
+
+ /// <summary>
+ /// Create a new XamlResourceIdAttribute
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public XamlResourceIdAttribute(string resourceId, string path, Type type)
+ {
+ ResourceId = resourceId;
+ Path = path;
+ Type = type;
+ }
+
+ internal static string GetResourceIdForType(Type type)
+ {
+ var assembly = type.GetTypeInfo().Assembly;
+ foreach (var xria in assembly.GetCustomAttributes<XamlResourceIdAttribute>()) {
+ if (xria.Type == type)
+ return xria.ResourceId;
+ }
+ return null;
+ }
+
+ internal static string GetPathForType(Type type)
+ {
+ var assembly = type.GetTypeInfo().Assembly;
+ foreach (var xria in assembly.GetCustomAttributes<XamlResourceIdAttribute>()) {
+ if (xria.Type == type)
+ return xria.Path;
+ }
+ return null;
+ }
+
+ internal static string GetResourceIdForPath(Assembly assembly, string path)
+ {
+ foreach (var xria in assembly.GetCustomAttributes<XamlResourceIdAttribute>()) {
+ if (xria.Path == path)
+ return xria.ResourceId;
+ }
+ return null;
+ }
+
+ internal static Type GetTypeForResourceId(Assembly assembly, string resourceId)
+ {
+ foreach (var xria in assembly.GetCustomAttributes<XamlResourceIdAttribute>()) {
+ if (xria.ResourceId == resourceId)
+ return xria.Type;
+ }
+ return null;
+ }
+
+ internal static Type GetTypeForPath(Assembly assembly, string path)
+ {
+ foreach (var xria in assembly.GetCustomAttributes<XamlResourceIdAttribute>()) {
+ if (xria.Path == path)
+ return xria.Type;
+ }
+ return null;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Reflection;
+using System.Xml;
+using Tizen.NUI.XamlBinding;
+using Tizen.NUI.XamlBinding.Internals;
+
+namespace Tizen.NUI.Xaml
+{
+ /// <summary>
+ /// The class to provide xaml service.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class XamlServiceProvider : IServiceProvider
+ {
+ readonly Dictionary<Type, object> services = new Dictionary<Type, object>();
+
+ internal XamlServiceProvider(INode node, HydrationContext context)
+ {
+ object targetObject;
+ if (node != null && node.Parent != null && context.Values.TryGetValue(node.Parent, out targetObject))
+ IProvideValueTarget = new XamlValueTargetProvider(targetObject, node, context, null);
+ if (context != null)
+ IRootObjectProvider = new XamlRootObjectProvider(context.RootElement);
+ if (node != null)
+ {
+ IXamlTypeResolver = new XamlTypeResolver(node.NamespaceResolver, XamlParser.GetElementType,
+ context?.RootElement.GetType().GetTypeInfo().Assembly);
+
+ var enode = node;
+ while (enode != null && !(enode is IElementNode))
+ enode = enode.Parent;
+ if (enode != null)
+ INameScopeProvider = new NameScopeProvider { NameScope = (enode as IElementNode).Namescope };
+ }
+
+ var xmlLineInfo = node as IXmlLineInfo;
+ if (xmlLineInfo != null)
+ IXmlLineInfoProvider = new XmlLineInfoProvider(xmlLineInfo);
+
+ IValueConverterProvider = new ValueConverterProvider();
+ }
+
+ /// <summary>
+ /// Create a new XamlServiceProvider.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public XamlServiceProvider()
+ {
+ IValueConverterProvider = new ValueConverterProvider();
+ }
+
+ internal IProvideValueTarget IProvideValueTarget
+ {
+ get { return (IProvideValueTarget)GetService(typeof (IProvideValueTarget)); }
+ set { services[typeof (IProvideValueTarget)] = value; }
+ }
+
+ internal IXamlTypeResolver IXamlTypeResolver
+ {
+ get { return (IXamlTypeResolver)GetService(typeof (IXamlTypeResolver)); }
+ set { services[typeof (IXamlTypeResolver)] = value; }
+ }
+
+ internal IRootObjectProvider IRootObjectProvider
+ {
+ get { return (IRootObjectProvider)GetService(typeof (IRootObjectProvider)); }
+ set { services[typeof (IRootObjectProvider)] = value; }
+ }
+
+ internal IXmlLineInfoProvider IXmlLineInfoProvider
+ {
+ get { return (IXmlLineInfoProvider)GetService(typeof (IXmlLineInfoProvider)); }
+ set { services[typeof (IXmlLineInfoProvider)] = value; }
+ }
+
+ internal INameScopeProvider INameScopeProvider
+ {
+ get { return (INameScopeProvider)GetService(typeof (INameScopeProvider)); }
+ set { services[typeof (INameScopeProvider)] = value; }
+ }
+
+ internal IValueConverterProvider IValueConverterProvider
+ {
+ get { return (IValueConverterProvider)GetService(typeof (IValueConverterProvider)); }
+ set { services[typeof (IValueConverterProvider)] = value; }
+ }
+
+ /// <summary>
+ /// Get service.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object GetService(Type serviceType)
+ {
+ object service;
+ return services.TryGetValue(serviceType, out service) ? service : null;
+ }
+
+ /// <summary>
+ /// Add service.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Add(Type type, object service)
+ {
+ services.Add(type, service);
+ }
+ }
+
+ internal class XamlValueTargetProvider : IProvideParentValues, IProvideValueTarget
+ {
+ public XamlValueTargetProvider(object targetObject, INode node, HydrationContext context, object targetProperty)
+ {
+ Context = context;
+ Node = node;
+ TargetObject = targetObject;
+ TargetProperty = targetProperty;
+ }
+
+ INode Node { get; }
+
+ HydrationContext Context { get; }
+ public object TargetObject { get; }
+ public object TargetProperty { get; internal set; } = null;
+
+ IEnumerable<object> IProvideParentValues.ParentObjects
+ {
+ get
+ {
+ if (Node == null || Context == null)
+ yield break;
+ var n = Node;
+ object obj = null;
+ var context = Context;
+ while (n.Parent != null && context != null)
+ {
+ if (n.Parent is IElementNode)
+ {
+ if (context.Values.TryGetValue(n.Parent, out obj))
+ yield return obj;
+ else
+ {
+ context = context.ParentContext;
+ continue;
+ }
+ }
+ n = n.Parent;
+ }
+ }
+ }
+ }
+
+ /// <summary>
+ /// The class to provide simple value target.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class SimpleValueTargetProvider : IProvideParentValues, IProvideValueTarget, IReferenceProvider
+ {
+ readonly object[] objectAndParents;
+ readonly object targetProperty;
+
+ /// <summary>
+ /// Create a new SimpleValueTargetProvider.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [Obsolete("SimpleValueTargetProvider(object[] objectAndParents) is obsolete as of version 2.3.4. Please use SimpleValueTargetProvider(object[] objectAndParents, object targetProperty) instead.")]
+ public SimpleValueTargetProvider(object[] objectAndParents) : this (objectAndParents, null)
+ {
+ }
+
+ /// <summary>
+ /// Create a new SimpleValueTargetProvider.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public SimpleValueTargetProvider(object[] objectAndParents, object targetProperty)
+ {
+ if (objectAndParents == null)
+ throw new ArgumentNullException(nameof(objectAndParents));
+ if (objectAndParents.Length == 0)
+ throw new ArgumentException();
+
+ this.objectAndParents = objectAndParents;
+ this.targetProperty = targetProperty;
+ }
+
+ IEnumerable<object> IProvideParentValues.ParentObjects
+ {
+ get { return objectAndParents; }
+ }
+
+ object IProvideValueTarget.TargetObject
+ {
+ get { return objectAndParents[0]; }
+ }
+
+ object IProvideValueTarget.TargetProperty
+ {
+ get { return targetProperty; }
+ }
+
+ /// <summary>
+ /// Find target by name.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object FindByName(string name)
+ {
+ for (var i = 0; i < objectAndParents.Length; i++)
+ {
+ var bo = objectAndParents[i] as BindableObject;
+ if (bo == null) continue;
+ var ns = NameScope.GetNameScope(bo) as INameScope;
+ if (ns == null) continue;
+ var value = ns.FindByName(name);
+ if (value != null)
+ return value;
+ }
+ return null;
+ }
+ }
+
+ /// <summary>
+ /// The class to resolve xaml type.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class XamlTypeResolver : IXamlTypeResolver
+ {
+ readonly Assembly currentAssembly;
+ readonly GetTypeFromXmlName getTypeFromXmlName;
+ readonly IXmlNamespaceResolver namespaceResolver;
+
+ /// <summary>
+ /// Create a new XamlTypeResolver.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public XamlTypeResolver(IXmlNamespaceResolver namespaceResolver, Assembly currentAssembly)
+ : this(namespaceResolver, XamlParser.GetElementType, currentAssembly)
+ {
+ }
+
+ internal XamlTypeResolver(IXmlNamespaceResolver namespaceResolver, GetTypeFromXmlName getTypeFromXmlName,
+ Assembly currentAssembly)
+ {
+ this.currentAssembly = currentAssembly;
+ if (namespaceResolver == null)
+ throw new ArgumentNullException();
+ if (getTypeFromXmlName == null)
+ throw new ArgumentNullException();
+
+ this.namespaceResolver = namespaceResolver;
+ this.getTypeFromXmlName = getTypeFromXmlName;
+ }
+
+ Type IXamlTypeResolver.Resolve(string qualifiedTypeName, IServiceProvider serviceProvider)
+ {
+ XamlParseException e;
+ var type = Resolve(qualifiedTypeName, serviceProvider, out e);
+ if (e != null)
+ throw e;
+ return type;
+ }
+
+ bool IXamlTypeResolver.TryResolve(string qualifiedTypeName, out Type type)
+ {
+ XamlParseException exception;
+ type = Resolve(qualifiedTypeName, null, out exception);
+ return exception == null;
+ }
+
+ Type Resolve(string qualifiedTypeName, IServiceProvider serviceProvider, out XamlParseException exception)
+ {
+ exception = null;
+ var split = qualifiedTypeName.Split(':');
+ if (split.Length > 2)
+ return null;
+
+ string prefix, name;
+ if (split.Length == 2)
+ {
+ prefix = split[0];
+ name = split[1];
+ }
+ else
+ {
+ prefix = "";
+ name = split[0];
+ }
+
+ IXmlLineInfo xmlLineInfo = null;
+ if (serviceProvider != null)
+ {
+ var lineInfoProvider = serviceProvider.GetService(typeof (IXmlLineInfoProvider)) as IXmlLineInfoProvider;
+ if (lineInfoProvider != null)
+ xmlLineInfo = lineInfoProvider.XmlLineInfo;
+ }
+
+ var namespaceuri = namespaceResolver.LookupNamespace(prefix);
+ if (namespaceuri == null)
+ {
+ exception = new XamlParseException(string.Format("No xmlns declaration for prefix \"{0}\"", prefix), xmlLineInfo);
+ return null;
+ }
+
+ return getTypeFromXmlName(new XmlType(namespaceuri, name, null), xmlLineInfo, currentAssembly, out exception);
+ }
+
+ internal delegate Type GetTypeFromXmlName(
+ XmlType xmlType, IXmlLineInfo xmlInfo, Assembly currentAssembly, out XamlParseException exception);
+ }
+
+ /// <summary>
+ /// The class to provide xaml root object.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class XamlRootObjectProvider : IRootObjectProvider
+ {
+ /// <summary>
+ /// Create a new XamlRootObjectProvider.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public XamlRootObjectProvider(object rootObject)
+ {
+ RootObject = rootObject;
+ }
+
+ /// <summary>
+ /// Attribute RootObject.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object RootObject { get; }
+ }
+
+ /// <summary>
+ /// The class to provide xaml line info.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class XmlLineInfoProvider : IXmlLineInfoProvider
+ {
+ /// <summary>
+ /// Create a new XmlLineInfoProvider.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public XmlLineInfoProvider(IXmlLineInfo xmlLineInfo)
+ {
+ XmlLineInfo = xmlLineInfo;
+ }
+
+ /// <summary>
+ /// Attribute XmlLineInfo.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public IXmlLineInfo XmlLineInfo { get; }
+ }
+
+ /// <summary>
+ /// The class to provide name scope.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class NameScopeProvider : INameScopeProvider
+ {
+ /// <summary>
+ /// Attribute NameScope.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public INameScope NameScope { get; set; }
+ }
+
+ /// <summary>
+ /// The class to resolve xml namespace.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class XmlNamespaceResolver : IXmlNamespaceResolver
+ {
+ readonly Dictionary<string, string> namespaces = new Dictionary<string, string>();
+
+ /// <summary>
+ /// Get namespace.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public IDictionary<string, string> GetNamespacesInScope(XmlNamespaceScope scope)
+ {
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// Look up name space.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string LookupNamespace(string prefix)
+ {
+ string result;
+ if (namespaces.TryGetValue(prefix, out result))
+ return result;
+ return null;
+ }
+
+ /// <summary>
+ /// Look up prefix.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string LookupPrefix(string namespaceName)
+ {
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// Add prefix and ns.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Add(string prefix, string ns)
+ {
+ namespaces.Add(prefix, ns);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.ComponentModel;
+using System.Xml;
+
+namespace Tizen.NUI.Xaml
+{
+ /// <summary>
+ /// The class XmlLineInfo.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class XmlLineInfo : IXmlLineInfo
+ {
+ readonly bool _hasLineInfo;
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public XmlLineInfo()
+ {
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public XmlLineInfo(int linenumber, int lineposition)
+ {
+ _hasLineInfo = true;
+ LineNumber = linenumber;
+ LinePosition = lineposition;
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool HasLineInfo()
+ {
+ return _hasLineInfo;
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int LineNumber { get; }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int LinePosition { get; }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Threading;
+using System.ComponentModel;
+using System.Threading.Tasks;
+using Tizen.NUI.XamlBinding.Internals;
+using Tizen.NUI;
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI
+{
+ /// <summary>
+ /// A class to get resources in current application.
+ /// </summary>
+ /// Deprecated. Do not use.
+ public class GetResourcesProvider
+ {
+ /// <summary>
+ /// Get resources in current application.
+ /// </summary>
+ /// Deprecated. Do not use.
+ static public Tizen.NUI.Binding.IResourcesProvider Get()
+ {
+ return Tizen.NUI.XamlBinding.Application.Current;
+ }
+ }
+}
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class Application : Element, Tizen.NUI.Binding.IResourcesProvider, IElementConfiguration<Application>
+ {
+ private NUIApplication application;
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Run(string[] args)
+ {
+ application.Run(args);
+ }
+
+ static Application s_current;
+ Task<IDictionary<string, object>> _propertiesTask;
+ readonly Lazy<PlatformConfigurationRegistry<Application>> _platformConfigurationRegistry;
+
+ ReadOnlyCollection<Element> _logicalChildren;
+
+ Page _mainPage;
+
+ static SemaphoreSlim SaveSemaphore = new SemaphoreSlim(1, 1);
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Application()
+ {
+ application = new NUIApplication();
+ application.Created += (object sender, EventArgs e) =>
+ {
+ Device.PlatformServices = new TizenPlatformServices();
+ OnCreate();
+ };
+
+ SetCurrentApplication(this);
+ _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<Application>>(() => new PlatformConfigurationRegistry<Application>(this));
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Quit()
+ {
+ Device.PlatformServices?.QuitApplication();
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ private static void SetCurrentApplication(Application value) => Current = value;
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static Application Current
+ {
+ get { return s_current; }
+ set
+ {
+ if (s_current == value)
+ return;
+ if (value == null)
+ s_current = null; //Allow to reset current for unittesting
+ s_current = value;
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Page MainPage
+ {
+ get { return _mainPage; }
+ set
+ {
+ if (value == null)
+ throw new ArgumentNullException("value");
+
+ if (_mainPage == value)
+ return;
+
+ OnPropertyChanging();
+ if (_mainPage != null)
+ {
+ InternalChildren.Remove(_mainPage);
+ _mainPage.Parent = null;
+ }
+
+ _mainPage = value;
+
+ if (_mainPage != null)
+ {
+ _mainPage.Parent = this;
+ //_mainPage.NavigationProxy.Inner = NavigationProxy;
+ InternalChildren.Add(_mainPage);
+ }
+ OnPropertyChanged();
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public IDictionary<string, object> Properties
+ {
+ get
+ {
+ if (_propertiesTask == null)
+ {
+ _propertiesTask = GetPropertiesAsync();
+ }
+
+ return _propertiesTask.Result;
+ }
+ }
+
+ internal override ReadOnlyCollection<Element> LogicalChildrenInternal
+ {
+ get { return _logicalChildren ?? (_logicalChildren = new ReadOnlyCollection<Element>(InternalChildren)); }
+ }
+
+ internal IResourceDictionary SystemResources { get; }
+
+ ObservableCollection<Element> InternalChildren { get; } = new ObservableCollection<Element>();
+
+ ResourceDictionary _resources;
+ bool Tizen.NUI.Binding.IResourcesProvider.IsResourcesCreated => _resources != null;
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ResourceDictionary XamlResources
+ {
+ get
+ {
+ if (_resources != null)
+ return _resources;
+
+ _resources = new ResourceDictionary();
+ ((IResourceDictionary)_resources).ValuesChanged += OnResourcesChanged;
+ return _resources;
+ }
+ set
+ {
+ if (_resources == value)
+ return;
+ OnPropertyChanging();
+ if (_resources != null)
+ ((IResourceDictionary)_resources).ValuesChanged -= OnResourcesChanged;
+ _resources = value;
+ OnResourcesChanged(value);
+ if (_resources != null)
+ ((IResourceDictionary)_resources).ValuesChanged += OnResourcesChanged;
+ OnPropertyChanged();
+ }
+ }
+
+ async void SaveProperties()
+ {
+ try
+ {
+ await SetPropertiesAsync();
+ }
+ catch (Exception exc)
+ {
+ Console.WriteLine(nameof(Application), $"Exception while saving Application Properties: {exc}");
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public async Task SavePropertiesAsync()
+ {
+ if (Device.IsInvokeRequired)
+ {
+ Device.BeginInvokeOnMainThread(SaveProperties);
+ }
+ else
+ {
+ await SetPropertiesAsync();
+ }
+ }
+
+ // Don't use this unless there really is no better option
+ internal void SavePropertiesAsFireAndForget()
+ {
+ if (Device.IsInvokeRequired)
+ {
+ Device.BeginInvokeOnMainThread(SaveProperties);
+ }
+ else
+ {
+ SaveProperties();
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected virtual void OnAppLinkRequestReceived(Uri uri)
+ {
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void OnParentSet()
+ {
+ throw new InvalidOperationException("Setting a Parent on Application is invalid.");
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected virtual void OnResume()
+ {
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected virtual void OnSleep()
+ {
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected virtual void OnStart()
+ {
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected virtual void OnCreate()
+ {
+
+ }
+
+ /// <summary>
+ /// Reset current application to null
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static void ClearCurrent()
+ {
+ s_current = null;
+ }
+
+ /// <summary>
+ /// Judge wheather element is a application
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static bool IsApplicationOrNull(Element element)
+ {
+ return element == null || element is Application;
+ }
+
+ internal override void OnParentResourcesChanged(IEnumerable<KeyValuePair<string, object>> values)
+ {
+ if (!((Tizen.NUI.Binding.IResourcesProvider)this).IsResourcesCreated || XamlResources.Count == 0)
+ {
+ base.OnParentResourcesChanged(values);
+ return;
+ }
+
+ var innerKeys = new HashSet<string>();
+ var changedResources = new List<KeyValuePair<string, object>>();
+ foreach (KeyValuePair<string, object> c in XamlResources)
+ innerKeys.Add(c.Key);
+ foreach (KeyValuePair<string, object> value in values)
+ {
+ if (innerKeys.Add(value.Key))
+ changedResources.Add(value);
+ }
+ OnResourcesChanged(changedResources);
+ }
+
+ /// <summary>
+ /// Send application's link uri.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SendOnAppLinkRequestReceived(Uri uri)
+ {
+ OnAppLinkRequestReceived(uri);
+ }
+
+ /// <summary>
+ /// Resume
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SendResume()
+ {
+ s_current = this;
+ OnResume();
+ }
+
+ /// <summary>
+ /// Sleep
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SendSleep()
+ {
+ OnSleep();
+ SavePropertiesAsFireAndForget();
+ }
+
+ /// <summary>
+ /// Sleep asyncly
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Task SendSleepAsync()
+ {
+ OnSleep();
+ return SavePropertiesAsync();
+ }
+
+ /// <summary>
+ /// Start
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SendStart()
+ {
+ OnStart();
+ }
+
+ async Task<IDictionary<string, object>> GetPropertiesAsync()
+ {
+ var deserializer = DependencyService.Get<IDeserializer>();
+ if (deserializer == null)
+ {
+ Console.WriteLine("Startup", "No IDeserialzier was found registered");
+ return new Dictionary<string, object>(4);
+ }
+
+ IDictionary<string, object> properties = await deserializer.DeserializePropertiesAsync().ConfigureAwait(false);
+ if (properties == null)
+ properties = new Dictionary<string, object>(4);
+
+ return properties;
+ }
+
+ async Task SetPropertiesAsync()
+ {
+ await SaveSemaphore.WaitAsync();
+ try
+ {
+ await DependencyService.Get<IDeserializer>().SerializePropertiesAsync(Properties);
+ }
+ finally
+ {
+ SaveSemaphore.Release();
+ }
+
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using Tizen.NUI.XamlBinding.Internals;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// <summary>
+ /// Provides a mechanism by which application developers can propagate changes that are made to data in one object to another, by enabling validation, type coercion, and an event system.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public abstract class BindableObject : INotifyPropertyChanged, IDynamicResourceHandler
+ {
+ /// <summary>
+ /// Implements the bound property whose interface is provided by the BindingContext property.
+ /// </summary>
+ public static readonly BindableProperty BindingContextProperty =
+ BindableProperty.Create("BindingContext", typeof(object), typeof(BindableObject), default(object),
+ BindingMode.OneWay, null, BindingContextPropertyChanged, null, null, BindingContextPropertyBindingChanging);
+
+ readonly List<BindablePropertyContext> _properties = new List<BindablePropertyContext>(4);
+
+ bool _applying;
+ object _inheritedContext;
+
+ /// <summary>
+ /// Gets or sets object that contains the properties that will be targeted by the bound properties that belong to this BindableObject.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object BindingContext
+ {
+ get { return _inheritedContext ?? GetValue(BindingContextProperty); }
+ set { SetValue(BindingContextProperty, value); }
+ }
+
+ void IDynamicResourceHandler.SetDynamicResource(BindableProperty property, string key)
+ {
+ SetDynamicResource(property, key, false);
+ }
+
+ /// <summary>
+ /// Raised when a property has changed.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ /// <summary>
+ /// Raised whenever the BindingContext property changes.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler BindingContextChanged;
+
+ internal void ClearValue(BindableProperty property, bool fromStyle)
+ {
+ ClearValue(property, fromStyle: fromStyle, checkAccess: true);
+ }
+
+ /// <summary>
+ /// Clears any value set by Tizen.NUI.Xaml.BindableObject.SetValue.
+ /// </summary>
+ /// <param name="property">The BindableProperty to clear</param>
+ internal void ClearValue(BindableProperty property)
+ {
+ ClearValue(property, fromStyle: false, checkAccess: true);
+ }
+
+ /// <summary>
+ /// 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)
+ {
+ if (propertyKey == null)
+ throw new ArgumentNullException("propertyKey");
+
+ ClearValue(propertyKey.BindableProperty, fromStyle:false, checkAccess: false);
+ }
+
+ /// <summary>
+ /// Return true if the target property exists and has been set.
+ /// </summary>
+ /// <param name="targetProperty">The target property</param>
+ /// <returns>return true if the target property exists and has been set</returns>
+ internal bool IsSet(BindableProperty targetProperty)
+ {
+ if (targetProperty == null)
+ throw new ArgumentNullException(nameof(targetProperty));
+
+ var bpcontext = GetContext(targetProperty);
+ return bpcontext != null
+ && (bpcontext.Attributes & BindableContextAttributes.IsDefaultValue) == 0;
+ }
+
+ /// <summary>
+ /// Returns the value that is contained the BindableProperty.
+ /// </summary>
+ /// <param name="property">The BindableProperty for which to get the value.</param>
+ /// <returns>The value that is contained the BindableProperty</returns>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object GetValue(BindableProperty property)
+ {
+ if (property == null)
+ throw new ArgumentNullException("property");
+
+ BindablePropertyContext context = property.DefaultValueCreator != null ? GetOrCreateContext(property) : GetContext(property);
+
+ if (context == null)
+ return property.DefaultValue;
+
+ return context.Value;
+ }
+
+ /// <summary>
+ /// Raised when a property is about to change.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event PropertyChangingEventHandler PropertyChanging;
+
+ /// <summary>
+ /// Removes a previously set binding.
+ /// </summary>
+ /// <param name="property">The BindableProperty from which to remove bindings.</param>
+ internal void RemoveBinding(BindableProperty property)
+ {
+ if (property == null)
+ throw new ArgumentNullException("property");
+
+ BindablePropertyContext context = GetContext(property);
+ if (context == null || context.Binding == null)
+ return;
+
+ RemoveBinding(property, context);
+ }
+
+ /// <summary>
+ /// Assigns a binding to a property.
+ /// </summary>
+ /// <param name="targetProperty">The BindableProperty on which to set a binding.</param>
+ /// <param name="binding">The binding to set.</param>
+ public void SetBinding(BindableProperty targetProperty, BindingBase binding)
+ {
+ SetBinding(targetProperty, binding, false);
+ }
+
+ /// <summary>
+ /// Sets the value of the specified property.
+ /// </summary>
+ /// <param name="property">The BindableProperty on which to assign a value.</param>
+ /// <param name="value">The value to set.</param>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetValue(BindableProperty property, object value)
+ {
+ SetValue(property, value, false, true);
+ }
+
+ /// <summary>
+ /// Force notify the listener.
+ /// </summary>
+ /// <param name="property">The BindableProperty on which to assign a value.</param>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ public void ForceNotify(BindableProperty property)
+ {
+ BindablePropertyContext context = GetOrCreateContext(property);
+ BindingBase binding = context.Binding;
+
+ if (binding != null)
+ {
+ _applying = true;
+ binding.Apply(true);
+ _applying = false;
+ }
+
+ OnPropertyChanged(property.PropertyName);
+ }
+
+ /// <summary>
+ /// Sets the value of the propertyKey.
+ /// </summary>
+ /// <param name="propertyKey">The BindablePropertyKey on which to assign a value.</param>
+ /// <param name="value">The value to set.</param>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetValue(BindablePropertyKey propertyKey, object value)
+ {
+ if (propertyKey == null)
+ throw new ArgumentNullException("propertyKey");
+
+ SetValue(propertyKey.BindableProperty, value, false, false);
+ }
+
+ /// <summary>
+ /// Set the inherited context to a neated element.
+ /// </summary>
+ /// <param name="bindable">The object on which to set the inherited binding context.</param>
+ /// <param name="value">The inherited context to set.</param>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static void SetInheritedBindingContext(BindableObject bindable, object value)
+ {
+ BindablePropertyContext bpContext = bindable.GetContext(BindingContextProperty);
+ if (bpContext != null && ((bpContext.Attributes & BindableContextAttributes.IsManuallySet) != 0))
+ return;
+
+ object oldContext = bindable._inheritedContext;
+
+ if (ReferenceEquals(oldContext, value))
+ return;
+
+ if (bpContext != null && oldContext == null)
+ oldContext = bpContext.Value;
+
+ if (bpContext != null && bpContext.Binding != null)
+ {
+ bpContext.Binding.Context = value;
+ bindable._inheritedContext = null;
+ }
+ else
+ {
+ bindable._inheritedContext = value;
+ }
+
+ bindable.ApplyBindings(skipBindingContext:false, fromBindingContextChanged:true);
+ bindable.OnBindingContextChanged();
+ }
+
+ /// <summary>
+ /// Apply the bindings to BindingContext.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected void ApplyBindings()
+ {
+ ApplyBindings(skipBindingContext: false, fromBindingContextChanged: false);
+ }
+
+ /// <summary>
+ /// Override this method to execute an action when the BindingContext changes.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected virtual void OnBindingContextChanged()
+ {
+ BindingContextChanged?.Invoke(this, EventArgs.Empty);
+ }
+
+ /// <summary>
+ /// Call this method from a child class to notify that a change happened on a property.
+ /// </summary>
+ /// <param name="propertyName">The name of the property that changed.</param>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+
+ /// <summary>
+ /// Call this method from a child class to notify that a change is going to happen on a property.
+ /// </summary>
+ /// <param name="propertyName">The name of the property that is changing.</param>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected virtual void OnPropertyChanging([CallerMemberName] string propertyName = null)
+ => PropertyChanging?.Invoke(this, new PropertyChangingEventArgs(propertyName));
+
+ /// <summary>
+ /// Unapplies all previously set bindings.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected void UnapplyBindings()
+ {
+ for (int i = 0, _propertiesCount = _properties.Count; i < _propertiesCount; i++) {
+ BindablePropertyContext context = _properties [i];
+ if (context.Binding == null)
+ continue;
+
+ context.Binding.Unapply();
+ }
+ }
+
+ internal bool GetIsBound(BindableProperty targetProperty)
+ {
+ if (targetProperty == null)
+ throw new ArgumentNullException("targetProperty");
+
+ BindablePropertyContext bpcontext = GetContext(targetProperty);
+ return bpcontext != null && bpcontext.Binding != null;
+ }
+
+ /// <summary>
+ /// Returns the value that is contained the BindableProperty.
+ /// </summary>
+ /// <param name="property0">The BindableProperty instance.</param>
+ /// <param name="property1">The BindableProperty instance.</param>
+ /// <returns>The value that is contained the BindableProperty</returns>
+ internal object[] GetValues(BindableProperty property0, BindableProperty property1)
+ {
+ var values = new object[2];
+
+ for (var i = 0; i < _properties.Count; i++)
+ {
+ BindablePropertyContext context = _properties[i];
+
+ if (ReferenceEquals(context.Property, property0))
+ {
+ values[0] = context.Value;
+ property0 = null;
+ }
+ else if (ReferenceEquals(context.Property, property1))
+ {
+ values[1] = context.Value;
+ property1 = null;
+ }
+
+ if (property0 == null && property1 == null)
+ return values;
+ }
+
+ if (!ReferenceEquals(property0, null))
+ values[0] = property0.DefaultValueCreator == null ? property0.DefaultValue : CreateAndAddContext(property0).Value;
+ if (!ReferenceEquals(property1, null))
+ values[1] = property1.DefaultValueCreator == null ? property1.DefaultValue : CreateAndAddContext(property1).Value;
+
+ return values;
+ }
+
+ /// <summary>
+ /// Returns the value that is contained the BindableProperty.
+ /// </summary>
+ /// <param name="property0">The BindableProperty instance.</param>
+ /// <param name="property1">The BindableProperty instance.</param>
+ /// <param name="property2">The BindableProperty instance.</param>
+ /// <returns>The value that is contained the BindableProperty</returns>
+ internal object[] GetValues(BindableProperty property0, BindableProperty property1, BindableProperty property2)
+ {
+ var values = new object[3];
+
+ for (var i = 0; i < _properties.Count; i++)
+ {
+ BindablePropertyContext context = _properties[i];
+
+ if (ReferenceEquals(context.Property, property0))
+ {
+ values[0] = context.Value;
+ property0 = null;
+ }
+ else if (ReferenceEquals(context.Property, property1))
+ {
+ values[1] = context.Value;
+ property1 = null;
+ }
+ else if (ReferenceEquals(context.Property, property2))
+ {
+ values[2] = context.Value;
+ property2 = null;
+ }
+
+ if (property0 == null && property1 == null && property2 == null)
+ return values;
+ }
+
+ if (!ReferenceEquals(property0, null))
+ values[0] = property0.DefaultValueCreator == null ? property0.DefaultValue : CreateAndAddContext(property0).Value;
+ if (!ReferenceEquals(property1, null))
+ values[1] = property1.DefaultValueCreator == null ? property1.DefaultValue : CreateAndAddContext(property1).Value;
+ if (!ReferenceEquals(property2, null))
+ values[2] = property2.DefaultValueCreator == null ? property2.DefaultValue : CreateAndAddContext(property2).Value;
+
+ return values;
+ }
+
+ /// <summary>
+ /// Returns the value that is contained the BindableProperty.
+ /// </summary>
+ /// <param name="properties">The array of the BindableProperty instances</param>
+ /// <returns>The values that is contained the BindableProperty instances.</returns>
+ internal object[] GetValues(params BindableProperty[] properties)
+ {
+ var values = new object[properties.Length];
+ for (var i = 0; i < _properties.Count; i++) {
+ var context = _properties[i];
+ var index = properties.IndexOf(context.Property);
+ if (index < 0)
+ continue;
+ values[index] = context.Value;
+ }
+ for (var i = 0; i < values.Length; i++) {
+ if (!ReferenceEquals(values[i], null))
+ continue;
+ values[i] = properties[i].DefaultValueCreator == null ? properties[i].DefaultValue : CreateAndAddContext(properties[i]).Value;
+ }
+ return values;
+ }
+
+ internal virtual void OnRemoveDynamicResource(BindableProperty property)
+ {
+ }
+
+ internal virtual void OnSetDynamicResource(BindableProperty property, string key)
+ {
+ }
+
+ internal void RemoveDynamicResource(BindableProperty property)
+ {
+ if (property == null)
+ throw new ArgumentNullException("property");
+
+ OnRemoveDynamicResource(property);
+ BindablePropertyContext context = GetOrCreateContext(property);
+ context.Attributes &= ~BindableContextAttributes.IsDynamicResource;
+ }
+
+ internal void SetBinding(BindableProperty targetProperty, BindingBase binding, bool fromStyle)
+ {
+ if (targetProperty == null)
+ throw new ArgumentNullException("targetProperty");
+ if (binding == null)
+ throw new ArgumentNullException("binding");
+
+ if (fromStyle && !CanBeSetFromStyle(targetProperty))
+ return;
+
+ var context = GetOrCreateContext(targetProperty);
+ if (fromStyle)
+ context.Attributes |= BindableContextAttributes.IsSetFromStyle;
+ else
+ context.Attributes &= ~BindableContextAttributes.IsSetFromStyle;
+
+ if (context.Binding != null)
+ context.Binding.Unapply();
+
+ BindingBase oldBinding = context.Binding;
+ context.Binding = binding;
+
+ targetProperty.BindingChanging?.Invoke(this, oldBinding, binding);
+
+ binding.Apply(BindingContext, this, targetProperty);
+ }
+
+ bool CanBeSetFromStyle(BindableProperty property)
+ {
+ var context = GetContext(property);
+ if (context == null)
+ return true;
+ if ((context.Attributes & BindableContextAttributes.IsSetFromStyle) == BindableContextAttributes.IsSetFromStyle)
+ return true;
+ if ((context.Attributes & BindableContextAttributes.IsDefaultValue) == BindableContextAttributes.IsDefaultValue)
+ return true;
+ if ((context.Attributes & BindableContextAttributes.IsDefaultValueCreated) == BindableContextAttributes.IsDefaultValueCreated)
+ return true;
+ return false;
+ }
+
+ internal void SetDynamicResource(BindableProperty property, string key)
+ {
+ SetDynamicResource(property, key, false);
+ }
+
+ internal void SetDynamicResource(BindableProperty property, string key, bool fromStyle)
+ {
+ if (property == null)
+ throw new ArgumentNullException(nameof(property));
+ if (string.IsNullOrEmpty(key))
+ throw new ArgumentNullException(nameof(key));
+ if (fromStyle && !CanBeSetFromStyle(property))
+ return;
+
+ var context = GetOrCreateContext(property);
+
+ context.Attributes |= BindableContextAttributes.IsDynamicResource;
+ if (fromStyle)
+ context.Attributes |= BindableContextAttributes.IsSetFromStyle;
+ else
+ context.Attributes &= ~BindableContextAttributes.IsSetFromStyle;
+
+ OnSetDynamicResource(property, key);
+ }
+
+ internal void SetValue(BindableProperty property, object value, bool fromStyle)
+ {
+ SetValue(property, value, fromStyle, true);
+ }
+
+ internal void SetValueCore(BindablePropertyKey propertyKey, object value, SetValueFlags attributes = SetValueFlags.None)
+ {
+ SetValueCore(propertyKey.BindableProperty, value, attributes, SetValuePrivateFlags.None);
+ }
+
+ internal void SetValueCore(BindableProperty property, object value, SetValueFlags attributes = SetValueFlags.None)
+ {
+ SetValueCore(property, value, attributes, SetValuePrivateFlags.Default);
+ }
+
+ internal void SetValueCore(BindableProperty property, object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes)
+ {
+ bool checkAccess = (privateAttributes & SetValuePrivateFlags.CheckAccess) != 0;
+ bool manuallySet = (privateAttributes & SetValuePrivateFlags.ManuallySet) != 0;
+ bool silent = (privateAttributes & SetValuePrivateFlags.Silent) != 0;
+ bool fromStyle = (privateAttributes & SetValuePrivateFlags.FromStyle) != 0;
+ bool converted = (privateAttributes & SetValuePrivateFlags.Converted) != 0;
+
+ if (property == null)
+ throw new ArgumentNullException("property");
+ if (checkAccess && property.IsReadOnly)
+ {
+ Debug.WriteLine("Can not set the BindableProperty \"{0}\" because it is readonly.", property.PropertyName);
+ return;
+ }
+
+ if (!converted && !property.TryConvert(ref value))
+ {
+ Console.WriteLine("SetValue", "Can not convert {0} to type '{1}'", value, property.ReturnType);
+ return;
+ }
+
+ if (property.ValidateValue != null && !property.ValidateValue(this, value))
+ throw new ArgumentException("Value was an invalid value for " + property.PropertyName, "value");
+
+ if (property.CoerceValue != null)
+ value = property.CoerceValue(this, value);
+
+ BindablePropertyContext context = GetOrCreateContext(property);
+ if (manuallySet) {
+ context.Attributes |= BindableContextAttributes.IsManuallySet;
+ context.Attributes &= ~BindableContextAttributes.IsSetFromStyle;
+ } else
+ context.Attributes &= ~BindableContextAttributes.IsManuallySet;
+
+ if (fromStyle)
+ context.Attributes |= BindableContextAttributes.IsSetFromStyle;
+ // else omitted on purpose
+
+ bool currentlyApplying = _applying;
+
+ if ((context.Attributes & BindableContextAttributes.IsBeingSet) != 0)
+ {
+ Queue<SetValueArgs> delayQueue = context.DelayedSetters;
+ if (delayQueue == null)
+ context.DelayedSetters = delayQueue = new Queue<SetValueArgs>();
+
+ delayQueue.Enqueue(new SetValueArgs(property, context, value, currentlyApplying, attributes));
+ }
+ else
+ {
+ context.Attributes |= BindableContextAttributes.IsBeingSet;
+ SetValueActual(property, context, value, currentlyApplying, attributes, silent);
+
+ Queue<SetValueArgs> delayQueue = context.DelayedSetters;
+ if (delayQueue != null)
+ {
+ while (delayQueue.Count > 0)
+ {
+ SetValueArgs s = delayQueue.Dequeue();
+ SetValueActual(s.Property, s.Context, s.Value, s.CurrentlyApplying, s.Attributes);
+ }
+
+ context.DelayedSetters = null;
+ }
+
+ context.Attributes &= ~BindableContextAttributes.IsBeingSet;
+ }
+ }
+
+ internal void ApplyBindings(bool skipBindingContext, bool fromBindingContextChanged)
+ {
+ var prop = _properties.ToArray();
+ for (int i = 0, propLength = prop.Length; i < propLength; i++) {
+ BindablePropertyContext context = prop [i];
+ BindingBase binding = context.Binding;
+ if (binding == null)
+ continue;
+
+ if (skipBindingContext && ReferenceEquals(context.Property, BindingContextProperty))
+ continue;
+
+ binding.Unapply(fromBindingContextChanged: fromBindingContextChanged);
+ binding.Apply(BindingContext, this, context.Property, fromBindingContextChanged: fromBindingContextChanged);
+ }
+ }
+
+ static void BindingContextPropertyBindingChanging(BindableObject bindable, BindingBase oldBindingBase, BindingBase newBindingBase)
+ {
+ object context = bindable._inheritedContext;
+ var oldBinding = oldBindingBase as Binding;
+ var newBinding = newBindingBase as Binding;
+
+ if (context == null && oldBinding != null)
+ context = oldBinding.Context;
+ if (context != null && newBinding != null)
+ newBinding.Context = context;
+ }
+
+ static void BindingContextPropertyChanged(BindableObject bindable, object oldvalue, object newvalue)
+ {
+ bindable._inheritedContext = null;
+ bindable.ApplyBindings(skipBindingContext: true, fromBindingContextChanged:true);
+ bindable.OnBindingContextChanged();
+ }
+
+ void ClearValue(BindableProperty property, bool fromStyle, bool checkAccess)
+ {
+ if (property == null)
+ throw new ArgumentNullException(nameof(property));
+
+ if (checkAccess && property.IsReadOnly)
+ throw new InvalidOperationException(string.Format("The BindableProperty \"{0}\" is readonly.", property.PropertyName));
+
+ BindablePropertyContext bpcontext = GetContext(property);
+ if (bpcontext == null)
+ return;
+
+ if (fromStyle && !CanBeSetFromStyle(property))
+ return;
+
+ object original = bpcontext.Value;
+
+ object newValue = property.GetDefaultValue(this);
+
+ bool same = Equals(original, newValue);
+ if (!same)
+ {
+ property.PropertyChanging?.Invoke(this, original, newValue);
+
+ OnPropertyChanging(property.PropertyName);
+ }
+
+ bpcontext.Attributes &= ~BindableContextAttributes.IsManuallySet;
+ bpcontext.Value = newValue;
+ if (property.DefaultValueCreator == null)
+ bpcontext.Attributes |= BindableContextAttributes.IsDefaultValue;
+ else
+ bpcontext.Attributes |= BindableContextAttributes.IsDefaultValueCreated;
+
+ if (!same)
+ {
+ OnPropertyChanged(property.PropertyName);
+ property.PropertyChanged?.Invoke(this, original, newValue);
+ }
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ BindablePropertyContext CreateAndAddContext(BindableProperty property)
+ {
+ var context = new BindablePropertyContext { Property = property, Value = property.DefaultValueCreator != null ? property.DefaultValueCreator(this) : property.DefaultValue };
+
+ if (property.DefaultValueCreator == null)
+ context.Attributes = BindableContextAttributes.IsDefaultValue;
+ else
+ context.Attributes = BindableContextAttributes.IsDefaultValueCreated;
+
+ _properties.Add(context);
+ return context;
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ BindablePropertyContext GetContext(BindableProperty property)
+ {
+ List<BindablePropertyContext> properties = _properties;
+
+ for (var i = 0; i < properties.Count; i++)
+ {
+ BindablePropertyContext context = properties[i];
+ if (ReferenceEquals(context.Property, property))
+ return context;
+ }
+
+ return null;
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ BindablePropertyContext GetOrCreateContext(BindableProperty property)
+ {
+ BindablePropertyContext context = GetContext(property);
+ if (context == null)
+ {
+ context = CreateAndAddContext(property);
+ }
+ else if (property.DefaultValueCreator != null )
+ {
+ context.Value = property.DefaultValueCreator(this); //Update Value from dali
+ }//added by xb.teng
+
+ return context;
+ }
+
+ void RemoveBinding(BindableProperty property, BindablePropertyContext context)
+ {
+ context.Binding.Unapply();
+
+ property.BindingChanging?.Invoke(this, context.Binding, null);
+
+ context.Binding = null;
+ }
+
+ void SetValue(BindableProperty property, object value, bool fromStyle, bool checkAccess)
+ {
+ if (property == null)
+ throw new ArgumentNullException("property");
+
+ if (checkAccess && property.IsReadOnly)
+ throw new InvalidOperationException(string.Format("The BindableProperty \"{0}\" is readonly.", property.PropertyName));
+
+ if (fromStyle && !CanBeSetFromStyle(property))
+ return;
+
+ SetValueCore(property, value, SetValueFlags.ClearOneWayBindings | SetValueFlags.ClearDynamicResource,
+ (fromStyle ? SetValuePrivateFlags.FromStyle : SetValuePrivateFlags.ManuallySet) | (checkAccess ? SetValuePrivateFlags.CheckAccess : 0));
+ }
+
+ void SetValueActual(BindableProperty property, BindablePropertyContext context, object value, bool currentlyApplying, SetValueFlags attributes, bool silent = false)
+ {
+ object original = context.Value;
+ bool raiseOnEqual = (attributes & SetValueFlags.RaiseOnEqual) != 0;
+ bool clearDynamicResources = (attributes & SetValueFlags.ClearDynamicResource) != 0;
+ bool clearOneWayBindings = (attributes & SetValueFlags.ClearOneWayBindings) != 0;
+ bool clearTwoWayBindings = (attributes & SetValueFlags.ClearTwoWayBindings) != 0;
+
+ bool same = ReferenceEquals(context.Property, BindingContextProperty) ? ReferenceEquals(value, original) : Equals(value, original);
+ if (!silent && (!same || raiseOnEqual))
+ {
+ property.PropertyChanging?.Invoke(this, original, value);
+
+ OnPropertyChanging(property.PropertyName);
+ }
+
+ if (!same || raiseOnEqual)
+ {
+ context.Value = value;
+ }
+
+ context.Attributes &= ~BindableContextAttributes.IsDefaultValue;
+ context.Attributes &= ~BindableContextAttributes.IsDefaultValueCreated;
+
+ if ((context.Attributes & BindableContextAttributes.IsDynamicResource) != 0 && clearDynamicResources)
+ RemoveDynamicResource(property);
+
+ BindingBase binding = context.Binding;
+ if (binding != null)
+ {
+ if (clearOneWayBindings && binding.GetRealizedMode(property) == BindingMode.OneWay || clearTwoWayBindings && binding.GetRealizedMode(property) == BindingMode.TwoWay)
+ {
+ RemoveBinding(property, context);
+ binding = null;
+ }
+ }
+
+ if (!silent)
+ {
+ if ((!same || raiseOnEqual))
+ {
+ property.PropertyChanged?.Invoke(this, original, value);
+
+ if (binding != null && !currentlyApplying)
+ {
+ _applying = true;
+ binding.Apply(true);
+ _applying = false;
+ }
+
+ OnPropertyChanged(property.PropertyName);
+ }
+ }
+ }
+
+ [Flags]
+ enum BindableContextAttributes
+ {
+ IsManuallySet = 1 << 0,
+ IsBeingSet = 1 << 1,
+ IsDynamicResource = 1 << 2,
+ IsSetFromStyle = 1 << 3,
+ IsDefaultValue = 1 << 4,
+ IsDefaultValueCreated = 1 << 5,
+ }
+
+ class BindablePropertyContext
+ {
+ public BindableContextAttributes Attributes;
+ public BindingBase Binding;
+ public Queue<SetValueArgs> DelayedSetters;
+ public BindableProperty Property;
+ public object Value;
+ }
+
+ [Flags]
+ internal enum SetValuePrivateFlags
+ {
+ None = 0,
+ CheckAccess = 1 << 0,
+ Silent = 1 << 1,
+ ManuallySet = 1 << 2,
+ FromStyle = 1 << 3,
+ Converted = 1 << 4,
+ Default = CheckAccess
+ }
+
+ class SetValueArgs
+ {
+ public readonly SetValueFlags Attributes;
+ public readonly BindablePropertyContext Context;
+ public readonly bool CurrentlyApplying;
+ public readonly BindableProperty Property;
+ public readonly object Value;
+
+ public SetValueArgs(BindableProperty property, BindablePropertyContext context, object value, bool currentlyApplying, SetValueFlags attributes)
+ {
+ Property = property;
+ Context = context;
+ Value = value;
+ CurrentlyApplying = currentlyApplying;
+ Attributes = attributes;
+ }
+ }
+ }
+}
+
+namespace Tizen.NUI.XamlBinding.Internals
+{
+ /// <summary>
+ /// SetValueFlags. For internal use.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [Flags]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public enum SetValueFlags
+ {
+ /// <summary>
+ /// None.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ None = 0,
+
+ /// <summary>
+ /// Clear OneWay bindings.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ ClearOneWayBindings = 1 << 0,
+
+ /// <summary>
+ /// Clear TwoWay bindings.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ ClearTwoWayBindings = 1 << 1,
+
+ /// <summary>
+ /// Clear dynamic resource.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ ClearDynamicResource = 1 << 2,
+
+ /// <summary>
+ /// Raise or equal.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ RaiseOnEqual = 1 << 3
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq.Expressions;
+using System.Reflection;
+using System.ComponentModel;
+using Tizen.NUI;
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// <summary>
+ /// A BindableProperty is a backing store for properties allowing bindings on BindableObject.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [DebuggerDisplay("{PropertyName}")]
+ [TypeConverter(typeof(BindablePropertyTypeConverter))]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public sealed class BindableProperty
+ {
+ /// <summary>
+ /// Delegate for BindableProperty.PropertyChanged.
+ /// </summary>
+ /// <param name="bindable">The bindable object that contains the property.</param>
+ /// <param name="oldValue">The old property value.</param>
+ /// <param name="newValue">The new property value.</param>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public delegate void BindingPropertyChangedDelegate(BindableObject bindable, object oldValue, object newValue);
+
+ /// <summary>
+ /// Strongly-typed delegate for BindableProperty.PropertyChanged.
+ /// </summary>
+ /// <typeparam name="TPropertyType">The type of the bound property.</typeparam>
+ /// <param name="bindable">The bindable object that contains the property.</param>
+ /// <param name="oldValue">The old property value.</param>
+ /// <param name="newValue">The new property value.</param>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public delegate void BindingPropertyChangedDelegate<in TPropertyType>(BindableObject bindable, TPropertyType oldValue, TPropertyType newValue);
+
+ /// <summary>
+ /// Delegate for BindableProperty.PropertyChanging.
+ /// </summary>
+ /// <param name="bindable">The bindable object that contains the property.</param>
+ /// <param name="oldValue">The old property value.</param>
+ /// <param name="newValue">The new property value.</param>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public delegate void BindingPropertyChangingDelegate(BindableObject bindable, object oldValue, object newValue);
+
+ /// <summary>
+ /// Strongly-typed delegate for BindableProperty.PropertyChanging.
+ /// </summary>
+ /// <typeparam name="TPropertyType">The type of the bound property.</typeparam>
+ /// <param name="bindable">The bindable object that contains the property.</param>
+ /// <param name="oldValue">The old property value.</param>
+ /// <param name="newValue">The new property value.</param>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public delegate void BindingPropertyChangingDelegate<in TPropertyType>(BindableObject bindable, TPropertyType oldValue, TPropertyType newValue);
+
+ /// <summary>
+ /// Delegate for BindableProperty.CoerceValue.
+ /// </summary>
+ /// <param name="bindable">The bindable object that contains the property.</param>
+ /// <param name="value">The value to coerce.</param>
+ /// <returns>System.Object</returns>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public delegate object CoerceValueDelegate(BindableObject bindable, object value);
+
+ /// <summary>
+ /// Strongly-typed delegate for BindableProperty.CoerceValue.
+ /// </summary>
+ /// <typeparam name="TPropertyType">The type of the bound property.</typeparam>
+ /// <param name="bindable">The bindable object that contains the property.</param>
+ /// <param name="value">The value to coerce.</param>
+ /// <returns>TPropertyType</returns>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public delegate TPropertyType CoerceValueDelegate<TPropertyType>(BindableObject bindable, TPropertyType value);
+
+ /// <summary>
+ /// Delegate for BindableProperty.DefaultValueCreator.
+ /// </summary>
+ /// <param name="bindable">The bindable object that contains the property.</param>
+ /// <returns>System.Object</returns>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public delegate object CreateDefaultValueDelegate(BindableObject bindable);
+
+ /// <summary>
+ /// Strongly-typed delegate for BindableProperty.DefaultValueCreator.
+ /// </summary>
+ /// <typeparam name="TDeclarer">The type of the object that delared the property.</typeparam>
+ /// <typeparam name="TPropertyType">The type of the bound property.</typeparam>
+ /// <param name="bindable">The bindable object that contains the property.</param>
+ /// <returns>TPropertyType</returns>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public delegate TPropertyType CreateDefaultValueDelegate<in TDeclarer, out TPropertyType>(TDeclarer bindable);
+
+ /// <summary>
+ /// Delegate for BindableProperty.ValidateValue.
+ /// </summary>
+ /// <param name="bindable">The bindable object that contains the property.</param>
+ /// <param name="value">The default value.</param>
+ /// <returns>System.Boolean</returns>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public delegate bool ValidateValueDelegate(BindableObject bindable, object value);
+
+ /// <summary>
+ /// Strongly-typed delegate for BindableProperty.ValidateValue.
+ /// </summary>
+ /// <typeparam name="TPropertyType">The type of the bound property.</typeparam>
+ /// <param name="bindable">The bindable object that contains the property.</param>
+ /// <param name="value">The default value.</param>
+ /// <returns>System.Boolean</returns>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public delegate bool ValidateValueDelegate<in TPropertyType>(BindableObject bindable, TPropertyType value);
+
+ static readonly Dictionary<Type, TypeConverter> WellKnownConvertTypes = new Dictionary<Type,TypeConverter>
+ {
+ { 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() },
+ };
+
+ //Modification for NUI XAML : user defined converter for DynamicResource can be added
+ static internal Dictionary<Type, TypeConverter> UserCustomConvertTypes = new Dictionary<Type, TypeConverter>
+ {
+ };
+
+ // more or less the encoding of this, without the need to reflect
+ // http://msdn.microsoft.com/en-us/library/y5b434w4.aspx
+ static readonly Dictionary<Type, Type[]> SimpleConvertTypes = new Dictionary<Type, Type[]>
+ {
+ { typeof(sbyte), new[] { typeof(string), typeof(short), typeof(int), typeof(long), typeof(float), typeof(double), typeof(decimal) } },
+ { typeof(byte), new[] { typeof(string), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(ulong), typeof(float), typeof(double), typeof(decimal) } },
+ { typeof(short), new[] { typeof(string), typeof(int), typeof(long), typeof(float), typeof(double), typeof(decimal) } },
+ { typeof(ushort), new[] { typeof(string), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double), typeof(decimal) } },
+ { typeof(int), new[] { typeof(string), typeof(long), typeof(float), typeof(double), typeof(decimal) } },
+ { typeof(uint), new[] { typeof(string), typeof(long), typeof(ulong), typeof(float), typeof(double), typeof(decimal) } },
+ { typeof(long), new[] { typeof(string), typeof(float), typeof(double), typeof(decimal) } },
+ { typeof(char), new[] { typeof(string), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double), typeof(decimal) } },
+ { typeof(float), new[] { typeof(string), typeof(double) } },
+ { typeof(ulong), new[] { typeof(string), typeof(float), typeof(double), typeof(decimal) } }
+ };
+
+ BindableProperty(string propertyName, Type returnType, Type declaringType, object defaultValue, BindingMode defaultBindingMode = BindingMode.OneWay,
+ ValidateValueDelegate validateValue = null, BindingPropertyChangedDelegate propertyChanged = null, BindingPropertyChangingDelegate propertyChanging = null,
+ CoerceValueDelegate coerceValue = null, BindablePropertyBindingChanging bindingChanging = null, bool isReadOnly = false, CreateDefaultValueDelegate defaultValueCreator = null)
+ {
+ if (propertyName == null)
+ throw new ArgumentNullException("propertyName");
+ if (ReferenceEquals(returnType, null))
+ throw new ArgumentNullException("returnType");
+ if (ReferenceEquals(declaringType, null))
+ throw new ArgumentNullException("declaringType");
+
+ // don't use Enum.IsDefined as its redonkulously expensive for what it does
+ if (defaultBindingMode != BindingMode.Default && defaultBindingMode != BindingMode.OneWay && defaultBindingMode != BindingMode.OneWayToSource && defaultBindingMode != BindingMode.TwoWay && defaultBindingMode != BindingMode.OneTime)
+ throw new ArgumentException("Not a valid type of BindingMode", "defaultBindingMode");
+ if (defaultValue == null && Nullable.GetUnderlyingType(returnType) == null && returnType.GetTypeInfo().IsValueType)
+ throw new ArgumentException("Not a valid default value", "defaultValue");
+ if (defaultValue != null && !returnType.IsInstanceOfType(defaultValue))
+ throw new ArgumentException("Default value did not match return type", "defaultValue");
+ if (defaultBindingMode == BindingMode.Default)
+ defaultBindingMode = BindingMode.OneWay;
+
+ PropertyName = propertyName;
+ ReturnType = returnType;
+ ReturnTypeInfo = returnType.GetTypeInfo();
+ DeclaringType = declaringType;
+ DefaultValue = defaultValue;
+ DefaultBindingMode = defaultBindingMode;
+ PropertyChanged = propertyChanged;
+ PropertyChanging = propertyChanging;
+ ValidateValue = validateValue;
+ CoerceValue = coerceValue;
+ BindingChanging = bindingChanging;
+ IsReadOnly = isReadOnly;
+ DefaultValueCreator = defaultValueCreator;
+ }
+
+ /// <summary>
+ /// Gets the type declaring the BindableProperty.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Type DeclaringType { get; private set; }
+
+ /// <summary>
+ /// Gets the default BindingMode.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public BindingMode DefaultBindingMode { get; private set; }
+
+ /// <summary>
+ /// Gets the default value for the BindableProperty.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object DefaultValue { get; }
+
+ /// <summary>
+ /// Gets a value indicating if the BindableProperty is created form a BindablePropertyKey.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool IsReadOnly { get; private set; }
+
+ /// <summary>
+ /// Gets the property name.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string PropertyName { get; }
+
+ /// <summary>
+ /// Gets the type of the BindableProperty.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Type ReturnType { get; }
+
+ internal BindablePropertyBindingChanging BindingChanging { get; private set; }
+
+ internal CoerceValueDelegate CoerceValue { get; private set; }
+
+ internal CreateDefaultValueDelegate DefaultValueCreator { get; }
+
+ internal BindingPropertyChangedDelegate PropertyChanged { get; private set; }
+
+ internal BindingPropertyChangingDelegate PropertyChanging { get; private set; }
+
+ internal System.Reflection.TypeInfo ReturnTypeInfo { get; }
+
+ internal ValidateValueDelegate ValidateValue { get; private set; }
+
+ /// <summary>
+ /// Deprecated. Do not use.
+ /// </summary>
+ /// <typeparam name="TDeclarer">The type of the declaring object.</typeparam>
+ /// <typeparam name="TPropertyType">The type of the property.</typeparam>
+ /// <param name="getter">An expression identifying the getter for the property using this BindableProperty as backing store.</param>
+ /// <param name="defaultValue">The default value for the property.</param>
+ /// <param name="defaultBindingMode">The BindingMode to use on SetBinding() if no BindingMode is given. This parameter is optional. Default is BindingMode.OneWay.</param>
+ /// <param name="validateValue">A delegate to be run when a value is set. This parameter is optional. Default is null.</param>
+ /// <param name="propertyChanged">A delegate to be run when the value has changed. This parameter is optional. Default is null.</param>
+ /// <param name="propertyChanging">A delegate to be run when the value will change. This parameter is optional. Default is null.</param>
+ /// <param name="coerceValue">A delegate used to coerce the range of a value. This parameter is optional. Default is null.</param>
+ /// <param name="defaultValueCreator">A Func used to initialize default value for reference types.</param>
+ /// <returns>A newly created BindableProperty.</returns>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [Obsolete("Create<> (generic) is obsolete as of version 2.1.0 and is no longer supported.")]
+ public static BindableProperty Create<TDeclarer, TPropertyType>(Expression<Func<TDeclarer, TPropertyType>> getter, TPropertyType defaultValue, BindingMode defaultBindingMode = BindingMode.OneWay,
+ ValidateValueDelegate<TPropertyType> validateValue = null, BindingPropertyChangedDelegate<TPropertyType> propertyChanged = null,
+ BindingPropertyChangingDelegate<TPropertyType> propertyChanging = null, CoerceValueDelegate<TPropertyType> coerceValue = null,
+ CreateDefaultValueDelegate<TDeclarer, TPropertyType> defaultValueCreator = null) where TDeclarer : BindableObject
+ {
+ return Create(getter, defaultValue, defaultBindingMode, validateValue, propertyChanged, propertyChanging, coerceValue, null, defaultValueCreator: defaultValueCreator);
+ }
+
+ /// <summary>
+ /// Creates a new instance of the BindableProperty class.
+ /// </summary>
+ /// <param name="propertyName">The name of the BindableProperty.</param>
+ /// <param name="returnType">The type of the property.</param>
+ /// <param name="declaringType">The type of the declaring object.</param>
+ /// <param name="defaultValue">The default value for the property.</param>
+ /// <param name="defaultBindingMode">The BindingMode to use on SetBinding() if no BindingMode is given. This parameter is optional. Default is BindingMode.OneWay.</param>
+ /// <param name="validateValue">A delegate to be run when a value is set. This parameter is optional. Default is null.</param>
+ /// <param name="propertyChanged">A delegate to be run when the value has changed. This parameter is optional. Default is null.</param>
+ /// <param name="propertyChanging">A delegate to be run when the value will change. This parameter is optional. Default is null.</param>
+ /// <param name="coerceValue">A delegate used to coerce the range of a value. This parameter is optional. Default is null.</param>
+ /// <param name="defaultValueCreator">A Func used to initialize default value for reference types.</param>
+ /// <returns>A newly created BindableProperty.</returns>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static BindableProperty Create(string propertyName, Type returnType, Type declaringType, object defaultValue = null, BindingMode defaultBindingMode = BindingMode.OneWay,
+ ValidateValueDelegate validateValue = null, BindingPropertyChangedDelegate propertyChanged = null, BindingPropertyChangingDelegate propertyChanging = null,
+ CoerceValueDelegate coerceValue = null, CreateDefaultValueDelegate defaultValueCreator = null)
+ {
+ return new BindableProperty(propertyName, returnType, declaringType, defaultValue, defaultBindingMode, validateValue, propertyChanged, propertyChanging, coerceValue,
+ defaultValueCreator: defaultValueCreator);
+ }
+
+ /// <summary>
+ /// Deprecated. Do not use.
+ /// </summary>
+ /// <typeparam name="TDeclarer">The type of the declaring object.</typeparam>
+ /// <typeparam name="TPropertyType">The type of the property.</typeparam>
+ /// <param name="staticgetter">An expression identifying a static method returning the value of the property using this BindableProperty as backing store.</param>
+ /// <param name="defaultValue">The default value for the property.</param>
+ /// <param name="defaultBindingMode">The BindingMode to use on SetBinding() if no BindingMode is given. This parameter is optional. Default is BindingMode.OneWay.</param>
+ /// <param name="validateValue">A delegate to be run when a value is set. This parameter is optional. Default is null.</param>
+ /// <param name="propertyChanged">A delegate to be run when the value has changed. This parameter is optional. Default is null.</param>
+ /// <param name="propertyChanging">A delegate to be run when the value will change. This parameter is optional. Default is null.</param>
+ /// <param name="coerceValue">A delegate used to coerce the range of a value. This parameter is optional. Default is null.</param>
+ /// <param name="defaultValueCreator">A Func used to initialize default value for reference types.</param>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [Obsolete("CreateAttached<> (generic) is obsolete as of version 2.1.0 and is no longer supported.")]
+ public static BindableProperty CreateAttached<TDeclarer, TPropertyType>(Expression<Func<BindableObject, TPropertyType>> staticgetter, TPropertyType defaultValue,
+ BindingMode defaultBindingMode = BindingMode.OneWay, ValidateValueDelegate<TPropertyType> validateValue = null, BindingPropertyChangedDelegate<TPropertyType> propertyChanged = null,
+ BindingPropertyChangingDelegate<TPropertyType> propertyChanging = null, CoerceValueDelegate<TPropertyType> coerceValue = null,
+ CreateDefaultValueDelegate<BindableObject, TPropertyType> defaultValueCreator = null)
+ {
+ return CreateAttached<TDeclarer, TPropertyType>(staticgetter, defaultValue, defaultBindingMode, validateValue, propertyChanged, propertyChanging, coerceValue, null,
+ defaultValueCreator: defaultValueCreator);
+ }
+
+ /// <summary>
+ /// Creates a new instance of the BindableProperty class for an attached property.
+ /// </summary>
+ /// <param name="propertyName">The name of the BindableProperty.</param>
+ /// <param name="returnType">The type of the property.</param>
+ /// <param name="declaringType">The type of the declaring object.</param>
+ /// <param name="defaultValue">The default value for the property.</param>
+ /// <param name="defaultBindingMode">The BindingMode to use on SetBinding() if no BindingMode is given. This parameter is optional. Default is BindingMode.OneWay.</param>
+ /// <param name="validateValue">A delegate to be run when a value is set. This parameter is optional. Default is null.</param>
+ /// <param name="propertyChanged">A delegate to be run when the value has changed. This parameter is optional. Default is null.</param>
+ /// <param name="propertyChanging">A delegate to be run when the value will change. This parameter is optional. Default is null.</param>
+ /// <param name="coerceValue">A delegate used to coerce the range of a value. This parameter is optional. Default is null.</param>
+ /// <param name="defaultValueCreator">A Func used to initialize default value for reference types.</param>
+ /// <returns>A newly created BindableProperty.</returns>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static BindableProperty CreateAttached(string propertyName, Type returnType, Type declaringType, object defaultValue, BindingMode defaultBindingMode = BindingMode.OneWay,
+ ValidateValueDelegate validateValue = null, BindingPropertyChangedDelegate propertyChanged = null, BindingPropertyChangingDelegate propertyChanging = null,
+ CoerceValueDelegate coerceValue = null, CreateDefaultValueDelegate defaultValueCreator = null)
+ {
+ return CreateAttached(propertyName, returnType, declaringType, defaultValue, defaultBindingMode, validateValue, propertyChanged, propertyChanging, coerceValue, null, false, defaultValueCreator);
+ }
+
+ /// <summary>
+ /// Deprecated. Do not use.
+ /// </summary>
+ /// <typeparam name="TDeclarer">The type of the declaring object.</typeparam>
+ /// <typeparam name="TPropertyType">The type of the property.</typeparam>
+ /// <param name="staticgetter">An expression identifying a static method returning the value of the property using this BindableProperty as backing store.</param>
+ /// <param name="defaultValue">The default value for the property.</param>
+ /// <param name="defaultBindingMode">The BindingMode to use on SetBinding() if no BindingMode is given. This parameter is optional. Default is BindingMode.OneWay.</param>
+ /// <param name="validateValue">A delegate to be run when a value is set. This parameter is optional. Default is null.</param>
+ /// <param name="propertyChanged">A delegate to be run when the value has changed. This parameter is optional. Default is null.</param>
+ /// <param name="propertyChanging">A delegate to be run when the value will change. This parameter is optional. Default is null.</param>
+ /// <param name="coerceValue">A delegate used to coerce the range of a value. This parameter is optional. Default is null.</param>
+ /// <param name="defaultValueCreator">A Func used to initialize default value for reference types.</param>
+ /// <returns>A newly created attached read-only BindablePropertyKey.</returns>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [Obsolete("CreateAttachedReadOnly<> (generic) is obsolete as of version 2.1.0 and is no longer supported.")]
+ public static BindablePropertyKey CreateAttachedReadOnly<TDeclarer, TPropertyType>(Expression<Func<BindableObject, TPropertyType>> staticgetter, TPropertyType defaultValue,
+ BindingMode defaultBindingMode = BindingMode.OneWayToSource, ValidateValueDelegate<TPropertyType> validateValue = null,
+ BindingPropertyChangedDelegate<TPropertyType> propertyChanged = null, BindingPropertyChangingDelegate<TPropertyType> propertyChanging = null,
+ CoerceValueDelegate<TPropertyType> coerceValue = null, CreateDefaultValueDelegate<BindableObject, TPropertyType> defaultValueCreator = null)
+
+ {
+ return
+ new BindablePropertyKey(CreateAttached<TDeclarer, TPropertyType>(staticgetter, defaultValue, defaultBindingMode, validateValue, propertyChanged, propertyChanging, coerceValue, null, true,
+ defaultValueCreator));
+ }
+
+ /// <summary>
+ /// Creates a new instance of the BindableProperty class for attached read-only properties.
+ /// </summary>
+ /// <param name="propertyName">The name of the BindableProperty.</param>
+ /// <param name="returnType">The type of the property.</param>
+ /// <param name="declaringType">The type of the declaring object.</param>
+ /// <param name="defaultValue">The default value for the property.</param>
+ /// <param name="defaultBindingMode">The BindingMode to use on SetBinding() if no BindingMode is given. This parameter is optional. Default is BindingMode.OneWay.</param>
+ /// <param name="validateValue">A delegate to be run when a value is set. This parameter is optional. Default is null.</param>
+ /// <param name="propertyChanged">A delegate to be run when the value has changed. This parameter is optional. Default is null.</param>
+ /// <param name="propertyChanging">A delegate to be run when the value will change. This parameter is optional. Default is null.</param>
+ /// <param name="coerceValue">A delegate used to coerce the range of a value. This parameter is optional. Default is null.</param>
+ /// <param name="defaultValueCreator">A Func used to initialize default value for reference types.</param>
+ /// <returns>A newly created attached read-only BindablePropertyKey.</returns>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static BindablePropertyKey CreateAttachedReadOnly(string propertyName, Type returnType, Type declaringType, object defaultValue, BindingMode defaultBindingMode = BindingMode.OneWayToSource,
+ ValidateValueDelegate validateValue = null, BindingPropertyChangedDelegate propertyChanged = null, BindingPropertyChangingDelegate propertyChanging = null,
+ CoerceValueDelegate coerceValue = null, CreateDefaultValueDelegate defaultValueCreator = null)
+ {
+ return
+ new BindablePropertyKey(CreateAttached(propertyName, returnType, declaringType, defaultValue, defaultBindingMode, validateValue, propertyChanged, propertyChanging, coerceValue, null, true,
+ defaultValueCreator));
+ }
+
+ /// <summary>
+ /// Deprecated. Do not use.
+ /// </summary>
+ /// <typeparam name="TDeclarer">The type of the declaring object.</typeparam>
+ /// <typeparam name="TPropertyType">The type of the property.</typeparam>
+ /// <param name="getter">An expression identifying the getter for the property using this BindableProperty as backing store.</param>
+ /// <param name="defaultValue">The default value for the property.</param>
+ /// <param name="defaultBindingMode">The BindingMode to use on SetBinding() if no BindingMode is given. This parameter is optional. Default is BindingMode.OneWay.</param>
+ /// <param name="validateValue">A delegate to be run when a value is set. This parameter is optional. Default is null.</param>
+ /// <param name="propertyChanged">A delegate to be run when the value has changed. This parameter is optional. Default is null.</param>
+ /// <param name="propertyChanging">A delegate to be run when the value will change. This parameter is optional. Default is null.</param>
+ /// <param name="coerceValue">A delegate used to coerce the range of a value. This parameter is optional. Default is null.</param>
+ /// <param name="defaultValueCreator">A Func used to initialize default value for reference types.</param>
+ /// <returns>A newly created BindablePropertyKey.</returns>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [Obsolete("CreateReadOnly<> (generic) is obsolete as of version 2.1.0 and is no longer supported.")]
+ public static BindablePropertyKey CreateReadOnly<TDeclarer, TPropertyType>(Expression<Func<TDeclarer, TPropertyType>> getter, TPropertyType defaultValue,
+ BindingMode defaultBindingMode = BindingMode.OneWayToSource, ValidateValueDelegate<TPropertyType> validateValue = null,
+ BindingPropertyChangedDelegate<TPropertyType> propertyChanged = null, BindingPropertyChangingDelegate<TPropertyType> propertyChanging = null,
+ CoerceValueDelegate<TPropertyType> coerceValue = null, CreateDefaultValueDelegate<TDeclarer, TPropertyType> defaultValueCreator = null) where TDeclarer : BindableObject
+ {
+ return new BindablePropertyKey(Create(getter, defaultValue, defaultBindingMode, validateValue, propertyChanged, propertyChanging, coerceValue, null, true, defaultValueCreator));
+ }
+
+ /// <summary>
+ /// Creates a new instance of the BindablePropertyKey class.
+ /// </summary>
+ /// <param name="propertyName">The name of the BindableProperty.</param>
+ /// <param name="returnType">The type of the property.</param>
+ /// <param name="declaringType">The type of the declaring object.</param>
+ /// <param name="defaultValue">The default value for the property.</param>
+ /// <param name="defaultBindingMode">The BindingMode to use on SetBinding() if no BindingMode is given. This parameter is optional. Default is BindingMode.OneWay.</param>
+ /// <param name="validateValue">A delegate to be run when a value is set. This parameter is optional. Default is null.</param>
+ /// <param name="propertyChanged">A delegate to be run when the value has changed. This parameter is optional. Default is null.</param>
+ /// <param name="propertyChanging">A delegate to be run when the value will change. This parameter is optional. Default is null.</param>
+ /// <param name="coerceValue">A delegate used to coerce the range of a value. This parameter is optional. Default is null.</param>
+ /// <param name="defaultValueCreator">A Func used to initialize default value for reference types.</param>
+ /// <returns>A newly created BindablePropertyKey.</returns>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static BindablePropertyKey CreateReadOnly(string propertyName, Type returnType, Type declaringType, object defaultValue, BindingMode defaultBindingMode = BindingMode.OneWayToSource,
+ ValidateValueDelegate validateValue = null, BindingPropertyChangedDelegate propertyChanged = null, BindingPropertyChangingDelegate propertyChanging = null,
+ CoerceValueDelegate coerceValue = null, CreateDefaultValueDelegate defaultValueCreator = null)
+ {
+ return
+ new BindablePropertyKey(new BindableProperty(propertyName, returnType, declaringType, defaultValue, defaultBindingMode, validateValue, propertyChanged, propertyChanging, coerceValue,
+ isReadOnly: true, defaultValueCreator: defaultValueCreator));
+ }
+
+ [Obsolete("Create<> (generic) is obsolete as of version 2.1.0 and is no longer supported.")]
+ internal static BindableProperty Create<TDeclarer, TPropertyType>(Expression<Func<TDeclarer, TPropertyType>> getter, TPropertyType defaultValue, BindingMode defaultBindingMode,
+ ValidateValueDelegate<TPropertyType> validateValue, BindingPropertyChangedDelegate<TPropertyType> propertyChanged, BindingPropertyChangingDelegate<TPropertyType> propertyChanging,
+ CoerceValueDelegate<TPropertyType> coerceValue, BindablePropertyBindingChanging bindingChanging, bool isReadOnly = false,
+ CreateDefaultValueDelegate<TDeclarer, TPropertyType> defaultValueCreator = null) where TDeclarer : BindableObject
+ {
+ if (getter == null)
+ throw new ArgumentNullException("getter");
+
+ Expression expr = getter.Body;
+
+ var unary = expr as UnaryExpression;
+ if (unary != null)
+ expr = unary.Operand;
+
+ var member = expr as MemberExpression;
+ if (member == null)
+ throw new ArgumentException("getter must be a MemberExpression", "getter");
+
+ var property = (PropertyInfo)member.Member;
+
+ ValidateValueDelegate untypedValidateValue = null;
+ BindingPropertyChangedDelegate untypedBindingPropertyChanged = null;
+ BindingPropertyChangingDelegate untypedBindingPropertyChanging = null;
+ CoerceValueDelegate untypedCoerceValue = null;
+ CreateDefaultValueDelegate untypedDefaultValueCreator = null;
+ if (validateValue != null)
+ untypedValidateValue = (bindable, value) => validateValue(bindable, (TPropertyType)value);
+ if (propertyChanged != null)
+ untypedBindingPropertyChanged = (bindable, oldValue, newValue) => propertyChanged(bindable, (TPropertyType)oldValue, (TPropertyType)newValue);
+ if (propertyChanging != null)
+ untypedBindingPropertyChanging = (bindable, oldValue, newValue) => propertyChanging(bindable, (TPropertyType)oldValue, (TPropertyType)newValue);
+ if (coerceValue != null)
+ untypedCoerceValue = (bindable, value) => coerceValue(bindable, (TPropertyType)value);
+ if (defaultValueCreator != null)
+ untypedDefaultValueCreator = o => defaultValueCreator((TDeclarer)o);
+
+ return new BindableProperty(property.Name, property.PropertyType, typeof(TDeclarer), defaultValue, defaultBindingMode, untypedValidateValue, untypedBindingPropertyChanged,
+ untypedBindingPropertyChanging, untypedCoerceValue, bindingChanging, isReadOnly, untypedDefaultValueCreator);
+ }
+
+ internal static BindableProperty Create(string propertyName, Type returnType, Type declaringType, object defaultValue, BindingMode defaultBindingMode, ValidateValueDelegate validateValue,
+ BindingPropertyChangedDelegate propertyChanged, BindingPropertyChangingDelegate propertyChanging, CoerceValueDelegate coerceValue, BindablePropertyBindingChanging bindingChanging,
+ CreateDefaultValueDelegate defaultValueCreator = null)
+ {
+ return new BindableProperty(propertyName, returnType, declaringType, defaultValue, defaultBindingMode, validateValue, propertyChanged, propertyChanging, coerceValue, bindingChanging,
+ defaultValueCreator: defaultValueCreator);
+ }
+
+ [Obsolete("CreateAttached<> (generic) is obsolete as of version 2.1.0 and is no longer supported.")]
+ internal static BindableProperty CreateAttached<TDeclarer, TPropertyType>(Expression<Func<BindableObject, TPropertyType>> staticgetter, TPropertyType defaultValue, BindingMode defaultBindingMode,
+ ValidateValueDelegate<TPropertyType> validateValue, BindingPropertyChangedDelegate<TPropertyType> propertyChanged, BindingPropertyChangingDelegate<TPropertyType> propertyChanging,
+ CoerceValueDelegate<TPropertyType> coerceValue, BindablePropertyBindingChanging bindingChanging, bool isReadOnly = false,
+ CreateDefaultValueDelegate<BindableObject, TPropertyType> defaultValueCreator = null)
+ {
+ if (staticgetter == null)
+ throw new ArgumentNullException("staticgetter");
+
+ Expression expr = staticgetter.Body;
+
+ var unary = expr as UnaryExpression;
+ if (unary != null)
+ expr = unary.Operand;
+
+ var methodcall = expr as MethodCallExpression;
+ if (methodcall == null)
+ throw new ArgumentException("staticgetter must be a MethodCallExpression", "staticgetter");
+
+ MethodInfo method = methodcall.Method;
+ if (!method.Name.StartsWith("Get", StringComparison.Ordinal))
+ throw new ArgumentException("staticgetter name must start with Get", "staticgetter");
+
+ string propertyname = method.Name.Substring(3);
+
+ ValidateValueDelegate untypedValidateValue = null;
+ BindingPropertyChangedDelegate untypedBindingPropertyChanged = null;
+ BindingPropertyChangingDelegate untypedBindingPropertyChanging = null;
+ CoerceValueDelegate untypedCoerceValue = null;
+ CreateDefaultValueDelegate untypedDefaultValueCreator = null;
+ if (validateValue != null)
+ untypedValidateValue = (bindable, value) => validateValue(bindable, (TPropertyType)value);
+ if (propertyChanged != null)
+ untypedBindingPropertyChanged = (bindable, oldValue, newValue) => propertyChanged(bindable, (TPropertyType)oldValue, (TPropertyType)newValue);
+ if (propertyChanging != null)
+ untypedBindingPropertyChanging = (bindable, oldValue, newValue) => propertyChanging(bindable, (TPropertyType)oldValue, (TPropertyType)newValue);
+ if (coerceValue != null)
+ untypedCoerceValue = (bindable, value) => coerceValue(bindable, (TPropertyType)value);
+ if (defaultValueCreator != null)
+ untypedDefaultValueCreator = o => defaultValueCreator(o);
+
+ return new BindableProperty(propertyname, method.ReturnType, typeof(TDeclarer), defaultValue, defaultBindingMode, untypedValidateValue, untypedBindingPropertyChanged, untypedBindingPropertyChanging,
+ untypedCoerceValue, bindingChanging, isReadOnly, untypedDefaultValueCreator);
+ }
+
+ internal static BindableProperty CreateAttached(string propertyName, Type returnType, Type declaringType, object defaultValue, BindingMode defaultBindingMode, ValidateValueDelegate validateValue,
+ BindingPropertyChangedDelegate propertyChanged, BindingPropertyChangingDelegate propertyChanging, CoerceValueDelegate coerceValue, BindablePropertyBindingChanging bindingChanging,
+ bool isReadOnly, CreateDefaultValueDelegate defaultValueCreator = null)
+ {
+ return new BindableProperty(propertyName, returnType, declaringType, defaultValue, defaultBindingMode, validateValue, propertyChanged, propertyChanging, coerceValue, bindingChanging, isReadOnly,
+ defaultValueCreator);
+ }
+
+ internal object GetDefaultValue(BindableObject bindable)
+ {
+ if (DefaultValueCreator != null)
+ return DefaultValueCreator(bindable);
+
+ return DefaultValue;
+ }
+
+ internal bool TryConvert(ref object value)
+ {
+ if (value == null)
+ {
+ return !ReturnTypeInfo.IsValueType || ReturnTypeInfo.IsGenericType && ReturnTypeInfo.GetGenericTypeDefinition() == typeof(Nullable<>);
+ }
+
+ Type valueType = value.GetType();
+ Type type = ReturnType;
+
+ // Dont support arbitrary IConvertible by limiting which types can use this
+ Type[] convertableTo;
+ TypeConverter typeConverterTo;
+ if (SimpleConvertTypes.TryGetValue(valueType, out convertableTo) && Array.IndexOf(convertableTo, type) != -1)
+ {
+ value = Convert.ChangeType(value, type);
+ }
+ else if (WellKnownConvertTypes.TryGetValue(type, out typeConverterTo) && typeConverterTo.CanConvertFrom(valueType))
+ {
+ value = typeConverterTo.ConvertFromInvariantString(value.ToString());
+ }
+ else if (UserCustomConvertTypes.TryGetValue(type, out typeConverterTo) && typeConverterTo.CanConvertFrom(valueType))
+ {
+ //Modification for NUI XAML : user defined converter for DynamicResource can be added
+ value = typeConverterTo.ConvertFromInvariantString(value.ToString());
+ }
+ else if (!ReturnTypeInfo.IsAssignableFrom(valueType.GetTypeInfo()))
+ {
+ var cast = type.GetImplicitConversionOperator(fromType: valueType, toType: type)
+ ?? valueType.GetImplicitConversionOperator(fromType: valueType, toType: type);
+
+ if (cast == null)
+ return false;
+
+ value = cast.Invoke(null, new[] { value });
+ }
+
+ return true;
+ }
+
+ internal delegate void BindablePropertyBindingChanging(BindableObject bindable, BindingBase oldValue, BindingBase newValue);
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Globalization;
+using System.Linq;
+using System.Reflection;
+using System.Xml;
+using Tizen.NUI.XamlBinding.Internals;
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// <summary>
+ /// The class to convert bindable property.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [Xaml.ProvideCompiled("Tizen.NUI.Xaml.Forms.XamlC.BindablePropertyConverter")]
+ [Xaml.TypeConversion(typeof(BindableProperty))]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public sealed class BindablePropertyTypeConverter : TypeConverter, IExtendedTypeConverter
+ {
+ object IExtendedTypeConverter.ConvertFrom(CultureInfo culture, object value, IServiceProvider serviceProvider)
+ {
+ return ((IExtendedTypeConverter)this).ConvertFromInvariantString(value as string, serviceProvider);
+ }
+
+ object IExtendedTypeConverter.ConvertFromInvariantString(string value, IServiceProvider serviceProvider)
+ {
+ if (string.IsNullOrWhiteSpace(value))
+ return null;
+ if (serviceProvider == null)
+ return null;
+ var parentValuesProvider = serviceProvider.GetService(typeof(IProvideValueTarget)) as IProvideParentValues;
+ var typeResolver = serviceProvider.GetService(typeof(IXamlTypeResolver)) as IXamlTypeResolver;
+ if (typeResolver == null)
+ return null;
+ IXmlLineInfo lineinfo = null;
+ var xmlLineInfoProvider = serviceProvider.GetService(typeof(IXmlLineInfoProvider)) as IXmlLineInfoProvider;
+ if (xmlLineInfoProvider != null)
+ lineinfo = xmlLineInfoProvider.XmlLineInfo;
+ string[] parts = value.Split('.');
+ Type type = null;
+ if (parts.Length == 1)
+ {
+ if (parentValuesProvider == null)
+ {
+ string msg = string.Format("Can't resolve {0}", parts[0]);
+ throw new XamlParseException(msg, lineinfo);
+ }
+ object parent = parentValuesProvider.ParentObjects.Skip(1).FirstOrDefault();
+ if (parentValuesProvider.TargetObject is Setter)
+ {
+ var style = parent as Style;
+ var triggerBase = parent as TriggerBase;
+ var visualState = parent as VisualState;
+ if (style != null)
+ type = style.TargetType;
+ else if (triggerBase != null)
+ type = triggerBase.TargetType;
+ else if (visualState != null)
+ type = FindTypeForVisualState(parentValuesProvider, lineinfo);
+ }
+ else if (parentValuesProvider.TargetObject is Trigger)
+ type = (parentValuesProvider.TargetObject as Trigger).TargetType;
+ else if (parentValuesProvider.TargetObject is XamlPropertyCondition && (parent as TriggerBase) != null)
+ type = (parent as TriggerBase).TargetType;
+
+ if (type == null)
+ throw new XamlParseException($"Can't resolve {parts [0]}", lineinfo);
+
+ return ConvertFrom(type, parts[0], lineinfo);
+ }
+ if (parts.Length == 2)
+ {
+ if (!typeResolver.TryResolve(parts[0], out type))
+ {
+ string msg = string.Format("Can't resolve {0}", parts[0]);
+ throw new XamlParseException(msg, lineinfo);
+ }
+ return ConvertFrom(type, parts[1], lineinfo);
+ }
+ throw new XamlParseException($"Can't resolve {value}. Syntax is [[prefix:]Type.]PropertyName.", lineinfo);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override object ConvertFromInvariantString(string value)
+ {
+ if (string.IsNullOrWhiteSpace(value))
+ return null;
+ if (value.Contains(":"))
+ {
+ Console.WriteLine(null, "Can't resolve properties with xml namespace prefix.");
+ return null;
+ }
+ string[] parts = value.Split('.');
+ if (parts.Length != 2)
+ {
+ Console.WriteLine(null, $"Can't resolve {value}. Accepted syntax is Type.PropertyName.");
+ return null;
+ }
+ Type type = Type.GetType("Tizen.NUI." + parts[0]);
+ return ConvertFrom(type, parts[1], null);
+ }
+
+ BindableProperty ConvertFrom(Type type, string propertyName, IXmlLineInfo lineinfo)
+ {
+ string name = propertyName + "Property";
+ FieldInfo bpinfo = type.GetField(fi => fi.Name == name && fi.IsStatic && fi.IsPublic && fi.FieldType == typeof(BindableProperty));
+ if (bpinfo == null)
+ throw new XamlParseException($"Can't resolve {name} on {type.Name}", lineinfo);
+ var bp = bpinfo.GetValue(null) as BindableProperty;
+ var isObsolete = bpinfo.GetCustomAttribute<ObsoleteAttribute>() != null;
+ if (bp.PropertyName != propertyName && !isObsolete)
+ throw new XamlParseException($"The PropertyName of {type.Name}.{name} is not {propertyName}", lineinfo);
+ return bp;
+ }
+
+ Type FindTypeForVisualState(IProvideParentValues parentValueProvider, IXmlLineInfo lineInfo)
+ {
+ var parents = parentValueProvider.ParentObjects.ToList();
+
+ // Skip 0; we would not be making this check if TargetObject were not a Setter
+ // Skip 1; we would not be making this check if the immediate parent were not a VisualState
+
+ // VisualStates must be in a VisualStateGroup
+ if(!(parents[2] is VisualStateGroup)) {
+ throw new XamlParseException($"Expected {nameof(VisualStateGroup)} but found {parents[2]}.", lineInfo);
+ }
+
+ var vsTarget = parents[3];
+
+ // Are these Visual States directly on a VisualElement?
+ if (vsTarget is Element)
+ {
+ return vsTarget.GetType();
+ }
+
+ if (!(parents[3] is VisualStateGroupList))
+ {
+ throw new XamlParseException($"Expected {nameof(VisualStateGroupList)} but found {parents[3]}.", lineInfo);
+ }
+
+ if (!(parents[4] is Setter))
+ {
+ throw new XamlParseException($"Expected {nameof(Setter)} but found {parents[4]}.", lineInfo);
+ }
+
+ // These must be part of a Style; verify that
+ if (!(parents[5] is Style style))
+ {
+ throw new XamlParseException($"Expected {nameof(Style)} but found {parents[5]}.", lineInfo);
+ }
+
+ return style.TargetType;
+ }
+ }
+}
--- /dev/null
+using System;
+using System.ComponentModel;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// <summary>
+ /// The secret key to a BindableProperty, used to implement a BindableProperty with restricted write access.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public sealed class BindablePropertyKey
+ {
+ internal BindablePropertyKey(BindableProperty property)
+ {
+ if (property == null)
+ throw new ArgumentNullException("property");
+
+ BindableProperty = property;
+ }
+
+ /// <summary>
+ /// Gets the BindableProperty.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public BindableProperty BindableProperty { get; private set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Globalization;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Reflection;
+using System.Text;
+using Tizen.NUI.XamlBinding.Internals;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public sealed class Binding : BindingBase
+ {
+ internal const string SelfPath = ".";
+ IValueConverter _converter;
+ object _converterParameter;
+
+ BindingExpression _expression;
+ string _path;
+ object _source;
+ string _updateSourceEventName;
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Binding()
+ {
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Binding(string path, BindingMode mode = BindingMode.Default, IValueConverter converter = null, object converterParameter = null, string stringFormat = null, object source = null)
+ {
+ if (path == null)
+ throw new ArgumentNullException("path");
+ if (string.IsNullOrWhiteSpace(path))
+ throw new ArgumentException("path can not be an empty string", "path");
+
+ Path = path;
+ Converter = converter;
+ ConverterParameter = converterParameter;
+ Mode = mode;
+ StringFormat = stringFormat;
+ Source = source;
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public IValueConverter Converter
+ {
+ get { return _converter; }
+ set
+ {
+ ThrowIfApplied();
+
+ _converter = value;
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object ConverterParameter
+ {
+ get { return _converterParameter; }
+ set
+ {
+ ThrowIfApplied();
+
+ _converterParameter = value;
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string Path
+ {
+ get { return _path; }
+ set
+ {
+ ThrowIfApplied();
+
+ _path = value;
+ _expression = new BindingExpression(this, !string.IsNullOrWhiteSpace(value) ? value : SelfPath);
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object Source
+ {
+ get { return _source; }
+ set
+ {
+ ThrowIfApplied();
+ _source = value;
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string UpdateSourceEventName {
+ get { return _updateSourceEventName; }
+ set {
+ ThrowIfApplied();
+ _updateSourceEventName = value;
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [Obsolete]
+ public static Binding Create<TSource>(Expression<Func<TSource, object>> propertyGetter, BindingMode mode = BindingMode.Default, IValueConverter converter = null, object converterParameter = null,
+ string stringFormat = null)
+ {
+ if (propertyGetter == null)
+ throw new ArgumentNullException("propertyGetter");
+
+ return new Binding(GetBindingPath(propertyGetter), mode, converter, converterParameter, stringFormat);
+ }
+
+ internal override void Apply(bool fromTarget)
+ {
+ base.Apply(fromTarget);
+
+ if (_expression == null)
+ _expression = new BindingExpression(this, SelfPath);
+
+ _expression.Apply(fromTarget);
+ }
+
+ internal override void Apply(object newContext, BindableObject bindObj, BindableProperty targetProperty, bool fromBindingContextChanged = false)
+ {
+ object src = _source;
+ var isApplied = IsApplied;
+
+ base.Apply(src ?? newContext, bindObj, targetProperty, fromBindingContextChanged: fromBindingContextChanged);
+
+ if (src != null && isApplied && fromBindingContextChanged)
+ return;
+
+ object bindingContext = src ?? Context ?? newContext;
+ if (_expression == null && bindingContext != null)
+ _expression = new BindingExpression(this, SelfPath);
+
+ _expression?.Apply(bindingContext, bindObj, targetProperty);
+ }
+
+ internal override BindingBase Clone()
+ {
+ return new Binding(Path, Mode) { Converter = Converter, ConverterParameter = ConverterParameter, StringFormat = StringFormat, Source = Source, UpdateSourceEventName = UpdateSourceEventName };
+ }
+
+ internal override object GetSourceValue(object value, Type targetPropertyType)
+ {
+ if (Converter != null)
+ value = Converter.Convert(value, targetPropertyType, ConverterParameter, CultureInfo.CurrentUICulture);
+
+ return base.GetSourceValue(value, targetPropertyType);
+ }
+
+ internal override object GetTargetValue(object value, Type sourcePropertyType)
+ {
+ if (Converter != null)
+ value = Converter.ConvertBack(value, sourcePropertyType, ConverterParameter, CultureInfo.CurrentUICulture);
+
+ return base.GetTargetValue(value, sourcePropertyType);
+ }
+
+ internal override void Unapply(bool fromBindingContextChanged = false)
+ {
+ if (Source != null && fromBindingContextChanged && IsApplied)
+ return;
+
+ base.Unapply(fromBindingContextChanged: fromBindingContextChanged);
+
+ if (_expression != null)
+ _expression.Unapply();
+ }
+
+ [Obsolete]
+ static string GetBindingPath<TSource>(Expression<Func<TSource, object>> propertyGetter)
+ {
+ Expression expr = propertyGetter.Body;
+
+ var unary = expr as UnaryExpression;
+ if (unary != null)
+ expr = unary.Operand;
+
+ var builder = new StringBuilder();
+
+ var indexed = false;
+
+ var member = expr as MemberExpression;
+ if (member == null)
+ {
+ var methodCall = expr as MethodCallExpression;
+ if (methodCall != null)
+ {
+ if (methodCall.Arguments.Count == 0)
+ throw new ArgumentException("Method calls are not allowed in binding expression");
+
+ var arguments = new List<string>(methodCall.Arguments.Count);
+ foreach (Expression arg in methodCall.Arguments)
+ {
+ if (arg.NodeType != ExpressionType.Constant)
+ throw new ArgumentException("Only constants can be used as indexer arguments");
+
+ object value = ((ConstantExpression)arg).Value;
+ arguments.Add(value != null ? value.ToString() : "null");
+ }
+
+ Type declarerType = methodCall.Method.DeclaringType;
+ DefaultMemberAttribute defaultMember = declarerType.GetTypeInfo().GetCustomAttributes(typeof(DefaultMemberAttribute), true).OfType<DefaultMemberAttribute>().FirstOrDefault();
+ string indexerName = defaultMember != null ? defaultMember.MemberName : "Item";
+
+ MethodInfo getterInfo =
+ declarerType.GetProperties().Where(pi => pi.Name == indexerName && pi.CanRead && pi.GetMethod.IsPublic && !pi.GetMethod.IsStatic).Select(pi => pi.GetMethod).FirstOrDefault();
+ if (getterInfo != null)
+ {
+ if (getterInfo == methodCall.Method)
+ {
+ indexed = true;
+ builder.Append("[");
+
+ var first = true;
+ foreach (string argument in arguments)
+ {
+ if (!first)
+ builder.Append(",");
+
+ builder.Append(argument);
+ first = false;
+ }
+
+ builder.Append("]");
+
+ member = methodCall.Object as MemberExpression;
+ }
+ else
+ throw new ArgumentException("Method calls are not allowed in binding expressions");
+ }
+ else
+ throw new ArgumentException("Public indexer not found");
+ }
+ else
+ throw new ArgumentException("Invalid expression type");
+ }
+
+ while (member != null)
+ {
+ var property = (PropertyInfo)member.Member;
+ if (builder.Length != 0)
+ {
+ if (!indexed)
+ builder.Insert(0, ".");
+ else
+ indexed = false;
+ }
+
+ builder.Insert(0, property.Name);
+
+ // member = member.Expression as MemberExpression ?? (member.Expression as UnaryExpression)?.Operand as MemberExpression;
+ member = member.Expression as MemberExpression ?? (member.Expression is UnaryExpression ? (member.Expression as UnaryExpression).Operand as MemberExpression : null);
+ }
+
+ return builder.ToString();
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections;
+using System.Runtime.CompilerServices;
+using System.ComponentModel;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// <summary>
+ /// An abstract class that provides a BindingMode and a formatting option.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public abstract class BindingBase
+ {
+ static readonly ConditionalWeakTable<IEnumerable, CollectionSynchronizationContext> SynchronizedCollections = new ConditionalWeakTable<IEnumerable, CollectionSynchronizationContext>();
+
+ BindingMode _mode = BindingMode.Default;
+ string _stringFormat;
+ object _targetNullValue;
+ object _fallbackValue;
+
+ internal BindingBase()
+ {
+ }
+
+ /// <summary>
+ /// Gets or sets the mode for this binding.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public BindingMode Mode
+ {
+ get { return _mode; }
+ set
+ {
+ if ( value != BindingMode.Default
+ && value != BindingMode.OneWay
+ && value != BindingMode.OneWayToSource
+ && value != BindingMode.TwoWay
+ && value != BindingMode.OneTime)
+ throw new ArgumentException("mode is not a valid BindingMode", "mode");
+
+ ThrowIfApplied();
+
+ _mode = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the string format for this binding.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string StringFormat
+ {
+ get { return _stringFormat; }
+ set
+ {
+ ThrowIfApplied();
+
+ _stringFormat = value;
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object TargetNullValue
+ {
+ get { return _targetNullValue; }
+ set {
+ ThrowIfApplied();
+ _targetNullValue = value;
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object FallbackValue {
+ get => _fallbackValue;
+ set {
+ ThrowIfApplied();
+ _fallbackValue = value;
+ }
+ }
+
+ internal bool AllowChaining { get; set; }
+
+ internal object Context { get; set; }
+
+ internal bool IsApplied { get; private set; }
+
+ /// <summary>
+ /// Stops synchronization on the collection.
+ /// </summary>
+ /// <param name="collection">The collection on which to stop synchronization.</param>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static void DisableCollectionSynchronization(IEnumerable collection)
+ {
+ if (collection == null)
+ throw new ArgumentNullException(nameof(collection));
+
+ SynchronizedCollections.Remove(collection);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static void EnableCollectionSynchronization(IEnumerable collection, object context, CollectionSynchronizationCallback callback)
+ {
+ if (collection == null)
+ throw new ArgumentNullException(nameof(collection));
+ if (callback == null)
+ throw new ArgumentNullException(nameof(callback));
+
+ SynchronizedCollections.Add(collection, new CollectionSynchronizationContext(context, callback));
+ }
+
+ /// <summary>
+ /// Throws an InvalidOperationException if the binding has been applied.
+ /// </summary>
+ protected void ThrowIfApplied()
+ {
+ if (IsApplied)
+ throw new InvalidOperationException("Can not change a binding while it's applied");
+ }
+
+ internal virtual void Apply(bool fromTarget)
+ {
+ IsApplied = true;
+ }
+
+ internal virtual void Apply(object context, BindableObject bindObj, BindableProperty targetProperty, bool fromBindingContextChanged = false)
+ {
+ IsApplied = true;
+ }
+
+ internal abstract BindingBase Clone();
+
+ internal virtual object GetSourceValue(object value, Type targetPropertyType)
+ {
+ if (value == null && TargetNullValue != null)
+ return TargetNullValue;
+ if (StringFormat != null)
+ return string.Format(StringFormat, value);
+
+ return value;
+ }
+
+ internal virtual object GetTargetValue(object value, Type sourcePropertyType)
+ {
+ return value;
+ }
+
+ internal static bool TryGetSynchronizedCollection(IEnumerable collection, out CollectionSynchronizationContext synchronizationContext)
+ {
+ if (collection == null)
+ throw new ArgumentNullException(nameof(collection));
+
+ return SynchronizedCollections.TryGetValue(collection, out synchronizationContext);
+ }
+
+ internal virtual void Unapply(bool fromBindingContextChanged = false)
+ {
+ IsApplied = false;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.ComponentModel;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// <summary>
+ /// The direction of changes propagation for bindings.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public enum BindingMode
+ {
+ /// <summary>
+ /// When used in Bindings, indicates that the Binding should use the DefaultBindingMode. When used in BindableProperty declaration, defaults to BindingMode.OneWay.
+ /// </summary>
+ Default,
+
+ /// <summary>
+ /// Indicates that the binding should propagates changes from source (usually the View Model) to target (the BindableObject) in both directions.
+ /// </summary>
+ TwoWay,
+
+ /// <summary>
+ /// Indicates that the binding should only propagate changes from source (usually the View Model) to target (the BindableObject). This is the default mode for most BindableProperty values.
+ /// </summary>
+ OneWay,
+
+ /// <summary>
+ /// Indicates that the binding should only propagate changes from target (the BindableObject) to source (usually the View Model). This is mainly used for read-only BindableProperty values.
+ /// </summary>
+ OneWayToSource,
+
+ /// <summary>
+ /// Indicates that the binding will be applied only when the binding context changes and the value will not be monitored for changes with INotifyPropertyChanged.
+ /// </summary>
+ OneTime,
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections;
+using System.ComponentModel;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public delegate void CollectionSynchronizationCallback(IEnumerable collection, object context, Action accessMethod, bool writeAccess);
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.ComponentModel;
+using System.Globalization;
+using Tizen.NUI;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [Xaml.ProvideCompiled("Tizen.NUI.Xaml.Forms.XamlC.ColorTypeConverter")]
+ [Xaml.TypeConversion(typeof(Color))]
+ public class ColorTypeConverter : TypeConverter
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override object ConvertFromInvariantString(string value)
+ {
+ if (value != null)
+ {
+ value = value.Trim();
+ if (value.StartsWith("#", StringComparison.Ordinal))
+ {
+ return FromHex(value);
+ }
+
+ string[] parts = value.Split(',');
+ if (parts.Length == 1) //like Red or Color.Red
+ {
+ parts = value.Split('.');
+ if (parts.Length == 1 || (parts.Length == 2 && parts[0] == "Color"))
+ {
+ string color = parts[parts.Length - 1];
+ switch (color)
+ {
+ case "Black": return Color.Black;
+ case "White": return Color.White;
+ case "Red": return Color.Red;
+ case "Green": return Color.Green;
+ case "Blue": return Color.Blue;
+ case "Yellow": return Color.Yellow;
+ case "Magenta": return Color.Magenta;
+ case "Cyan": return Color.Cyan;
+ case "Transparent": return Color.Transparent;
+ }
+ }
+ }
+ else if (parts.Length == 4) //like 0.5,0.5,0.5,0.5
+ {
+ 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));
+ }
+ }
+
+ throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(Color)}");
+ }
+
+ static uint ToHex(char c)
+ {
+ ushort x = (ushort)c;
+ if (x >= '0' && x <= '9')
+ return (uint)(x - '0');
+
+ x |= 0x20;
+ if (x >= 'a' && x <= 'f')
+ return (uint)(x - 'a' + 10);
+ return 0;
+ }
+
+ static uint ToHexD(char c)
+ {
+ var j = ToHex(c);
+ return (j << 4) | j;
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static Color FromRgba(int r, int g, int b, int a)
+ {
+ float red = (float)r / 255;
+ float green = (float)g / 255;
+ float blue = (float)b / 255;
+ float alpha = (float)a / 255;
+ return new Color(red, green, blue, alpha);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static Color FromRgb(int r, int g, int b)
+ {
+ return FromRgba(r, g, b, 255);
+ }
+
+ static Color FromHex(string hex)
+ {
+ // Undefined
+ if (hex.Length < 3)
+ return Color.Black;
+ int idx = (hex[0] == '#') ? 1 : 0;
+
+ switch (hex.Length - idx)
+ {
+ case 3: //#rgb => ffrrggbb
+ var t1 = ToHexD(hex[idx++]);
+ var t2 = ToHexD(hex[idx++]);
+ var t3 = ToHexD(hex[idx]);
+
+ return FromRgb((int)t1, (int)t2, (int)t3);
+
+ case 4: //#argb => aarrggbb
+ var f1 = ToHexD(hex[idx++]);
+ var f2 = ToHexD(hex[idx++]);
+ var f3 = ToHexD(hex[idx++]);
+ var f4 = ToHexD(hex[idx]);
+ return FromRgba((int)f2, (int)f3, (int)f4, (int)f1);
+
+ case 6: //#rrggbb => ffrrggbb
+ return FromRgb((int)(ToHex(hex[idx++]) << 4 | ToHex(hex[idx++])),
+ (int)(ToHex(hex[idx++]) << 4 | ToHex(hex[idx++])),
+ (int)(ToHex(hex[idx++]) << 4 | ToHex(hex[idx])));
+
+ case 8: //#aarrggbb
+ var a1 = ToHex(hex[idx++]) << 4 | ToHex(hex[idx++]);
+ return FromRgba((int)(ToHex(hex[idx++]) << 4 | ToHex(hex[idx++])),
+ (int)(ToHex(hex[idx++]) << 4 | ToHex(hex[idx++])),
+ (int)(ToHex(hex[idx++]) << 4 | ToHex(hex[idx])),
+ (int)a1);
+
+ default: //everything else will result in unexpected results
+ return Color.Black;
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Reflection;
+using System.Windows.Input;
+using System.ComponentModel;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public sealed class Command<T> : Command
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Command(Action<T> execute)
+ : base(o =>
+ {
+ if (IsValidParameter(o))
+ {
+ execute((T)o);
+ }
+ })
+ {
+ if (execute == null)
+ {
+ throw new ArgumentNullException(nameof(execute));
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Command(Action<T> execute, Func<T, bool> canExecute)
+ : base(o =>
+ {
+ if (IsValidParameter(o))
+ {
+ execute((T)o);
+ }
+ }, o => IsValidParameter(o) && canExecute((T)o))
+ {
+ if (execute == null)
+ throw new ArgumentNullException(nameof(execute));
+ if (canExecute == null)
+ throw new ArgumentNullException(nameof(canExecute));
+ }
+
+ static bool IsValidParameter(object o)
+ {
+ if (o != null)
+ {
+ // The parameter isn't null, so we don't have to worry whether null is a valid option
+ return o is T;
+ }
+
+ var t = typeof(T);
+
+ // The parameter is null. Is T Nullable?
+ if (Nullable.GetUnderlyingType(t) != null)
+ {
+ return true;
+ }
+
+ // Not a Nullable, if it's a value type then null is not valid
+ return !t.GetTypeInfo().IsValueType;
+ }
+ }
+
+ /// <summary>
+ /// Defines an ICommand implementation that wraps a Action.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class Command : ICommand
+ {
+ readonly Func<object, bool> _canExecute;
+ readonly Action<object> _execute;
+
+ /// <summary>
+ /// Initializes a new instance of the Command class.
+ /// </summary>
+ /// <param name="execute">An instance to execute when the Command is executed.</param>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Command(Action<object> execute)
+ {
+ if (execute == null)
+ throw new ArgumentNullException(nameof(execute));
+
+ _execute = execute;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the Command class.
+ /// </summary>
+ /// <param name="execute">An Action to execute when the Command is executed.</param>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Command(Action execute) : this(o => execute())
+ {
+ if (execute == null)
+ throw new ArgumentNullException(nameof(execute));
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the Command class.
+ /// </summary>
+ /// <param name="execute">An Action to execute when the Command is executed.</param>
+ /// <param name="canExecute">A instance indicating if the Command can be executed.</param>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Command(Action<object> execute, Func<object, bool> canExecute) : this(execute)
+ {
+ if (canExecute == null)
+ throw new ArgumentNullException(nameof(canExecute));
+
+ _canExecute = canExecute;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the Command class.
+ /// </summary>
+ /// <param name="execute">An Action to execute when the Command is executed.</param>
+ /// <param name="canExecute">A instance indicating if the Command can be executed.</param>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Command(Action execute, Func<bool> canExecute) : this(o => execute(), o => canExecute())
+ {
+ if (execute == null)
+ throw new ArgumentNullException(nameof(execute));
+ if (canExecute == null)
+ throw new ArgumentNullException(nameof(canExecute));
+ }
+
+ /// <summary>
+ /// Returns a Boolean indicating if the Command can be exectued with the given parameter.
+ /// </summary>
+ /// <param name="parameter">An Object used as parameter to determine if the Command can be executed.</param>
+ /// <returns>true if the Command can be executed, false otherwise.</returns>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool CanExecute(object parameter)
+ {
+ if (_canExecute != null)
+ return _canExecute(parameter);
+
+ return true;
+ }
+
+ /// <summary>
+ /// Occurs when the target of the Command should reevaluate whether or not the Command can be executed.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler CanExecuteChanged;
+
+ /// <summary>
+ /// Invokes the execute Action.
+ /// </summary>
+ /// <param name="parameter">An Object used as parameter for the execute Action.</param>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Execute(object parameter)
+ {
+ _execute(parameter);
+ }
+
+ /// <summary>
+ /// Send a CanExecuteChanged.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void ChangeCanExecute()
+ {
+ EventHandler changed = CanExecuteChanged;
+ changed?.Invoke(this, EventArgs.Empty);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System;
+using System.ComponentModel;
+using Tizen.NUI.XamlBinding;
+using Tizen.NUI.Xaml.Forms.BaseComponents;
+using Tizen.NUI;
+using System.Collections.Generic;
+using System.IO;
+using System.Reflection;
+
+namespace Tizen.NUI.Xaml
+{
+ /// <summary>
+ /// The ContentPage class.
+ /// </summary>
+ [ContentProperty("Content")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class ContentPage : TemplatedPage, Tizen.NUI.Binding.IResourcesProvider
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public View Root {get; internal set;}
+
+ /// This will be public opened in tizen_5.5 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 = (ContentPage)bindable;
+ if (newValue != null)
+ {
+ self.Root.Add((View)newValue);
+ }
+ });
+
+ /// <summary>
+ /// The contents of ContentPage can be added into it.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public View Content
+ {
+ get { return (View)GetValue(ContentProperty); }
+ set { SetValue(ContentProperty, value); }
+ }
+
+ ResourceDictionary _resources;
+ bool Tizen.NUI.Binding.IResourcesProvider.IsResourcesCreated => _resources != null;
+
+ /// <summary>
+ /// Method that is called when the binding content changes.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ResourceDictionary XamlResources
+ {
+ get
+ {
+ if (_resources != null)
+ return _resources;
+
+ _resources = new ResourceDictionary();
+ ((IResourceDictionary)_resources).ValuesChanged += OnResourcesChanged;
+ return _resources;
+ }
+ set
+ {
+ if (_resources == value)
+ return;
+ OnPropertyChanging();
+ if (_resources != null)
+ ((IResourceDictionary)_resources).ValuesChanged -= OnResourcesChanged;
+ _resources = value;
+ OnResourcesChanged(value);
+ if (_resources != null)
+ ((IResourceDictionary)_resources).ValuesChanged += OnResourcesChanged;
+ OnPropertyChanged();
+ }
+ }
+
+ /// <summary>
+ /// Method that is called when the binding content changes.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void OnBindingContextChanged()
+ {
+ base.OnBindingContextChanged();
+
+ View content = Content;
+ ControlTemplate controlTemplate = ControlTemplate;
+ if (content != null && controlTemplate != null)
+ {
+ SetInheritedBindingContext(content, BindingContext);
+ }
+ }
+
+ internal override void OnControlTemplateChanged(ControlTemplate oldValue, ControlTemplate newValue)
+ {
+ if (oldValue == null)
+ return;
+
+ base.OnControlTemplateChanged(oldValue, newValue);
+ View content = Content;
+ ControlTemplate controlTemplate = ControlTemplate;
+ if (content != null && controlTemplate != null)
+ {
+ SetInheritedBindingContext(content, BindingContext);
+ }
+ }
+
+ /// <summary>
+ /// The constructor.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ContentPage(Window win)
+ {
+ Root = new View();
+ Root.WidthResizePolicy = ResizePolicyType.FillToParent;
+ Root.HeightResizePolicy = ResizePolicyType.FillToParent;
+ (Root as IElement).Parent = this;
+
+ win.Add(Root.view);
+ }
+
+ /// <summary>
+ /// Check whether the content is empty.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool IsEmpty
+ {
+ get
+ {
+ return ( Root.ChildCount == 0 ) ? true : false;
+ }
+ }
+
+ /// <summary>
+ /// Clear all contents from this ContentPage.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void ClearContent()
+ {
+ if ( Root != null )
+ {
+ //Remove it from the window
+ Window.Instance.Remove(Root.view);
+ Root.Dispose();
+ Root = null;
+
+ //Readd to window
+ Root = new View();
+ Root.WidthResizePolicy = ResizePolicyType.FillToParent;
+ Root.HeightResizePolicy = ResizePolicyType.FillToParent;
+ Window.Instance.Add(Root.view);
+
+ ClearHandler();
+ }
+ }
+
+ private EventHandler _clearEventHandler;
+
+ /// <summary>
+ /// Clear event.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler ClearEvent
+ {
+ add
+ {
+ _clearEventHandler += value;
+ }
+ remove
+ {
+ _clearEventHandler -= value;
+ }
+ }
+
+ private void ClearHandler()
+ {
+ if (_clearEventHandler != null)
+ {
+ _clearEventHandler(this, null);
+ }
+ }
+
+ /// <summary>
+ /// Users can set focus logic codes here.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual void SetFocus() { }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.IO;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Xml;
+using Tizen.NUI.XamlBinding.Internals;
+using Tizen.NUI.StyleSheets;
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// <summary>
+ /// Provides the base class for all Tizen.NUI.XamlBinding hierarchal elements. This class contains all the methods and properties required to represent an element in the Tizen.NUI.XamlBinding hierarchy.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public abstract partial class Element : BindableObject, IElement, INameScope, IElementController, IStyleSelectable
+ {
+ internal static readonly ReadOnlyCollection<Element> EmptyChildren = new ReadOnlyCollection<Element>(new Element[0]);
+
+ /// <summary>
+ /// Identifies the ClassId bindable property.
+ /// </summary>
+ internal static readonly BindableProperty ClassIdProperty = BindableProperty.Create("ClassId", typeof(string), typeof(Tizen.NUI.Xaml.Forms.BaseComponents.View), null);
+
+ string _automationId;
+
+ IList<BindableObject> _bindableResources;
+
+ List<Action<object, ResourcesChangedEventArgs>> _changeHandlers;
+
+ Dictionary<BindableProperty, string> _dynamicResources;
+
+ IEffectControlProvider _effectControlProvider;
+
+ TrackableCollection<Effect> _effects;
+
+ Guid? _id;
+
+ Element _parentOverride;
+
+ IPlatform _platform;
+
+ string _styleId;
+
+ IEnumerable<IStyleSelectable> IStyleSelectable.Children => LogicalChildrenInternal;
+
+ string[] _styleSelectableNameAndBaseNames;
+
+ IStyleSelectable IStyleSelectable.Parent => Parent;
+
+ /// <summary>
+ /// Gets or sets a value that allows the automation framework to find and interact with this element.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string AutomationId
+ {
+ get { return _automationId; }
+ set
+ {
+ if (_automationId != null)
+ throw new InvalidOperationException("AutomationId may only be set one time");
+ _automationId = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value used to identify a collection of semantically similar elements.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string ClassId
+ {
+ get { return (string)GetValue(ClassIdProperty); }
+ set { SetValue(ClassIdProperty, value); }
+ }
+
+ internal IList<Effect> Effects
+ {
+ get
+ {
+ if (_effects == null)
+ {
+ _effects = new TrackableCollection<Effect>();
+ _effects.CollectionChanged += EffectsOnCollectionChanged;
+ _effects.Clearing += EffectsOnClearing;
+ }
+ return _effects;
+ }
+ }
+
+ /// <summary>
+ /// Gets a value that can be used to uniquely identify an element through the run of an application.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Guid Id
+ {
+ get
+ {
+ if (!_id.HasValue)
+ _id = Guid.NewGuid();
+ return _id.Value;
+ }
+ }
+
+ /// <summary>
+ /// Gets the element which is the closest ancestor of this element that is a BaseHandle.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [Obsolete("ParentView is obsolete as of version 2.1.0. Please use Parent instead.")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Element ParentView
+ {
+ get
+ {
+ Element parent = Parent;
+ while (parent != null)
+ {
+ var parentView = parent as Element;
+ if (parentView != null)
+ return parentView;
+ parent = parent.RealParent;
+ }
+ return null;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a user defined value to uniquely identify the element.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string StyleId
+ {
+ get { return _styleId; }
+ set
+ {
+ if (_styleId == value)
+ return;
+
+ OnPropertyChanging();
+ _styleId = value;
+ OnPropertyChanged();
+ }
+ }
+
+ internal virtual ReadOnlyCollection<Element> LogicalChildrenInternal => EmptyChildren;
+
+ /// <summary>
+ /// For internal use.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ReadOnlyCollection<Element> LogicalChildren => LogicalChildrenInternal;
+
+ internal bool Owned { get; set; }
+
+ internal Element ParentOverride
+ {
+ get { return _parentOverride; }
+ set
+ {
+ if (_parentOverride == value)
+ return;
+
+ bool emitChange = Parent != value;
+
+ if (emitChange)
+ OnPropertyChanging(nameof(Parent));
+
+ _parentOverride = value;
+
+ if (emitChange)
+ OnPropertyChanged(nameof(Parent));
+ }
+ }
+
+ /// <summary>
+ /// For internal use.
+ /// </summary>
+ internal IPlatform Platform
+ {
+ get
+ {
+ if (_platform == null && RealParent != null)
+ return RealParent.Platform;
+ return _platform;
+ }
+ set
+ {
+ if (_platform == value)
+ return;
+ _platform = value;
+ PlatformSet?.Invoke(this, EventArgs.Empty);
+ foreach (Element descendant in Descendants())
+ {
+ descendant._platform = _platform;
+ descendant.PlatformSet?.Invoke(this, EventArgs.Empty);
+ }
+ }
+ }
+
+ /// <summary>
+ /// For internal use.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Element RealParent { get; private set; }
+
+ Dictionary<BindableProperty, string> DynamicResources
+ {
+ get { return _dynamicResources ?? (_dynamicResources = new Dictionary<BindableProperty, string>()); }
+ }
+
+ void IElement.AddResourcesChangedListener(Action<object, ResourcesChangedEventArgs> onchanged)
+ {
+ _changeHandlers = _changeHandlers ?? new List<Action<object, ResourcesChangedEventArgs>>(2);
+ _changeHandlers.Add(onchanged);
+ }
+
+ /// <summary>
+ /// Gets or sets the parent element of the element.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Element Parent
+ {
+ get { return _parentOverride ?? RealParent; }
+ set
+ {
+ if (RealParent == value)
+ return;
+
+ OnPropertyChanging();
+
+ if (RealParent != null)
+ ((IElement)RealParent).RemoveResourcesChangedListener(OnParentResourcesChanged);
+ RealParent = value;
+ if (RealParent != null)
+ {
+ OnParentResourcesChanged(RealParent?.GetMergedResources());
+ ((IElement)RealParent).AddResourcesChangedListener(OnParentResourcesChanged);
+ }
+
+ object context = value != null ? value.BindingContext : null;
+ if (value != null)
+ {
+ value.SetChildInheritedBindingContext(this, context);
+ }
+ else
+ {
+ SetInheritedBindingContext(this, null);
+ }
+
+ OnParentSet();
+
+ if (RealParent != null)
+ {
+ IPlatform platform = RealParent.Platform;
+ if (platform != null)
+ Platform = platform;
+ }
+
+ OnPropertyChanged();
+ }
+ }
+
+ void IElement.RemoveResourcesChangedListener(Action<object, ResourcesChangedEventArgs> onchanged)
+ {
+ if (_changeHandlers == null)
+ return;
+ _changeHandlers.Remove(onchanged);
+ }
+
+ /// <summary>
+ /// For internal use.
+ /// </summary>
+ internal IEffectControlProvider EffectControlProvider
+ {
+ get { return _effectControlProvider; }
+ set
+ {
+ if (_effectControlProvider == value)
+ return;
+ if (_effectControlProvider != null && _effects != null)
+ {
+ foreach (Effect effect in _effects)
+ effect?.SendDetached();
+ }
+ _effectControlProvider = value;
+ if (_effectControlProvider != null && _effects != null)
+ {
+ foreach (Effect effect in _effects)
+ {
+ if (effect != null)
+ AttachEffect(effect);
+ }
+ }
+ }
+ }
+
+ IList<string> IStyleSelectable.Classes => null;
+
+ string IStyleSelectable.Id => StyleId;
+
+ string[] IStyleSelectable.NameAndBases
+ {
+ get
+ {
+ if (_styleSelectableNameAndBaseNames == null)
+ {
+ var list = new List<string>();
+ var t = GetType();
+ while (t != typeof(BindableObject))
+ {
+ list.Add(t.Name);
+ t = t.GetTypeInfo().BaseType;
+ }
+ _styleSelectableNameAndBaseNames = list.ToArray();
+ }
+ return _styleSelectableNameAndBaseNames;
+ }
+ }
+
+ //void IElementController.SetValueFromRenderer(BindableProperty property, object value) => SetValueFromRenderer(property, value);
+
+ /// <summary>
+ /// Sets the value of the specified property.
+ /// </summary>
+ /// <param name="property">The BindableProperty on which to assign a value.</param>
+ /// <param name="value">The value to set.</param>
+ internal void SetValueFromRenderer(BindableProperty property, object value)
+ {
+ SetValueCore(property, value);
+ }
+
+ /// <summary>
+ /// Sets the value of the propertyKey.
+ /// </summary>
+ /// <param name="property">The BindablePropertyKey on which to assign a value.</param>
+ /// <param name="value">The value to set.</param>
+ internal void SetValueFromRenderer(BindablePropertyKey property, object value)
+ {
+ SetValueCore(property, value);
+ }
+
+ /// <summary>
+ /// For internal use.
+ /// </summary>
+ /// <param name="name">The nameof the effect</param>
+ /// <returns>true if attached</returns>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool EffectIsAttached(string name)
+ {
+ foreach (var effect in Effects)
+ {
+ if (effect.ResolveId == name)
+ return true;
+ }
+ return false;
+ }
+
+ object INameScope.FindByName(string name)
+ {
+ INameScope namescope = GetNameScope();
+ if (namescope == null)
+ {
+ //throw new InvalidOperationException("this element is not in a namescope");
+ return null;
+ }
+ else
+ {
+ return namescope.FindByName(name);
+ }
+ }
+
+ void INameScope.RegisterName(string name, object scopedElement)
+ {
+ INameScope namescope = GetNameScope();
+ if (namescope == null)
+ throw new InvalidOperationException("this element is not in a namescope");
+ namescope.RegisterName(name, scopedElement);
+ }
+
+ [Obsolete]
+ void INameScope.RegisterName(string name, object scopedElement, IXmlLineInfo xmlLineInfo)
+ {
+ INameScope namescope = GetNameScope();
+ if (namescope == null)
+ throw new InvalidOperationException("this element is not in a namescope");
+ namescope.RegisterName(name, scopedElement, xmlLineInfo);
+ }
+
+ void INameScope.UnregisterName(string name)
+ {
+ INameScope namescope = GetNameScope();
+ if (namescope == null)
+ throw new InvalidOperationException("this element is not in a namescope");
+ namescope.UnregisterName(name);
+ }
+
+ internal event EventHandler<ElementEventArgs> ChildAdded;
+
+ internal event EventHandler<ElementEventArgs> ChildRemoved;
+
+ internal event EventHandler<ElementEventArgs> DescendantAdded;
+
+ internal event EventHandler<ElementEventArgs> DescendantRemoved;
+
+ /// <summary>
+ /// Removes a previously set dynamic resource.
+ /// </summary>
+ /// <param name="property">The BindableProperty from which to remove the DynamicResource.</param>
+ internal new void RemoveDynamicResource(BindableProperty property)
+ {
+ base.RemoveDynamicResource(property);
+ }
+
+ /// <summary>
+ /// Sets the BindableProperty property of this element to be updated via the DynamicResource with the provided key.
+ /// </summary>
+ /// <param name="property">The BindableProperty.</param>
+ /// <param name="key">The key of the DynamicResource</param>
+ internal new void SetDynamicResource(BindableProperty property, string key)
+ {
+ base.SetDynamicResource(property, key);
+ }
+
+ /// <summary>
+ /// Invoked whenever the binding context of the element changes. Implement this method to add class handling for this event.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void OnBindingContextChanged()
+ {
+ var gotBindingContext = false;
+ object bc = null;
+
+ for (var index = 0; index < LogicalChildrenInternal.Count; index++)
+ {
+ Element child = LogicalChildrenInternal[index];
+
+ if (!gotBindingContext)
+ {
+ bc = BindingContext;
+ gotBindingContext = true;
+ }
+
+ SetChildInheritedBindingContext(child, bc);
+ }
+
+ if (_bindableResources != null)
+ foreach (BindableObject item in _bindableResources)
+ {
+ SetInheritedBindingContext(item, BindingContext);
+ }
+
+ base.OnBindingContextChanged();
+ }
+
+ /// <summary>
+ /// Invoked whenever the ChildAdded event needs to be emitted.Implement this method to add class handling for this event.
+ /// </summary>
+ /// <param name="child">The element that was added.</param>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected virtual void OnChildAdded(Element child)
+ {
+ child.Parent = this;
+ if (Platform != null)
+ child.Platform = Platform;
+
+ child.ApplyBindings(skipBindingContext: false, fromBindingContextChanged:true);
+
+ ChildAdded?.Invoke(this, new ElementEventArgs(child));
+
+ OnDescendantAdded(child);
+ foreach (Element element in child.Descendants())
+ OnDescendantAdded(element);
+ }
+
+ /// <summary>
+ /// Invoked whenever the ChildRemoved event needs to be emitted.Implement this method to add class handling for this event.
+ /// </summary>
+ /// <param name="child">The element that was removed.</param>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected virtual void OnChildRemoved(Element child)
+ {
+ child.Parent = null;
+
+ ChildRemoved?.Invoke(child, new ElementEventArgs(child));
+
+ OnDescendantRemoved(child);
+ foreach (Element element in child.Descendants())
+ OnDescendantRemoved(element);
+ }
+
+ /// <summary>
+ /// Invoked whenever the Parent of an element is set.Implement this method in order to add behavior when the element is added to a parent.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected virtual void OnParentSet()
+ {
+ ParentSet?.Invoke(this, EventArgs.Empty);
+ ApplyStyleSheetsOnParentSet();
+ }
+
+ /// <summary>
+ /// Method that is called when a bound property is changed.
+ /// </summary>
+ /// <param name="propertyName">The name of the bound property that changed.</param>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ base.OnPropertyChanged(propertyName);
+
+ if (_effects == null || _effects.Count == 0)
+ return;
+
+ var args = new PropertyChangedEventArgs(propertyName);
+ foreach (Effect effect in _effects)
+ {
+ effect?.SendOnElementPropertyChanged(args);
+ }
+ }
+
+ /// <summary>
+ /// For internal use.
+ /// </summary>
+ /// <returns>the elements</returns>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public IEnumerable<Element> Descendants()
+ {
+ var queue = new Queue<Element>(16);
+ queue.Enqueue(this);
+
+ while (queue.Count > 0)
+ {
+ ReadOnlyCollection<Element> children = queue.Dequeue().LogicalChildrenInternal;
+ for (var i = 0; i < children.Count; i++)
+ {
+ Element child = children[i];
+ yield return child;
+ queue.Enqueue(child);
+ }
+ }
+ }
+
+ internal virtual void OnParentResourcesChanged(object sender, ResourcesChangedEventArgs e)
+ {
+ if (e == ResourcesChangedEventArgs.StyleSheets)
+ ApplyStyleSheetsOnParentSet();
+ else
+ OnParentResourcesChanged(e.Values);
+ }
+
+ internal virtual void OnParentResourcesChanged(IEnumerable<KeyValuePair<string, object>> values)
+ {
+ OnResourcesChanged(values);
+ }
+
+ internal override void OnRemoveDynamicResource(BindableProperty property)
+ {
+ DynamicResources.Remove(property);
+
+ if (DynamicResources.Count == 0)
+ _dynamicResources = null;
+ base.OnRemoveDynamicResource(property);
+ }
+
+ internal virtual void OnResourcesChanged(object sender, ResourcesChangedEventArgs e)
+ {
+ OnResourcesChanged(e.Values);
+ }
+
+ internal void OnResourcesChanged(IEnumerable<KeyValuePair<string, object>> values)
+ {
+ if (values == null)
+ return;
+ if (_changeHandlers != null)
+ foreach (Action<object, ResourcesChangedEventArgs> handler in _changeHandlers)
+ handler(this, new ResourcesChangedEventArgs(values));
+ if (_dynamicResources == null)
+ return;
+ if (_bindableResources == null)
+ _bindableResources = new List<BindableObject>();
+ foreach (KeyValuePair<string, object> value in values)
+ {
+ List<BindableProperty> changedResources = null;
+ foreach (KeyValuePair<BindableProperty, string> dynR in DynamicResources)
+ {
+ // when the DynamicResource bound to a BindableProperty is
+ // changing then the BindableProperty needs to be refreshed;
+ // The .Value is the name of DynamicResouce to which the BindableProperty is bound.
+ // The .Key is the name of the DynamicResource whose value is changing.
+ if (dynR.Value != value.Key)
+ continue;
+ changedResources = changedResources ?? new List<BindableProperty>();
+ changedResources.Add(dynR.Key);
+ }
+ if (changedResources == null)
+ continue;
+ foreach (BindableProperty changedResource in changedResources)
+ OnResourceChanged(changedResource, value.Value);
+
+ var bindableObject = value.Value as BindableObject;
+ if (bindableObject != null && (bindableObject as Element)?.Parent == null)
+ {
+ if (!_bindableResources.Contains(bindableObject))
+ _bindableResources.Add(bindableObject);
+ SetInheritedBindingContext(bindableObject, BindingContext);
+ }
+ }
+ }
+
+ internal override void OnSetDynamicResource(BindableProperty property, string key)
+ {
+ base.OnSetDynamicResource(property, key);
+ DynamicResources[property] = key;
+ object value;
+ if (this.TryGetResource(key, out value))
+ OnResourceChanged(property, value);
+ }
+
+ internal event EventHandler ParentSet;
+
+ internal static void SetFlowDirectionFromParent(Element child)
+ {
+ // IFlowDirectionController controller = child as IFlowDirectionController;
+ // if (controller == null)
+ // return;
+
+ // if (controller.EffectiveFlowDirection.IsImplicit())
+ // {
+ // var parentView = child.Parent as IFlowDirectionController;
+ // if (parentView == null)
+ // return;
+
+ // var flowDirection = parentView.EffectiveFlowDirection.ToFlowDirection();
+
+ // if (flowDirection != controller.EffectiveFlowDirection.ToFlowDirection())
+ // {
+ // controller.EffectiveFlowDirection = flowDirection.ToEffectiveFlowDirection();
+ // }
+ // }
+ }
+
+ /// <summary>
+ /// For internal use.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler PlatformSet;
+
+ internal virtual void SetChildInheritedBindingContext(Element child, object context)
+ {
+ SetInheritedBindingContext(child, context);
+ }
+
+ internal IEnumerable<Element> VisibleDescendants()
+ {
+ var queue = new Queue<Element>(16);
+ queue.Enqueue(this);
+
+ while (queue.Count > 0)
+ {
+ ReadOnlyCollection<Element> children = queue.Dequeue().LogicalChildrenInternal;
+ for (var i = 0; i < children.Count; i++)
+ {
+ var child = children[i] as Element;
+ if (child == null /*|| !child.IsVisible*/)
+ continue;
+ yield return child;
+ queue.Enqueue(child);
+ }
+ }
+ }
+
+ void AttachEffect(Effect effect)
+ {
+ if (_effectControlProvider == null)
+ return;
+ if (effect.IsAttached)
+ throw new InvalidOperationException("Cannot attach Effect to multiple sources");
+
+ Effect effectToRegister = effect;
+ if (effect is RoutingEffect)
+ effectToRegister = ((RoutingEffect)effect).Inner;
+ _effectControlProvider.RegisterEffect(effectToRegister);
+ effectToRegister.Element = this;
+ effect.SendAttached();
+ }
+
+ void EffectsOnClearing(object sender, EventArgs eventArgs)
+ {
+ foreach (Effect effect in _effects)
+ {
+ effect?.ClearEffect();
+ }
+ }
+
+ void EffectsOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
+ {
+ switch (e.Action)
+ {
+ case NotifyCollectionChangedAction.Add:
+ foreach (Effect effect in e.NewItems)
+ {
+ AttachEffect(effect);
+ }
+ break;
+ case NotifyCollectionChangedAction.Move:
+ break;
+ case NotifyCollectionChangedAction.Remove:
+ foreach (Effect effect in e.OldItems)
+ {
+ effect.ClearEffect();
+ }
+ break;
+ case NotifyCollectionChangedAction.Replace:
+ foreach (Effect effect in e.NewItems)
+ {
+ AttachEffect(effect);
+ }
+ foreach (Effect effect in e.OldItems)
+ {
+ effect.ClearEffect();
+ }
+ break;
+ case NotifyCollectionChangedAction.Reset:
+ if (e.NewItems != null)
+ {
+ foreach (Effect effect in e.NewItems)
+ {
+ AttachEffect(effect);
+ }
+ }
+ if (e.OldItems != null)
+ {
+ foreach (Effect effect in e.OldItems)
+ {
+ effect.ClearEffect();
+ }
+ }
+ break;
+ default:
+ throw new ArgumentOutOfRangeException();
+ }
+ }
+
+ INameScope GetNameScope()
+ {
+ INameScope namescope = NameScope.GetNameScope(this);
+ Element p = RealParent;
+ while (namescope == null && p != null)
+ {
+ namescope = NameScope.GetNameScope(p);
+ p = p.RealParent;
+ }
+ return namescope;
+ }
+
+ void OnDescendantAdded(Element child)
+ {
+ DescendantAdded?.Invoke(this, new ElementEventArgs(child));
+
+ if (RealParent != null)
+ RealParent.OnDescendantAdded(child);
+ }
+
+ void OnDescendantRemoved(Element child)
+ {
+ DescendantRemoved?.Invoke(this, new ElementEventArgs(child));
+
+ if (RealParent != null)
+ RealParent.OnDescendantRemoved(child);
+ }
+
+ void OnResourceChanged(BindableProperty property, object value)
+ {
+ SetValueCore(property, value, SetValueFlags.ClearOneWayBindings | SetValueFlags.ClearTwoWayBindings);
+ }
+
+ //on parent set, or on parent stylesheet changed, reapply all
+ void ApplyStyleSheetsOnParentSet()
+ {
+ var parent = Parent;
+ if (parent == null)
+ return;
+ var sheets = new List<StyleSheet>();
+ while (parent != null)
+ {
+ var resourceProvider = parent as Tizen.NUI.Binding.IResourcesProvider;
+ var vpSheets = resourceProvider?.GetStyleSheets();
+ if (vpSheets != null)
+ sheets.AddRange(vpSheets);
+ parent = parent.Parent;
+ }
+ for (var i = sheets.Count - 1; i >= 0; i--)
+ ((IStyle)sheets[i]).Apply(this);
+ }
+
+ private Dictionary<string, Transition> transDictionary = new Dictionary<string, Transition>();
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Transition GetTransition(string transitionName)
+ {
+ Transition trans = null;
+ transDictionary.TryGetValue(transitionName, out trans);
+ return trans;
+ }
+
+ private void LoadTransitions()
+ {
+ foreach (string str in transitionNames)
+ {
+ string resourceName = str + ".xaml";
+ Transition trans = null;
+
+ string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
+
+ string likelyResourcePath = resource + "animation/" + resourceName;
+
+ if (File.Exists(likelyResourcePath))
+ {
+ trans = Extensions.LoadObject<Transition>(likelyResourcePath);
+ }
+ if (trans)
+ {
+ transDictionary.Add(trans.Name, trans);
+ }
+ }
+ }
+
+ private string[] transitionNames;
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string[] TransitionNames
+ {
+ get
+ {
+ return transitionNames;
+ }
+ set
+ {
+ transitionNames = value;
+ LoadTransitions();
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System.ComponentModel;
+
+namespace Tizen.NUI.XamlBinding
+{
+
+ /// <summary>
+ /// GraphicsTypeManager class to manage various types.
+ /// </summary>
+ /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
+ /// <since_tizen> 6 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class GraphicsTypeManager
+ {
+ internal void RegisterCustomConverterForDynamicResourceBinding(global::System.Type type, Tizen.NUI.XamlBinding.TypeConverter userConverter)
+ {
+ if (Tizen.NUI.XamlBinding.BindableProperty.UserCustomConvertTypes.ContainsKey(type) == false)
+ {
+ Tizen.NUI.XamlBinding.BindableProperty.UserCustomConvertTypes.Add(type, userConverter);
+ }
+ }
+ }
+
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.ComponentModel;
+using System.Globalization;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public interface IExtendedTypeConverter
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [Obsolete("IExtendedTypeConverter.ConvertFrom is obsolete as of version 2.2.0. Please use ConvertFromInvariantString (string, IServiceProvider) instead.")]
+ object ConvertFrom(CultureInfo culture, object value, IServiceProvider serviceProvider);
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ object ConvertFromInvariantString(string value, IServiceProvider serviceProvider);
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.ComponentModel;
+using Tizen.NUI.XamlBinding;
+
+namespace Tizen.NUI.Binding
+{
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public interface IResourcesProvider
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ bool IsResourcesCreated { get; }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ ResourceDictionary XamlResources { get; set; }
+ }
+}
--- /dev/null
+using System;
+using System.Globalization;
+using System.ComponentModel;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public interface IValueConverter
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ object Convert(object value, Type targetType, object parameter, CultureInfo culture);
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture);
+ }
+}
--- /dev/null
+using System;
+using System.ComponentModel;
+using System.Reflection;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// <summary>
+ /// The class Behavior.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public abstract class Behavior : BindableObject, IAttachedObject
+ {
+ internal Behavior(Type associatedType)
+ {
+ if (associatedType == null)
+ throw new ArgumentNullException("associatedType");
+ AssociatedType = associatedType;
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected Type AssociatedType { get; }
+
+ void IAttachedObject.AttachTo(BindableObject bindable)
+ {
+ if (bindable == null)
+ throw new ArgumentNullException("bindable");
+ if (!AssociatedType.IsInstanceOfType(bindable))
+ throw new InvalidOperationException("bindable not an instance of AssociatedType");
+ OnAttachedTo(bindable);
+ }
+
+ void IAttachedObject.DetachFrom(BindableObject bindable)
+ {
+ OnDetachingFrom(bindable);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected virtual void OnAttachedTo(BindableObject bindable)
+ {
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected virtual void OnDetachingFrom(BindableObject bindable)
+ {
+ }
+ }
+
+ internal abstract class Behavior<T> : Behavior where T : BindableObject
+ {
+ protected Behavior() : base(typeof(T))
+ {
+ }
+
+ protected override void OnAttachedTo(BindableObject bindable)
+ {
+ base.OnAttachedTo(bindable);
+ OnAttachedTo((T)bindable);
+ }
+
+ protected virtual void OnAttachedTo(T bindable)
+ {
+ }
+
+ protected override void OnDetachingFrom(BindableObject bindable)
+ {
+ OnDetachingFrom((T)bindable);
+ base.OnDetachingFrom(bindable);
+ }
+
+ protected virtual void OnDetachingFrom(T bindable)
+ {
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [ContentProperty("Setters")]
+ [ProvideCompiled("Tizen.NUI.Xaml.Forms.XamlC.PassthroughValueProvider")]
+ [AcceptEmptyServiceProvider]
+ public sealed class DataTrigger : TriggerBase, IValueProvider
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public DataTrigger([TypeConverter(typeof(TypeTypeConverter))] [Parameter("TargetType")] Type targetType) : base(new BindingCondition(), targetType)
+ {
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public BindingBase Binding
+ {
+ get { return ((BindingCondition)Condition).Binding; }
+ set
+ {
+ if (((BindingCondition)Condition).Binding == value)
+ return;
+ if (IsSealed)
+ throw new InvalidOperationException("Can not change Binding once the Trigger has been applied.");
+ OnPropertyChanging();
+ ((BindingCondition)Condition).Binding = value;
+ OnPropertyChanged();
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new IList<Setter> Setters
+ {
+ get { return base.Setters; }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object Value
+ {
+ get { return ((BindingCondition)Condition).Value; }
+ set
+ {
+ if (((BindingCondition)Condition).Value == value)
+ return;
+ if (IsSealed)
+ throw new InvalidOperationException("Can not change Value once the Trigger has been applied.");
+ OnPropertyChanging();
+ ((BindingCondition)Condition).Value = value;
+ OnPropertyChanged();
+ }
+ }
+
+ object IValueProvider.ProvideValue(IServiceProvider serviceProvider)
+ {
+ //This is no longer required
+ return this;
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Reflection;
+using Tizen.NUI.XamlBinding.Internals;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// <summary>
+ /// The class EventTrigger.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [ContentProperty("Actions")]
+ public sealed class EventTrigger : TriggerBase
+ {
+ static readonly MethodInfo s_handlerinfo = typeof(EventTrigger).GetRuntimeMethods().Single(mi => mi.Name == "OnEventTriggered" && mi.IsPublic == false);
+ readonly List<BindableObject> _associatedObjects = new List<BindableObject>();
+
+ EventInfo _eventinfo;
+
+ string _eventname;
+ Delegate _handlerdelegate;
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public EventTrigger() : base(typeof(BindableObject))
+ {
+ Actions = new SealedList<TriggerAction>();
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public IList<TriggerAction> Actions { get; }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string Event
+ {
+ get { return _eventname; }
+ set
+ {
+ if (_eventname == value)
+ return;
+ if (IsSealed)
+ throw new InvalidOperationException("Event cannot be changed once the Trigger has been applied");
+ OnPropertyChanging();
+ _eventname = value;
+ OnPropertyChanged();
+ }
+ }
+
+ internal override void OnAttachedTo(BindableObject bindable)
+ {
+ base.OnAttachedTo(bindable);
+ if (!string.IsNullOrEmpty(Event))
+ AttachHandlerTo(bindable);
+ _associatedObjects.Add(bindable);
+ }
+
+ internal override void OnDetachingFrom(BindableObject bindable)
+ {
+ _associatedObjects.Remove(bindable);
+ DetachHandlerFrom(bindable);
+ base.OnDetachingFrom(bindable);
+ }
+
+ internal override void OnSeal()
+ {
+ base.OnSeal();
+ ((SealedList<TriggerAction>)Actions).IsReadOnly = true;
+ }
+
+ void AttachHandlerTo(BindableObject bindable)
+ {
+ try
+ {
+ _eventinfo = bindable.GetType().GetRuntimeEvent(Event);
+ _handlerdelegate = s_handlerinfo.CreateDelegate(_eventinfo?.EventHandlerType, this);
+ }
+ catch (Exception)
+ {
+ Console.WriteLine("EventTrigger", "Can not attach EventTrigger to {0}.{1}. Check if the handler exists and if the signature is right.", bindable.GetType(), Event);
+ }
+ if (_eventinfo != null && _handlerdelegate != null)
+ _eventinfo.AddEventHandler(bindable, _handlerdelegate);
+ }
+
+ void DetachHandlerFrom(BindableObject bindable)
+ {
+ if (_eventinfo != null && _handlerdelegate != null)
+ _eventinfo.RemoveEventHandler(bindable, _handlerdelegate);
+ }
+
+ // [Preserve]
+ void OnEventTriggered(object sender, EventArgs e)
+ {
+ var bindable = (BindableObject)sender;
+ foreach (TriggerAction action in Actions)
+ action.DoInvoke(bindable);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Reflection;
+
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// <summary>
+ /// The class Trigger.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [ContentProperty("Setters")]
+ [ProvideCompiled("Tizen.NUI.Xaml.Forms.XamlC.PassthroughValueProvider")]
+ [AcceptEmptyServiceProvider]
+ public sealed class Trigger : TriggerBase, IValueProvider
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Trigger([TypeConverter(typeof(TypeTypeConverter))] [Parameter("TargetType")] Type targetType) : base(new XamlPropertyCondition(), targetType)
+ {
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public BindableProperty Property
+ {
+ get { return ((XamlPropertyCondition)Condition).Property; }
+ set
+ {
+ if (((XamlPropertyCondition)Condition).Property == value)
+ return;
+ if (IsSealed)
+ throw new InvalidOperationException("Can not change Property once the Trigger has been applied.");
+ OnPropertyChanging();
+ ((XamlPropertyCondition)Condition).Property = value;
+ OnPropertyChanged();
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new IList<Setter> Setters
+ {
+ get { return base.Setters; }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object Value
+ {
+ get { return ((XamlPropertyCondition)Condition).Value; }
+ set
+ {
+ if (((XamlPropertyCondition)Condition).Value == value)
+ return;
+ if (IsSealed)
+ throw new InvalidOperationException("Can not change Value once the Trigger has been applied.");
+ OnPropertyChanging();
+ ((XamlPropertyCondition)Condition).Value = value;
+ OnPropertyChanged();
+ }
+ }
+
+ object IValueProvider.ProvideValue(IServiceProvider serviceProvider)
+ {
+ //This is no longer required
+ return this;
+ }
+ }
+}
--- /dev/null
+using System;
+using System.ComponentModel;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// <summary>
+ /// The class TriggerAction.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public abstract class TriggerAction
+ {
+ internal TriggerAction(Type associatedType)
+ {
+ if (associatedType == null)
+ throw new ArgumentNullException("associatedType");
+ AssociatedType = associatedType;
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected Type AssociatedType { get; private set; }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected abstract void Invoke(object sender);
+
+ internal virtual void DoInvoke(object sender)
+ {
+ Invoke(sender);
+ }
+ }
+
+ internal abstract class TriggerAction<T> : TriggerAction where T : BindableObject
+ {
+ protected TriggerAction() : base(typeof(T))
+ {
+ }
+
+ protected override void Invoke(object sender)
+ {
+ Invoke((T)sender);
+ }
+
+ protected abstract void Invoke(T sender);
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Reflection;
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// <summary>
+ /// The class TriggerBase.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public abstract class TriggerBase : BindableObject, IAttachedObject
+ {
+ bool _isSealed;
+
+ internal TriggerBase(Type targetType)
+ {
+ if (targetType == null)
+ throw new ArgumentNullException("targetType");
+ TargetType = targetType;
+
+ EnterActions = new SealedList<TriggerAction>();
+ ExitActions = new SealedList<TriggerAction>();
+ }
+
+ internal TriggerBase(Condition condition, Type targetType) : this(targetType)
+ {
+ Setters = new SealedList<Setter>();
+ Condition = condition;
+ Condition.ConditionChanged = OnConditionChanged;
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public IList<TriggerAction> EnterActions { get; }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public IList<TriggerAction> ExitActions { get; }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool IsSealed
+ {
+ get { return _isSealed; }
+ private set
+ {
+ if (_isSealed == value)
+ return;
+ if (!value)
+ throw new InvalidOperationException("What is sealed can not be unsealed.");
+ _isSealed = value;
+ OnSeal();
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Type TargetType { get; }
+
+ internal Condition Condition { get; }
+
+ //Setters and Condition are used by Trigger, DataTrigger and MultiTrigger
+ internal IList<Setter> Setters { get; }
+
+ void IAttachedObject.AttachTo(BindableObject bindable)
+ {
+ IsSealed = true;
+
+ if (bindable == null)
+ throw new ArgumentNullException("bindable");
+ if (!TargetType.IsInstanceOfType(bindable))
+ throw new InvalidOperationException("bindable not an instance of AssociatedType");
+ OnAttachedTo(bindable);
+ }
+
+ void IAttachedObject.DetachFrom(BindableObject bindable)
+ {
+ if (bindable == null)
+ throw new ArgumentNullException("bindable");
+ OnDetachingFrom(bindable);
+ }
+
+ internal virtual void OnAttachedTo(BindableObject bindable)
+ {
+ if (Condition != null)
+ Condition.SetUp(bindable);
+ }
+
+ internal virtual void OnDetachingFrom(BindableObject bindable)
+ {
+ if (Condition != null)
+ Condition.TearDown(bindable);
+ }
+
+ internal virtual void OnSeal()
+ {
+ ((SealedList<TriggerAction>)EnterActions).IsReadOnly = true;
+ ((SealedList<TriggerAction>)ExitActions).IsReadOnly = true;
+ if (Setters != null)
+ ((SealedList<Setter>)Setters).IsReadOnly = true;
+ if (Condition != null)
+ Condition.IsSealed = true;
+ }
+
+ void OnConditionChanged(BindableObject bindable, bool oldValue, bool newValue)
+ {
+ if (newValue)
+ {
+ foreach (TriggerAction action in EnterActions)
+ action.DoInvoke(bindable);
+ foreach (Setter setter in Setters)
+ setter.Apply(bindable);
+ }
+ else
+ {
+ foreach (Setter setter in Setters)
+ setter.UnApply(bindable);
+ foreach (TriggerAction action in ExitActions)
+ action.DoInvoke(bindable);
+ }
+ }
+
+ internal class SealedList<T> : IList<T>
+ {
+ readonly IList<T> _actual;
+
+ bool _isReadOnly;
+
+ public SealedList()
+ {
+ _actual = new List<T>();
+ }
+
+ public void Add(T item)
+ {
+ if (IsReadOnly)
+ throw new InvalidOperationException("This list is ReadOnly");
+ _actual.Add(item);
+ }
+
+ public void Clear()
+ {
+ if (IsReadOnly)
+ throw new InvalidOperationException("This list is ReadOnly");
+ _actual.Clear();
+ }
+
+ public bool Contains(T item)
+ {
+ return _actual.Contains(item);
+ }
+
+ public void CopyTo(T[] array, int arrayIndex)
+ {
+ _actual.CopyTo(array, arrayIndex);
+ }
+
+ public int Count
+ {
+ get { return _actual.Count; }
+ }
+
+ public bool IsReadOnly
+ {
+ get { return _isReadOnly; }
+ set
+ {
+ if (_isReadOnly == value)
+ return;
+ if (!value)
+ throw new InvalidOperationException("Can't change this back to non readonly");
+ _isReadOnly = value;
+ }
+ }
+
+ public bool Remove(T item)
+ {
+ if (IsReadOnly)
+ throw new InvalidOperationException("This list is ReadOnly");
+ return _actual.Remove(item);
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return ((IEnumerable)_actual).GetEnumerator();
+ }
+
+ public IEnumerator<T> GetEnumerator()
+ {
+ return _actual.GetEnumerator();
+ }
+
+ public int IndexOf(T item)
+ {
+ return _actual.IndexOf(item);
+ }
+
+ public void Insert(int index, T item)
+ {
+ if (IsReadOnly)
+ throw new InvalidOperationException("This list is ReadOnly");
+ _actual.Insert(index, item);
+ }
+
+ public T this[int index]
+ {
+ get { return _actual[index]; }
+ set
+ {
+ if (IsReadOnly)
+ throw new InvalidOperationException("This list is ReadOnly");
+ _actual[index] = value;
+ }
+ }
+
+ public void RemoveAt(int index)
+ {
+ if (IsReadOnly)
+ throw new InvalidOperationException("This list is ReadOnly");
+ _actual.RemoveAt(index);
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.ComponentModel;
+
+namespace Tizen.NUI.XamlBinding.Internals
+{
+ /// <summary>
+ /// The class DynamicResource.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class DynamicResource
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public DynamicResource(string key)
+ {
+ Key = key;
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string Key { get; private set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.ComponentModel;
+using Tizen.NUI.XamlBinding;
+
+namespace Tizen.NUI.XamlBinding.Internals
+{
+ /// <summary>
+ /// The interface IDynamicResourceHandler.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public interface IDynamicResourceHandler
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ void SetDynamicResource(BindableProperty property, string key);
+ }
+}
--- /dev/null
+using System;
+using System.ComponentModel;
+using System.Xml;
+
+namespace Tizen.NUI.XamlBinding.Internals
+{
+ /// <summary>
+ /// The interface INameScope.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public interface INameScope
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ object FindByName(string name);
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ void RegisterName(string name, object scopedElement);
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ void UnregisterName(string name);
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [Obsolete]void RegisterName(string name, object scopedElement, IXmlLineInfo xmlLineInfo);
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Xml;
+using Tizen.NUI.XamlBinding;
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI.XamlBinding.Internals
+{
+ /// <summary>
+ /// The class NameScope.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class NameScope : INameScope
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty NameScopeProperty = BindableProperty.CreateAttached("NameScope", typeof(INameScope), typeof(NameScope), default(INameScope));
+
+ readonly Dictionary<string, object> _names = new Dictionary<string, object>();
+
+ object INameScope.FindByName(string name)
+ {
+ if (_names.ContainsKey(name))
+ return _names[name];
+ return null;
+ }
+
+ void INameScope.RegisterName(string name, object scopedElement)
+ {
+ if (_names.ContainsKey(name))
+ throw new ArgumentException("An element with the same key already exists in NameScope", "name");
+
+ _names[name] = scopedElement;
+ }
+
+ [Obsolete]
+ void INameScope.RegisterName(string name, object scopedElement, IXmlLineInfo xmlLineInfo)
+ {
+ try
+ {
+ ((INameScope)this).RegisterName(name, scopedElement);
+ }
+ catch (ArgumentException)
+ {
+ throw new XamlParseException(string.Format("An element with the name \"{0}\" already exists in this NameScope", name), xmlLineInfo);
+ }
+ }
+
+ void INameScope.UnregisterName(string name)
+ {
+ _names.Remove(name);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static INameScope GetNameScope(BindableObject bindable)
+ {
+ return (INameScope)bindable.GetValue(NameScopeProperty);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static void SetNameScope(BindableObject bindable, INameScope value)
+ {
+ bindable.SetValue(NameScopeProperty, value);
+ }
+ }
+}
--- /dev/null
+using System;
+using System.ComponentModel;
+
+namespace Tizen.NUI.XamlBinding.Internals
+{
+ /// <summary>
+ /// The class PreserveAttribute.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [AttributeUsage(AttributeTargets.All)]
+ public class PreserveAttribute : Attribute
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool AllMembers;
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool Conditional;
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PreserveAttribute(bool allMembers, bool conditional)
+ {
+ AllMembers = allMembers;
+ Conditional = conditional;
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PreserveAttribute()
+ {
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.ComponentModel;
+using System.IO;
+using System.Reflection;
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI.XamlBinding.Internals
+{
+ /// <summary>
+ /// The class ResourceLoader.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static class ResourceLoader
+ {
+ static Func<AssemblyName, string, string> resourceProvider = (asmName, path) =>
+ {
+ return null;
+ //string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
+ //path = resource + path;
+
+ //string ret = File.ReadAllText(path);
+ //return ret;
+ };
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ //takes a resource path, returns string content
+ public static Func<AssemblyName, string, string> ResourceProvider123
+ {
+ get => resourceProvider;
+ internal set
+ {
+ DesignMode.IsDesignModeEnabled = true;
+ resourceProvider = value;
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ //takes a resource path, returns string content
+ public static Func<AssemblyName, string, string> ResourceProvider {
+ get => resourceProvider;
+ internal set {
+ DesignMode.IsDesignModeEnabled = true;
+ resourceProvider = value;
+ }
+ }
+
+ internal static Action<Exception> ExceptionHandler { get; set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+#define DO_NOT_CHECK_FOR_BINDING_REUSE
+
+using System;
+using System.ComponentModel;
+using System.Globalization;
+using System.Collections.Generic;
+using Tizen.NUI.XamlBinding;
+
+namespace Tizen.NUI.XamlBinding.Internals
+{
+ /// <summary>
+ /// The class TypedBindingBase.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ //FIXME: need a better name for this, and share with Binding, so we can share more unittests
+ public abstract class TypedBindingBase : BindingBase
+ {
+ IValueConverter _converter;
+ object _converterParameter;
+ object _source;
+ string _updateSourceEventName;
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public IValueConverter Converter {
+ get { return _converter; }
+ set {
+ ThrowIfApplied();
+ _converter = value;
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object ConverterParameter {
+ get { return _converterParameter; }
+ set {
+ ThrowIfApplied();
+ _converterParameter = value;
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object Source {
+ get { return _source; }
+ set {
+ ThrowIfApplied();
+ _source = value;
+ }
+ }
+
+ internal string UpdateSourceEventName {
+ get { return _updateSourceEventName; }
+ set {
+ ThrowIfApplied();
+ _updateSourceEventName = value;
+ }
+ }
+
+ internal TypedBindingBase()
+ {
+ }
+ }
+
+ internal sealed class TypedBinding<TSource, TProperty> : TypedBindingBase
+ {
+ readonly Func<TSource, TProperty> _getter;
+ readonly Action<TSource, TProperty> _setter;
+ readonly PropertyChangedProxy [] _handlers;
+
+ public TypedBinding(Func<TSource, TProperty> getter, Action<TSource, TProperty> setter, Tuple<Func<TSource, object>, string> [] handlers)
+ {
+ if (getter == null)
+ throw new ArgumentNullException(nameof(getter));
+
+ _getter = getter;
+ _setter = setter;
+
+ if (handlers == null)
+ return;
+
+ _handlers = new PropertyChangedProxy [handlers.Length];
+ for (var i = 0; i < handlers.Length; i++)
+ _handlers [i] = new PropertyChangedProxy(handlers [i].Item1, handlers [i].Item2, this);
+ }
+
+ readonly WeakReference<object> _weakSource = new WeakReference<object>(null);
+ readonly WeakReference<BindableObject> _weakTarget = new WeakReference<BindableObject>(null);
+ BindableProperty _targetProperty;
+
+ // Applies the binding to a previously set source and target.
+ internal override void Apply(bool fromTarget = false)
+ {
+ base.Apply(fromTarget);
+
+ BindableObject target;
+#if DO_NOT_CHECK_FOR_BINDING_REUSE
+ if (!_weakTarget.TryGetTarget(out target))
+ throw new InvalidOperationException();
+#else
+ if (!_weakTarget.TryGetTarget(out target) || target == null) {
+ Unapply();
+ return;
+ }
+#endif
+ object source;
+ if (_weakSource.TryGetTarget(out source) && source != null)
+ ApplyCore(source, target, _targetProperty, fromTarget);
+ }
+
+ // Applies the binding to a new source or target.
+ internal override void Apply(object context, BindableObject bindObj, BindableProperty targetProperty, bool fromBindingContextChanged = false)
+ {
+ _targetProperty = targetProperty;
+ var source = Source ?? Context ?? context;
+ var isApplied = IsApplied;
+
+ if (Source != null && isApplied && fromBindingContextChanged)
+ return;
+
+ base.Apply(source, bindObj, targetProperty, fromBindingContextChanged);
+
+#if (!DO_NOT_CHECK_FOR_BINDING_REUSE)
+ BindableObject prevTarget;
+ if (_weakTarget.TryGetTarget(out prevTarget) && !ReferenceEquals(prevTarget, bindObj))
+ throw new InvalidOperationException("Binding instances can not be reused");
+
+ object previousSource;
+ if (_weakSource.TryGetTarget(out previousSource) && !ReferenceEquals(previousSource, source))
+ throw new InvalidOperationException("Binding instances can not be reused");
+#endif
+ _weakSource.SetTarget(source);
+ _weakTarget.SetTarget(bindObj);
+
+ ApplyCore(source, bindObj, targetProperty);
+ }
+
+ internal override BindingBase Clone()
+ {
+ Tuple<Func<TSource, object>, string> [] handlers = _handlers == null ? null : new Tuple<Func<TSource, object>, string> [_handlers.Length];
+ if (handlers != null) {
+ for (var i = 0; i < _handlers.Length; i++)
+ handlers [i] = new Tuple<Func<TSource, object>, string>(_handlers [i].PartGetter, _handlers [i].PropertyName);
+ }
+ return new TypedBinding<TSource, TProperty>(_getter, _setter, handlers) {
+ Mode = Mode,
+ Converter = Converter,
+ ConverterParameter = ConverterParameter,
+ StringFormat = StringFormat,
+ Source = Source,
+ UpdateSourceEventName = UpdateSourceEventName,
+ };
+ }
+
+ internal override object GetSourceValue(object value, Type targetPropertyType)
+ {
+ if (Converter != null)
+ value = Converter.Convert(value, targetPropertyType, ConverterParameter, CultureInfo.CurrentUICulture);
+
+ //return base.GetSourceValue(value, targetPropertyType);
+ if (StringFormat != null)
+ return string.Format(StringFormat, value);
+
+ return value;
+ }
+
+ internal override object GetTargetValue(object value, Type sourcePropertyType)
+ {
+ if (Converter != null)
+ value = Converter.ConvertBack(value, sourcePropertyType, ConverterParameter, CultureInfo.CurrentUICulture);
+
+ //return base.GetTargetValue(value, sourcePropertyType);
+ return value;
+ }
+
+ internal override void Unapply(bool fromBindingContextChanged = false)
+ {
+ if (Source != null && fromBindingContextChanged && IsApplied)
+ return;
+
+#if (!DO_NOT_CHECK_FOR_BINDING_REUSE)
+ base.Unapply(fromBindingContextChanged:fromBindingContextChanged);
+#endif
+ if (_handlers != null)
+ Unsubscribe();
+
+#if (!DO_NOT_CHECK_FOR_BINDING_REUSE)
+ _weakSource.SetTarget(null);
+ _weakTarget.SetTarget(null);
+#endif
+ }
+
+ // ApplyCore is as slim as it should be:
+ // Setting 100000 values : 17ms.
+ // ApplyCore 100000 (w/o INPC, w/o unnapply) : 20ms.
+ internal void ApplyCore(object sourceObject, BindableObject target, BindableProperty property, bool fromTarget = false)
+ {
+ var isTSource = sourceObject != null && sourceObject is TSource;
+ var mode = this.GetRealizedMode(property);
+ if ((mode == BindingMode.OneWay || mode == BindingMode.OneTime) && fromTarget)
+ return;
+
+ var needsGetter = (mode == BindingMode.TwoWay && !fromTarget) || mode == BindingMode.OneWay || mode == BindingMode.OneTime;
+
+ if (isTSource && (mode == BindingMode.OneWay || mode == BindingMode.TwoWay) && _handlers != null)
+ Subscribe((TSource)sourceObject);
+
+ if (needsGetter) {
+ var value = property.DefaultValue;
+ if (isTSource) {
+ try {
+ value = GetSourceValue(_getter((TSource)sourceObject), property.ReturnType);
+ } catch (Exception ex) when (ex is NullReferenceException || ex is KeyNotFoundException) {
+ }
+ }
+ if (!TryConvert(ref value, property, property.ReturnType, true)) {
+ // Log.Warning("Binding", "{0} can not be converted to type '{1}'", value, property.ReturnType);
+ return;
+ }
+ target.SetValueCore(property, value, SetValueFlags.ClearDynamicResource, BindableObject.SetValuePrivateFlags.Default | BindableObject.SetValuePrivateFlags.Converted);
+ return;
+ }
+
+ var needsSetter = (mode == BindingMode.TwoWay && fromTarget) || mode == BindingMode.OneWayToSource;
+ if (needsSetter && _setter != null && isTSource) {
+ var value = GetTargetValue(target.GetValue(property), typeof(TProperty));
+ if (!TryConvert(ref value, property, typeof(TProperty), false)) {
+ // Log.Warning("Binding", "{0} can not be converted to type '{1}'", value, typeof(TProperty));
+ return;
+ }
+ _setter((TSource)sourceObject, (TProperty)value);
+ }
+ }
+
+ static bool TryConvert(ref object value, BindableProperty targetProperty, Type convertTo, bool toTarget)
+ {
+ if (value == null)
+ return true;
+ if ((toTarget && targetProperty.TryConvert(ref value)) || (!toTarget && convertTo.IsInstanceOfType(value)))
+ return true;
+
+ object original = value;
+ try {
+ value = Convert.ChangeType(value, convertTo, CultureInfo.InvariantCulture);
+ return true;
+ } catch (Exception ex ) when (ex is InvalidCastException || ex is FormatException||ex is OverflowException) {
+ value = original;
+ return false;
+ }
+ }
+
+ class PropertyChangedProxy
+ {
+ public Func<TSource, object> PartGetter { get; }
+ public string PropertyName { get; }
+ public BindingExpression.WeakPropertyChangedProxy Listener { get; }
+ WeakReference<INotifyPropertyChanged> _weakPart = new WeakReference<INotifyPropertyChanged>(null);
+ readonly BindingBase _binding;
+
+ public INotifyPropertyChanged Part {
+ get {
+ INotifyPropertyChanged target;
+ if (_weakPart.TryGetTarget(out target))
+ return target;
+ return null;
+ }
+ set {
+ _weakPart.SetTarget(value);
+ Listener.SubscribeTo(value, OnPropertyChanged);
+ }
+ }
+
+ public PropertyChangedProxy(Func<TSource, object> partGetter, string propertyName, BindingBase binding)
+ {
+ PartGetter = partGetter;
+ PropertyName = propertyName;
+ _binding = binding;
+ Listener = new BindingExpression.WeakPropertyChangedProxy();
+ }
+
+ void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
+ {
+ if (!string.IsNullOrEmpty(e.PropertyName) && string.CompareOrdinal(e.PropertyName, PropertyName) != 0)
+ return;
+ Device.BeginInvokeOnMainThread(() => _binding.Apply(false));
+ }
+ }
+
+ void Subscribe(TSource sourceObject)
+ {
+ for (var i = 0; i < _handlers.Length; i++) {
+ var part = _handlers [i].PartGetter(sourceObject);
+ if (part == null)
+ break;
+ var inpc = part as INotifyPropertyChanged;
+ if (inpc == null)
+ continue;
+ _handlers [i].Part = (inpc);
+ }
+ }
+
+ void Unsubscribe()
+ {
+ for (var i = 0; i < _handlers.Length; i++)
+ _handlers [i].Listener.Unsubscribe();
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.Collections.Generic;
+using System.ComponentModel;
+using Tizen.NUI.XamlBinding.Internals;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static class NameScopeExtensions
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static T FindByName<T>(this Element element, string name)
+ {
+ return ((INameScope)element).FindByName<T>(name);
+ }
+
+ internal static T FindByName<T>(this INameScope namescope, string name)
+ {
+ 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();
+ }
+
+ /// This will be public opened in tizen_5.5 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
--- /dev/null
+/*
+ * Copyright (c) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Linq;
+using System.Threading.Tasks;
+
+using Tizen.NUI.XamlBinding.Internals;
+using Tizen.NUI.XamlBinding;
+using Tizen.NUI;
+
+namespace Tizen.NUI.Xaml
+{
+ /// <summary>
+ /// A BaseHandle that occupies the entire screen.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class Page : Element, ILayout, IPageController, IElementConfiguration<Page>, IPaddingElement
+ {
+ /// <summary>
+ /// For internal use.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public const string BusySetSignalName = "NUI.BusySet";
+
+ /// <summary>
+ /// For internal use.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public const string AlertSignalName = "NUI.SendAlert";
+
+ /// <summary>
+ /// For internal use.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public const string ActionSheetSignalName = "NUI.ShowActionSheet";
+
+ internal static readonly BindableProperty IgnoresContainerAreaProperty = BindableProperty.Create("IgnoresContainerArea", typeof(bool), typeof(Page), false);
+
+ /// <summary>
+ /// Identifies the BackgroundImage property.
+ /// </summary>
+ internal static readonly BindableProperty BackgroundImageProperty = BindableProperty.Create("BackgroundImage", typeof(string), typeof(Page), default(string));
+
+ /// <summary>
+ /// Identifies the IsBusy property.
+ /// </summary>
+ internal static readonly BindableProperty IsBusyProperty = BindableProperty.Create("IsBusy", typeof(bool), typeof(Page), false, propertyChanged: (bo, o, n) => ((Page)bo).OnPageBusyChanged());
+
+ /// <summary>
+ /// Identifies the Padding property.
+ /// </summary>
+ internal static readonly BindableProperty PaddingProperty = PaddingElement.PaddingProperty;
+
+ /// <summary>
+ /// Identifies the Title property.
+ /// </summary>
+ internal static readonly BindableProperty TitleProperty = BindableProperty.Create("Title", typeof(string), typeof(Page), null);
+
+ /// <summary>
+ /// Identifies the Icon property.
+ /// </summary>
+ internal static readonly BindableProperty IconProperty = BindableProperty.Create("Icon", typeof(FileImageSource), typeof(Page), default(FileImageSource));
+
+ readonly Lazy<PlatformConfigurationRegistry<Page>> _platformConfigurationRegistry;
+
+ bool _allocatedFlag;
+ Rectangle _containerArea;
+
+ bool _containerAreaSet;
+
+ bool _hasAppeared;
+
+ ReadOnlyCollection<Element> _logicalChildren;
+
+ /// <summary>
+ /// Creates a new Page element with default values.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Page()
+ {
+ var toolbarItems = new ObservableCollection<ToolbarItem>();
+ toolbarItems.CollectionChanged += OnToolbarItemsCollectionChanged;
+ // ToolbarItems = toolbarItems;
+ InternalChildren.CollectionChanged += InternalChildrenOnCollectionChanged;
+ _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<Page>>(() => new PlatformConfigurationRegistry<Page>(this));
+ }
+
+ /// <summary>
+ /// Identifies the image used as a background for the Page.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string BackgroundImage
+ {
+ get { return (string)GetValue(BackgroundImageProperty); }
+ set { SetValue(BackgroundImageProperty, value); }
+ }
+
+ internal FileImageSource Icon
+ {
+ get { return (FileImageSource)GetValue(IconProperty); }
+ set { SetValue(IconProperty, value); }
+ }
+
+ /// <summary>
+ /// Marks the Page as busy. This will cause the platform specific global activity indicator to show a busy state.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool IsBusy
+ {
+ get { return (bool)GetValue(IsBusyProperty); }
+ set { SetValue(IsBusyProperty, value); }
+ }
+
+ /// <summary>
+ /// The space between the content of the Page and it's border.
+ /// </summary>
+ internal Thickness Padding
+ {
+ get { return (Thickness)GetValue(PaddingElement.PaddingProperty); }
+ set { SetValue(PaddingElement.PaddingProperty, value); }
+ }
+
+ Thickness IPaddingElement.PaddingDefaultValueCreator()
+ {
+ return default(Thickness);
+ }
+
+ void IPaddingElement.OnPaddingPropertyChanged(Thickness oldValue, Thickness newValue)
+ {
+ UpdateChildrenLayout();
+ }
+
+ /// <summary>
+ /// The Page's title.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string Title
+ {
+ get { return (string)GetValue(TitleProperty); }
+ set { SetValue(TitleProperty, value); }
+ }
+
+ internal IList<ToolbarItem> ToolbarItems { get;/* internal set;*/ }
+
+ /// <summary>
+ /// For internal use.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Rectangle ContainerArea
+ {
+ get { return _containerArea; }
+ set
+ {
+ if (_containerArea == value)
+ return;
+ _containerAreaSet = true;
+ _containerArea = value;
+ ForceLayout();
+ }
+ }
+
+ /// <summary>
+ /// For internal use.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool IgnoresContainerArea
+ {
+ get { return (bool)GetValue(IgnoresContainerAreaProperty); }
+ set { SetValue(IgnoresContainerAreaProperty, value); }
+ }
+
+ /// <summary>
+ /// For internal use.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ObservableCollection<Element> InternalChildren { get; } = new ObservableCollection<Element>();
+
+ internal override ReadOnlyCollection<Element> LogicalChildrenInternal =>
+ _logicalChildren ?? (_logicalChildren = new ReadOnlyCollection<Element>(InternalChildren));
+
+ /// <summary>
+ /// Raised when the layout of the Page has changed.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler LayoutChanged;
+
+ /// <summary>
+ /// ndicates that the Page is about to appear.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler Appearing;
+
+ /// <summary>
+ /// Indicates that the Page is about to cease displaying.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler Disappearing;
+
+ /// <summary>
+ /// Displays a native platform action sheet, allowing the application user to choose from several buttons.
+ /// </summary>
+ /// <param name="title">Title of the displayed action sheet. Must not be null.</param>
+ /// <param name="cancel">Text to be displayed in the 'Cancel' button. Can be null to hide the cancel action.</param>
+ /// <param name="destruction">Text to be displayed in the 'Destruct' button. Can be null to hide the destructive option.</param>
+ /// <param name="buttons">Text labels for additional buttons. Must not be null.</param>
+ /// <returns>An awaitable Task that displays an action sheet and returns the Text of the button pressed by the user.</returns>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Task<string> DisplayActionSheet(string title, string cancel, string destruction, params string[] buttons)
+ {
+ var args = new ActionSheetArguments(title, cancel, destruction, buttons);
+ MessagingCenter.Send(this, ActionSheetSignalName, args);
+ return args.Result.Task;
+ }
+
+ /// <summary>
+ /// Presents an alert dialog to the application user with a single cancel button.
+ /// </summary>
+ /// <param name="title">The title of the alert dialog.</param>
+ /// <param name="message">The body text of the alert dialog.</param>
+ /// <param name="cancel">Text to be displayed on the 'Cancel' button.</param>
+ /// <returns></returns>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Task DisplayAlert(string title, string message, string cancel)
+ {
+ return DisplayAlert(title, message, null, cancel);
+ }
+
+ /// <summary>
+ /// resents an alert dialog to the application user with an accept and a cancel button.
+ /// </summary>
+ /// <param name="title">The title of the alert dialog.</param>
+ /// <param name="message">The body text of the alert dialog.</param>
+ /// <param name="accept">Text to be displayed on the 'Accept' button.</param>
+ /// <param name="cancel">Text to be displayed on the 'Cancel' button.</param>
+ /// <returns></returns>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Task<bool> DisplayAlert(string title, string message, string accept, string cancel)
+ {
+ if (string.IsNullOrEmpty(cancel))
+ throw new ArgumentNullException("cancel");
+
+ var args = new AlertArguments(title, message, accept, cancel);
+ MessagingCenter.Send(this, AlertSignalName, args);
+ return args.Result.Task;
+ }
+
+ /// <summary>
+ /// Forces the Page to perform a layout pass.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void ForceLayout()
+ {
+ // SizeAllocated(Width, Height);
+ }
+
+ /// <summary>
+ /// Calls OnBackButtonPressed().
+ /// </summary>
+ /// <returns></returns>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool SendBackButtonPressed()
+ {
+ return OnBackButtonPressed();
+ }
+
+ /// <summary>
+ /// Lays out children Elements into the specified area.
+ /// </summary>
+ /// <param name="x">Left-hand side of layout area.</param>
+ /// <param name="y">Top of layout area.</param>
+ /// <param name="width">Width of layout area.</param>
+ /// <param name="height">Height of layout area.</param>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected virtual void LayoutChildren(double x, double y, double width, double height)
+ {
+ var area = new Rectangle((int)x, (int)y, (int)width, (int)height);
+ Rectangle originalArea = area;
+ if (_containerAreaSet)
+ {
+ area = ContainerArea;
+ area.X += (int)Padding.Left;
+ area.Y += (int)Padding.Right;
+ area.Width -= (int)Padding.HorizontalThickness;
+ area.Height -= (int)Padding.VerticalThickness;
+ area.Width = Math.Max(0, area.Width);
+ area.Height = Math.Max(0, area.Height);
+ }
+
+ List<Element> elements = LogicalChildren.ToList();
+ foreach (Element element in elements)
+ {
+ var page = element as Page;
+ // if (page != null && page.IgnoresContainerArea)
+ // Forms.Layout.LayoutChildIntoBoundingRegion(child, originalArea);
+ // else
+ // Forms.Layout.LayoutChildIntoBoundingRegion(child, area);
+ }
+ }
+
+ /// <summary>
+ /// When overridden, allows application developers to customize behavior immediately prior to the Page becoming visible.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected virtual void OnAppearing()
+ {
+ }
+
+ /// <summary>
+ /// Application developers can override this method to provide behavior when the back button is pressed.
+ /// </summary>
+ /// <returns>true if consumed</returns>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected virtual bool OnBackButtonPressed()
+ {
+ var application = RealParent as Application;
+ // if (application == null || this == application.MainPage)
+ // return false;
+
+ var canceled = false;
+ EventHandler handler = (sender, args) => { canceled = true; };
+ // application.PopCanceled += handler;
+ //Navigation.PopModalAsync().ContinueWith(t => { throw t.Exception; }, CancellationToken.None, TaskContinuationOptions.OnlyOnFaulted, TaskScheduler.FromCurrentSynchronizationContext());
+
+ // application.PopCanceled -= handler;
+ return !canceled;
+ }
+
+ /// <summary>
+ /// Invoked whenever the binding context of the Page changes. Override this method to add class handling for this event.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void OnBindingContextChanged()
+ {
+ base.OnBindingContextChanged();
+ // foreach (ToolbarItem toolbarItem in ToolbarItems)
+ // {
+ // SetInheritedBindingContext(toolbarItem, BindingContext);
+ // }
+ }
+
+ /// <summary>
+ /// Indicates that the preferred size of a child Element has changed.
+ /// </summary>
+ /// <param name="sender">The object that raised the event.</param>
+ /// <param name="e">The event arguments.</param>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected virtual void OnChildMeasureInvalidated(object sender, EventArgs e)
+ {
+ InvalidationTrigger trigger = (e as InvalidationEventArgs)?.Trigger ?? InvalidationTrigger.Undefined;
+ OnChildMeasureInvalidated((Element)sender, trigger);
+ }
+
+ /// <summary>
+ /// When overridden, allows the application developer to customize behavior as the Page disappears.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected virtual void OnDisappearing()
+ {
+ }
+
+ /// <summary>
+ /// Called when the Page's Parent property has changed.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void OnParentSet()
+ {
+ //if (!Application.IsApplicationOrNull(RealParent) && !(RealParent is Page))
+ // throw new InvalidOperationException("Parent of a Page must also be a Page");
+ base.OnParentSet();
+ }
+
+ /// <summary>
+ /// Requests that the children Elements of the Page update their layouts.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected void UpdateChildrenLayout()
+ {
+ if (!ShouldLayoutChildren())
+ return;
+
+ double x = Padding.Left;
+ double y = Padding.Top;
+
+ for (var i = 0; i < LogicalChildren.Count; i++)
+ {
+ LayoutChanged?.Invoke(this, EventArgs.Empty);
+ }
+ }
+
+ internal virtual void OnChildMeasureInvalidated(Element child, InvalidationTrigger trigger)
+ {
+ var container = this as IPageContainer<Page>;
+ if (container != null)
+ {
+ Page page = container.CurrentPage;
+ if (page != null /*&& page.IsVisible && (!page.IsPlatformEnabled || !page.IsNativeStateConsistent)*/)
+ return;
+ }
+ else
+ {
+ }
+
+ _allocatedFlag = false;
+ // InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged);
+ if (!_allocatedFlag /*&& Width >= 0 && Height >= 0*/)
+ {
+ // SizeAllocated(Width, Height);
+ }
+ }
+
+ /// <summary>
+ /// For intarnal use.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SendAppearing()
+ {
+ if (_hasAppeared)
+ return;
+
+ _hasAppeared = true;
+
+ if (IsBusy)
+ MessagingCenter.Send(this, BusySetSignalName, true);
+
+ OnAppearing();
+ Appearing?.Invoke(this, EventArgs.Empty);
+
+ var pageContainer = this as IPageContainer<Page>;
+ pageContainer?.CurrentPage?.SendAppearing();
+
+ //FindApplication(this)?.OnPageAppearing(this);
+ }
+
+ /// <summary>
+ /// For intarnal use.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SendDisappearing()
+ {
+ if (!_hasAppeared)
+ return;
+
+ _hasAppeared = false;
+
+ if (IsBusy)
+ MessagingCenter.Send(this, BusySetSignalName, false);
+
+ var pageContainer = this as IPageContainer<Page>;
+ pageContainer?.CurrentPage?.SendDisappearing();
+
+ OnDisappearing();
+ Disappearing?.Invoke(this, EventArgs.Empty);
+
+ //FindApplication(this)?.OnPageDisappearing(this);
+ }
+
+ Application FindApplication(Element element)
+ {
+ if (element == null)
+ return null;
+
+ return (element.Parent is Application app) ? app : FindApplication(element.Parent);
+ }
+
+ void InternalChildrenOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
+ {
+ if (e.OldItems != null)
+ {
+ foreach (Element item in e.OldItems.OfType<Element>())
+ OnInternalRemoved(item);
+ }
+
+ if (e.NewItems != null)
+ {
+ foreach (Element item in e.NewItems.OfType<Element>())
+ OnInternalAdded(item);
+ }
+ }
+
+ void OnInternalAdded(Element view)
+ {
+ // view.MeasureInvalidated += OnChildMeasureInvalidated;
+
+ OnChildAdded(view);
+ // InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged);
+ }
+
+ void OnInternalRemoved(Element view)
+ {
+ // view.MeasureInvalidated -= OnChildMeasureInvalidated;
+
+ OnChildRemoved(view);
+ }
+
+ void OnPageBusyChanged()
+ {
+ if (!_hasAppeared)
+ return;
+
+ MessagingCenter.Send(this, BusySetSignalName, IsBusy);
+ }
+
+ void OnToolbarItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs args)
+ {
+ if (args.Action != NotifyCollectionChangedAction.Add)
+ return;
+ foreach (IElement item in args.NewItems)
+ item.Parent = this;
+ }
+
+ bool ShouldLayoutChildren()
+ {
+ if (!LogicalChildren.Any()/* || Width <= 0 || Height <= 0 || !IsNativeStateConsistent*/)
+ return false;
+
+ var container = this as IPageContainer<Page>;
+ if (container?.CurrentPage != null)
+ {
+ // if (InternalChildren.Contains(container.CurrentPage))
+ // return container.CurrentPage.IsPlatformEnabled && container.CurrentPage.IsNativeStateConsistent;
+ return true;
+ }
+
+ var any = false;
+ for (var i = 0; i < LogicalChildren.Count; i++)
+ {
+ var v = LogicalChildren[i] as Element;
+ if (v != null /*&& (!v.IsPlatformEnabled || !v.IsNativeStateConsistent)*/)
+ {
+ any = true;
+ break;
+ }
+ }
+ return !any;
+ }
+
+ /// <summary>
+ /// Returns the platform-specific instance of this Page, on which a platform-specific method may be called.
+ /// </summary>
+ /// <typeparam name="T">The platform for which to return an instance.</typeparam>
+ /// <returns>The platform-specific instance of this Page</returns>
+ internal IPlatformElementConfiguration<T, Page> On<T>() where T : IConfigPlatform
+ {
+ return _platformConfigurationRegistry.Value.On<T>();
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+using System;
+using System.Threading;
+
+namespace Tizen.NUI
+{
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public interface IPerformanceProvider
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ void Stop(string reference, string tag, string path, string member);
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ void Start(string reference, string tag, string path, string member);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class Performance
+ {
+ static long Reference;
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static IPerformanceProvider Provider { get; private set; }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static void SetProvider(IPerformanceProvider instance)
+ {
+ Provider = instance;
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static void Start(out string reference, string tag = null, [CallerFilePath] string path = null, [CallerMemberName] string member = null)
+ {
+ if (Provider == null)
+ {
+ reference = String.Empty;
+ return;
+ }
+
+ reference = Interlocked.Increment(ref Reference).ToString();
+ Provider.Start(reference, tag, path, member);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static void Start(string reference, string tag = null, [CallerFilePath] string path = null,
+ [CallerMemberName] string member = null)
+ {
+ Provider?.Start(reference, tag, path, member);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static void Stop(string reference, string tag = null, [CallerFilePath] string path = null, [CallerMemberName] string member = null)
+ {
+ Provider?.Stop(reference, tag, path, member);
+ }
+
+ internal static IDisposable StartNew(string tag = null, [CallerFilePath] string path = null, [CallerMemberName] string member = null)
+ {
+ return new DisposablePerformanceReference(tag, path, member);
+ }
+
+ class DisposablePerformanceReference : IDisposable
+ {
+ string _reference;
+ string _tag;
+ string _path;
+ string _member;
+
+ public DisposablePerformanceReference(string tag, string path, string member)
+ {
+ _tag = tag;
+ _path = path;
+ _member = member;
+ Start(out string reference, _tag, _path, _member);
+ _reference = reference;
+ }
+
+ public void Dispose()
+ {
+ Stop(_reference, _tag, _path, _member);
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Linq;
+using System.Reflection;
+using System.Globalization;
+
+using Tizen.NUI;
+using System.ComponentModel;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class PositionTypeConverter : TypeConverter
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override object ConvertFromInvariantString(string value)
+ {
+ if (value != null)
+ {
+ string[] parts = value.Split('.');
+ if (parts.Length == 1 || ( parts.Length == 2 && (parts[0].Trim() == "ParentOrigin" || parts[0].Trim() == "PivotPoint") ))
+ {
+ string position = parts[parts.Length - 1].Trim();
+
+ switch(position)
+ {
+ case "Top":
+ return ParentOrigin.Top;
+ case "Bottom":
+ return ParentOrigin.Bottom;
+ case "Left":
+ return ParentOrigin.Left;
+ case "Right":
+ return ParentOrigin.Right;
+ case "Middle":
+ return ParentOrigin.Middle;
+ case "TopLeft":
+ return ParentOrigin.TopLeft;
+ case "TopCenter":
+ return ParentOrigin.TopCenter;
+ case "TopRight":
+ return ParentOrigin.TopRight;
+ case "CenterLeft":
+ return ParentOrigin.CenterLeft;
+ case "Center":
+ return ParentOrigin.Center;
+ case "CenterRight":
+ return ParentOrigin.CenterRight;
+ case "BottomLeft":
+ return ParentOrigin.BottomLeft;
+ case "BottomCenter":
+ return ParentOrigin.BottomCenter;
+ case "BottomRight":
+ return ParentOrigin.BottomRight;
+ }
+ }
+
+ parts = value.Split(',');
+ if (parts.Length == 3)
+ {
+ int x = (int)Tizen.NUI.GraphicsTypeManager.Instance.ConvertScriptToPixel(parts[0].Trim());
+ int y = (int)Tizen.NUI.GraphicsTypeManager.Instance.ConvertScriptToPixel(parts[1].Trim());
+ int z = (int)Tizen.NUI.GraphicsTypeManager.Instance.ConvertScriptToPixel(parts[2].Trim());
+ return new Position(x, y, z);
+ }
+ }
+
+ throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(Position)}");
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class Position2DTypeConverter : TypeConverter
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override object ConvertFromInvariantString(string value)
+ {
+ return Position2D.ConvertFromString(value);
+ }
+ }
+}
--- /dev/null
+using System;
+using System.ComponentModel;
+using System.Globalization;
+
+using Tizen.NUI;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [Xaml.ProvideCompiled("Tizen.NUI.Xaml.Forms.XamlC.RectangleTypeConverter")]
+ [Xaml.TypeConversion(typeof(Rectangle))]
+ public class RectangleTypeConverter : TypeConverter
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override object ConvertFromInvariantString(string value)
+ {
+ if (value != null)
+ {
+ double x, y, w, h;
+ string[] xywh = value.Split(',');
+ if (xywh.Length == 4 && double.TryParse(xywh[0], NumberStyles.Number, CultureInfo.InvariantCulture, out x) && double.TryParse(xywh[1], NumberStyles.Number, CultureInfo.InvariantCulture, out y) &&
+ double.TryParse(xywh[2], NumberStyles.Number, CultureInfo.InvariantCulture, out w) && double.TryParse(xywh[3], NumberStyles.Number, CultureInfo.InvariantCulture, out h))
+ return new Rectangle((int)x, (int)y, (int)w, (int)h);
+ }
+
+ throw new InvalidOperationException(string.Format("Cannot convert \"{0}\" into {1}", value, typeof(Rectangle)));
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Globalization;
+using System.Linq;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+using Tizen.NUI.XamlBinding.Internals;
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class ResourceDictionary : IResourceDictionary, IDictionary<string, object>
+ {
+ static ConditionalWeakTable<Type, ResourceDictionary> s_instances = new ConditionalWeakTable<Type, ResourceDictionary>();
+ readonly Dictionary<string, object> _innerDictionary = new Dictionary<string, object>();
+ ResourceDictionary _mergedInstance;
+ Type _mergedWith;
+ Uri _source;
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ResourceDictionary()
+ {
+ DependencyService.Register<IResourcesLoader, ResourcesLoader>();
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [TypeConverter(typeof(TypeTypeConverter))]
+ [Obsolete("Use Source")]
+ public Type MergedWith {
+ get { return _mergedWith; }
+ set {
+ if (_mergedWith == value)
+ return;
+
+ if (_source != null)
+ throw new ArgumentException("MergedWith can not be used with Source");
+
+ if (!typeof(ResourceDictionary).GetTypeInfo().IsAssignableFrom(value.GetTypeInfo()))
+ throw new ArgumentException("MergedWith should inherit from ResourceDictionary");
+
+ _mergedWith = value;
+ if (_mergedWith == null)
+ return;
+
+ _mergedInstance = s_instances.GetValue(_mergedWith, (key) => (ResourceDictionary)Activator.CreateInstance(key));
+ OnValuesChanged(_mergedInstance.ToArray());
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [TypeConverter(typeof(RDSourceTypeConverter))]
+ public Uri Source {
+ get { return _source; }
+ set {
+ if (_source == value)
+ return;
+ throw new InvalidOperationException("Source can only be set from XAML."); //through the RDSourceTypeConverter
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetAndLoadSource(Uri value, string resourcePath, Assembly assembly, System.Xml.IXmlLineInfo lineInfo)
+ {
+ _source = value;
+ if (_mergedWith != null)
+ throw new ArgumentException("Source can not be used with MergedWith");
+
+ //this will return a type if the RD as an x:Class element, and codebehind
+ var type = XamlResourceIdAttribute.GetTypeForPath(assembly, resourcePath);
+ if (type != null)
+ _mergedInstance = s_instances.GetValue(type, (key) => (ResourceDictionary)Activator.CreateInstance(key));
+ else
+ _mergedInstance = DependencyService.Get<IResourcesLoader>().CreateFromResource<ResourceDictionary>(resourcePath, assembly, lineInfo);
+ OnValuesChanged(_mergedInstance.ToArray());
+ }
+
+ ICollection<ResourceDictionary> _mergedDictionaries;
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ICollection<ResourceDictionary> MergedDictionaries {
+ get {
+ if (_mergedDictionaries == null) {
+ var col = new ObservableCollection<ResourceDictionary>();
+ col.CollectionChanged += MergedDictionaries_CollectionChanged;
+ _mergedDictionaries = col;
+ }
+ return _mergedDictionaries;
+ }
+ }
+
+ internal IList<StyleSheets.StyleSheet> StyleSheets { get; set; }
+
+ void StyleSheetsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
+ {
+ switch (e.Action) {
+ case NotifyCollectionChangedAction.Add:
+ ValuesChanged?.Invoke(this, ResourcesChangedEventArgs.StyleSheets);
+ break;
+ }
+ }
+ IList<ResourceDictionary> _collectionTrack;
+
+ void MergedDictionaries_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
+ {
+ // Move() isn't exposed by ICollection
+ if (e.Action == NotifyCollectionChangedAction.Move)
+ return;
+
+ _collectionTrack = _collectionTrack ?? new List<ResourceDictionary>();
+ // Collection has been cleared
+ if (e.Action == NotifyCollectionChangedAction.Reset) {
+ foreach (var dictionary in _collectionTrack)
+ dictionary.ValuesChanged -= Item_ValuesChanged;
+
+ _collectionTrack.Clear();
+ return;
+ }
+
+ // New Items
+ if (e.NewItems != null)
+ {
+ foreach (var item in e.NewItems)
+ {
+ var rd = (ResourceDictionary)item;
+ _collectionTrack.Add(rd);
+ rd.ValuesChanged += Item_ValuesChanged;
+ OnValuesChanged(rd.ToArray());
+ }
+ }
+
+ // Old Items
+ if (e.OldItems != null)
+ {
+ foreach (var item in e.OldItems)
+ {
+ var rd = (ResourceDictionary)item;
+ rd.ValuesChanged -= Item_ValuesChanged;
+ _collectionTrack.Remove(rd);
+ }
+ }
+ }
+
+ void Item_ValuesChanged(object sender, ResourcesChangedEventArgs e)
+ {
+ OnValuesChanged(e.Values.ToArray());
+ }
+
+ void ICollection<KeyValuePair<string, object>>.Add(KeyValuePair<string, object> item)
+ {
+ ((ICollection<KeyValuePair<string, object>>)_innerDictionary).Add(item);
+ OnValuesChanged(item);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Clear()
+ {
+ _innerDictionary.Clear();
+ }
+
+ bool ICollection<KeyValuePair<string, object>>.Contains(KeyValuePair<string, object> item)
+ {
+ return ((ICollection<KeyValuePair<string, object>>)_innerDictionary).Contains(item)
+ || (_mergedInstance != null && _mergedInstance.Contains(item));
+ }
+
+ void ICollection<KeyValuePair<string, object>>.CopyTo(KeyValuePair<string, object>[] array, int arrayIndex)
+ {
+ ((ICollection<KeyValuePair<string, object>>)_innerDictionary).CopyTo(array, arrayIndex);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int Count
+ {
+ get { return _innerDictionary.Count; }
+ }
+
+ bool ICollection<KeyValuePair<string, object>>.IsReadOnly
+ {
+ get { return ((ICollection<KeyValuePair<string, object>>)_innerDictionary).IsReadOnly; }
+ }
+
+ bool ICollection<KeyValuePair<string, object>>.Remove(KeyValuePair<string, object> item)
+ {
+ return ((ICollection<KeyValuePair<string, object>>)_innerDictionary).Remove(item);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Add(string key, object value)
+ {
+ if (ContainsKey(key))
+ throw new ArgumentException($"A resource with the key '{key}' is already present in the ResourceDictionary.");
+ _innerDictionary.Add(key, value);
+ OnValueChanged(key, value);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool ContainsKey(string key)
+ {
+ return _innerDictionary.ContainsKey(key);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [IndexerName("Item")]
+ public object this[string index]
+ {
+ get
+ {
+ if (_innerDictionary.ContainsKey(index))
+ return _innerDictionary[index];
+ if (_mergedInstance != null && _mergedInstance.ContainsKey(index))
+ return _mergedInstance[index];
+ if (MergedDictionaries != null)
+ foreach (var dict in MergedDictionaries.Reverse())
+ if (dict.ContainsKey(index))
+ return dict[index];
+ throw new KeyNotFoundException($"The resource '{index}' is not present in the dictionary.");
+ }
+ set
+ {
+ _innerDictionary[index] = value;
+ OnValueChanged(index, value);
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ICollection<string> Keys
+ {
+ get { return _innerDictionary.Keys; }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool Remove(string key)
+ {
+ return _innerDictionary.Remove(key);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ICollection<object> Values
+ {
+ get { return _innerDictionary.Values; }
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
+ {
+ return _innerDictionary.GetEnumerator();
+ }
+
+ internal IEnumerable<KeyValuePair<string, object>> MergedResources {
+ get {
+ if (MergedDictionaries != null)
+ foreach (var r in MergedDictionaries.Reverse().SelectMany(x => x.MergedResources))
+ yield return r;
+ if (_mergedInstance != null)
+ foreach (var r in _mergedInstance.MergedResources)
+ yield return r;
+ foreach (var r in _innerDictionary)
+ yield return r;
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool TryGetValue(string key, out object value)
+ {
+ return _innerDictionary.TryGetValue(key, out value)
+ || (_mergedInstance != null && _mergedInstance.TryGetValue(key, out value))
+ || (MergedDictionaries != null && TryGetMergedDictionaryValue(key, out value));
+ }
+
+ bool TryGetMergedDictionaryValue(string key, out object value)
+ {
+ foreach (var dictionary in MergedDictionaries.Reverse())
+ if (dictionary.TryGetValue(key, out value))
+ return true;
+
+ value = null;
+ return false;
+ }
+
+ event EventHandler<ResourcesChangedEventArgs> IResourceDictionary.ValuesChanged
+ {
+ add { ValuesChanged += value; }
+ remove { ValuesChanged -= value; }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Add(Style style)
+ {
+ if (string.IsNullOrEmpty(style.Class))
+ Add(style.TargetType.FullName, style);
+ else
+ {
+ IList<Style> classes;
+ object outclasses;
+ if (!TryGetValue(Style.StyleClassPrefix + style.Class, out outclasses) || (classes = outclasses as IList<Style>) == null)
+ classes = new List<Style>();
+ classes.Add(style);
+ this[Style.StyleClassPrefix + style.Class] = classes;
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Add(ResourceDictionary mergedResourceDictionary)
+ {
+ MergedDictionaries.Add(mergedResourceDictionary);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Add(StyleSheets.StyleSheet styleSheet)
+ {
+ StyleSheets = StyleSheets ?? new List<StyleSheets.StyleSheet>(2);
+ StyleSheets.Add(styleSheet);
+ ValuesChanged?.Invoke(this, ResourcesChangedEventArgs.StyleSheets);
+ }
+
+ void OnValueChanged(string key, object value)
+ {
+ OnValuesChanged(new KeyValuePair<string, object>(key, value));
+ }
+
+ void OnValuesChanged(params KeyValuePair<string, object>[] values)
+ {
+ if (values == null || values.Length == 0)
+ return;
+ ValuesChanged?.Invoke(this, new ResourcesChangedEventArgs(values));
+ }
+
+ event EventHandler<ResourcesChangedEventArgs> ValuesChanged;
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [Xaml.ProvideCompiled("Tizen.NUI.Xaml.Forms.XamlC.RDSourceTypeConverter")]
+ public class RDSourceTypeConverter : TypeConverter, IExtendedTypeConverter
+ {
+ object IExtendedTypeConverter.ConvertFromInvariantString(string value, IServiceProvider serviceProvider)
+ {
+ if (serviceProvider == null)
+ throw new ArgumentNullException(nameof(serviceProvider));
+
+ var targetRD = (serviceProvider.GetService(typeof(Xaml.IProvideValueTarget)) as Xaml.IProvideValueTarget)?.TargetObject as ResourceDictionary;
+ if (targetRD == null)
+ return null;
+
+ var rootObjectType = (serviceProvider.GetService(typeof(Xaml.IRootObjectProvider)) as Xaml.IRootObjectProvider)?.RootObject.GetType();
+ if (rootObjectType == null)
+ return null;
+
+ var lineInfo = (serviceProvider.GetService(typeof(Xaml.IXmlLineInfoProvider)) as Xaml.IXmlLineInfoProvider)?.XmlLineInfo;
+ var rootTargetPath = XamlResourceIdAttribute.GetPathForType(rootObjectType);
+ var uri = new Uri(value, UriKind.Relative); //we don't want file:// uris, even if they start with '/'
+ var resourcePath = GetResourcePath(uri, rootTargetPath);
+
+ targetRD.SetAndLoadSource(uri, resourcePath, rootObjectType.GetTypeInfo().Assembly, lineInfo);
+ return uri;
+ }
+
+ internal static string GetResourcePath(Uri uri, string rootTargetPath)
+ {
+ //need a fake scheme so it's not seen as file:// uri, and the forward slashes are valid on all plats
+ var resourceUri = uri.OriginalString.StartsWith("/", StringComparison.Ordinal)
+ ? new Uri($"pack://{uri.OriginalString}", UriKind.Absolute)
+ : new Uri($"pack:///{rootTargetPath}/../{uri.OriginalString}", UriKind.Absolute);
+
+ //drop the leading '/'
+ return resourceUri.AbsolutePath.Substring(1);
+ }
+
+ object IExtendedTypeConverter.ConvertFrom(CultureInfo culture, object value, IServiceProvider serviceProvider)
+ {
+ throw new NotImplementedException();
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override object ConvertFromInvariantString(string value)
+ {
+ throw new NotImplementedException();
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Xml;
+using Tizen.NUI.XamlBinding.Internals;
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [ContentProperty("Value")]
+ [ProvideCompiled("Tizen.NUI.XamlC.SetterValueProvider")]
+ public sealed class Setter : IValueProvider
+ {
+ readonly ConditionalWeakTable<BindableObject, object> _originalValues = new ConditionalWeakTable<BindableObject, object>();
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public BindableProperty Property { get; set; }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object Value { get; set; }
+
+ object IValueProvider.ProvideValue(IServiceProvider serviceProvider)
+ {
+ if (Property == null)
+ {
+ var lineInfoProvider = serviceProvider.GetService(typeof(IXmlLineInfoProvider)) as IXmlLineInfoProvider;
+ IXmlLineInfo lineInfo = lineInfoProvider != null ? lineInfoProvider.XmlLineInfo : new XmlLineInfo();
+ throw new XamlParseException("Property not set", lineInfo);
+ }
+ var valueconverter = serviceProvider.GetService(typeof(IValueConverterProvider)) as IValueConverterProvider;
+
+ Func<MemberInfo> minforetriever =
+ () =>
+ (MemberInfo)Property.DeclaringType.GetRuntimeProperty(Property.PropertyName) ?? (MemberInfo)Property.DeclaringType.GetRuntimeMethod("Get" + Property.PropertyName, new[] { typeof(BindableObject) });
+
+ object value = valueconverter.Convert(Value, Property.ReturnType, minforetriever, serviceProvider);
+ Value = value;
+ return this;
+ }
+
+ internal void Apply(BindableObject target, bool fromStyle = false)
+ {
+ if (target == null)
+ throw new ArgumentNullException("target");
+ if (Property == null)
+ return;
+
+ object originalValue = target.GetValue(Property);
+ if (!Equals(originalValue, Property.DefaultValue))
+ {
+ _originalValues.Remove(target);
+ _originalValues.Add(target, originalValue);
+ }
+
+ var dynamicResource = Value as DynamicResource;
+ var binding = Value as BindingBase;
+ if (binding != null)
+ target.SetBinding(Property, binding.Clone(), fromStyle);
+ else if (dynamicResource != null)
+ target.SetDynamicResource(Property, dynamicResource.Key, fromStyle);
+ else
+ {
+ if (Value is IList<VisualStateGroup> visualStateGroupCollection)
+ target.SetValue(Property, visualStateGroupCollection.Clone(), fromStyle);
+ else
+ target.SetValue(Property, Value, fromStyle);
+ }
+ }
+
+ internal void UnApply(BindableObject target, bool fromStyle = false)
+ {
+ if (target == null)
+ throw new ArgumentNullException(nameof(target));
+ if (Property == null)
+ return;
+
+ object actual = target.GetValue(Property);
+ if (!Equals(actual, Value) && !(Value is Tizen.NUI.XamlBinding.Binding) && !(Value is DynamicResource))
+ {
+ //Do not reset default value if the value has been changed
+ _originalValues.Remove(target);
+ return;
+ }
+
+ object defaultValue;
+ if (_originalValues.TryGetValue(target, out defaultValue))
+ {
+ //reset default value, unapply bindings and dynamicResource
+ target.SetValue(Property, defaultValue, fromStyle);
+ _originalValues.Remove(target);
+ }
+ else
+ target.ClearValue(Property);
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Linq;
+using System.Reflection;
+using System.Globalization;
+
+using Tizen.NUI.Xaml;
+using Tizen.NUI;
+using System.ComponentModel;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [ProvideCompiledAttribute("Tizen.NUI.Xaml.Forms.XamlC.Size2DTypeConverter")]
+ public class SizeTypeConverter : TypeConverter
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override object ConvertFromInvariantString(string value)
+ {
+ if (value != null)
+ {
+ string[] parts = value.Split(',');
+ if (parts.Length == 3)
+ {
+ int x = (int)Tizen.NUI.GraphicsTypeManager.Instance.ConvertScriptToPixel(parts[0].Trim());
+ int y = (int)Tizen.NUI.GraphicsTypeManager.Instance.ConvertScriptToPixel(parts[1].Trim());
+ int z = (int)Tizen.NUI.GraphicsTypeManager.Instance.ConvertScriptToPixel(parts[2].Trim());
+ return new Size(x, y, z);
+ }
+ }
+
+ throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(Size)}");
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [ProvideCompiledAttribute("Tizen.NUI.Xaml.Forms.XamlC.Size2DTypeConverter")]
+ public class Size2DTypeConverter : TypeConverter
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override object ConvertFromInvariantString(string value)
+ {
+ if (value != null)
+ {
+ string[] parts = value.Split(',');
+ if (parts.Length == 2)
+ {
+ int x = (int)Tizen.NUI.GraphicsTypeManager.Instance.ConvertScriptToPixel(parts[0].Trim());
+ int y = (int)Tizen.NUI.GraphicsTypeManager.Instance.ConvertScriptToPixel(parts[1].Trim());
+ return new Size2D(x, y);
+ }
+ }
+
+ throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(Size2D)}");
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Reflection;
+using Tizen.NUI.StyleSheets;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// <summary>
+ /// The class Style.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [ContentProperty("Setters")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public sealed class Style : IStyle
+ {
+ internal const string StyleClassPrefix = "Tizen.NUI.XamlBinding.StyleClass.";
+
+ readonly BindableProperty _basedOnResourceProperty = BindableProperty.CreateAttached("BasedOnResource", typeof(Style), typeof(Style), default(Style),
+ propertyChanged: OnBasedOnResourceChanged);
+
+ readonly List<WeakReference<BindableObject>> _targets = new List<WeakReference<BindableObject>>(4);
+
+ Style _basedOnStyle;
+
+ string _baseResourceKey;
+
+ IList<Behavior> _behaviors;
+
+ IList<TriggerBase> _triggers;
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Style([TypeConverter(typeof(TypeTypeConverter))] [Parameter("TargetType")] Type targetType)
+ {
+ if (targetType == null)
+ throw new ArgumentNullException("targetType");
+
+ TargetType = targetType;
+ Setters = new List<Setter>();
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool ApplyToDerivedTypes { get; set; }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Style BasedOn
+ {
+ get { return _basedOnStyle; }
+ set
+ {
+ if (_basedOnStyle == value)
+ return;
+ if (!ValidateBasedOn(value))
+ throw new ArgumentException("BasedOn.TargetType is not compatible with TargetType");
+ Style oldValue = _basedOnStyle;
+ _basedOnStyle = value;
+ BasedOnChanged(oldValue, value);
+ if (value != null)
+ BaseResourceKey = null;
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string BaseResourceKey
+ {
+ get { return _baseResourceKey; }
+ set
+ {
+ if (_baseResourceKey == value)
+ return;
+ _baseResourceKey = value;
+ //update all DynamicResources
+ foreach (WeakReference<BindableObject> bindableWr in _targets)
+ {
+ BindableObject target;
+ if (!bindableWr.TryGetTarget(out target))
+ continue;
+ target.RemoveDynamicResource(_basedOnResourceProperty);
+ if (value != null)
+ target.SetDynamicResource(_basedOnResourceProperty, value);
+ }
+ if (value != null)
+ BasedOn = null;
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public IList<Behavior> Behaviors
+ {
+ get { return _behaviors ?? (_behaviors = new AttachedCollection<Behavior>()); }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool CanCascade { get; set; }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string Class { get; set; }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public IList<Setter> Setters { get; }
+
+ /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public IList<TriggerBase> Triggers
+ {
+ get { return _triggers ?? (_triggers = new AttachedCollection<TriggerBase>()); }
+ }
+
+ void IStyle.Apply(BindableObject bindable)
+ {
+ _targets.Add(new WeakReference<BindableObject>(bindable));
+ if (BaseResourceKey != null)
+ bindable.SetDynamicResource(_basedOnResourceProperty, BaseResourceKey);
+ ApplyCore(bindable, BasedOn ?? GetBasedOnResource(bindable));
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Type TargetType { get; }
+
+ void IStyle.UnApply(BindableObject bindable)
+ {
+ UnApplyCore(bindable, BasedOn ?? GetBasedOnResource(bindable));
+ bindable.RemoveDynamicResource(_basedOnResourceProperty);
+ _targets.RemoveAll(wr =>
+ {
+ BindableObject target;
+ return wr.TryGetTarget(out target) && target == bindable;
+ });
+ }
+
+ internal bool CanBeAppliedTo(Type targetType)
+ {
+ if (TargetType == targetType)
+ return true;
+ if (!ApplyToDerivedTypes)
+ return false;
+ do
+ {
+ targetType = targetType.GetTypeInfo().BaseType;
+ if (TargetType == targetType)
+ return true;
+ } while (targetType != typeof(Element));
+ return false;
+ }
+
+ void ApplyCore(BindableObject bindable, Style basedOn)
+ {
+ if (basedOn != null)
+ ((IStyle)basedOn).Apply(bindable);
+
+ foreach (Setter setter in Setters)
+ setter.Apply(bindable, true);
+ ((AttachedCollection<Behavior>)Behaviors).AttachTo(bindable);
+ ((AttachedCollection<TriggerBase>)Triggers).AttachTo(bindable);
+ }
+
+ void BasedOnChanged(Style oldValue, Style newValue)
+ {
+ foreach (WeakReference<BindableObject> bindableRef in _targets)
+ {
+ BindableObject bindable;
+ if (!bindableRef.TryGetTarget(out bindable))
+ continue;
+
+ UnApplyCore(bindable, oldValue);
+ ApplyCore(bindable, newValue);
+ }
+ }
+
+ Style GetBasedOnResource(BindableObject bindable)
+ {
+ return (Style)bindable.GetValue(_basedOnResourceProperty);
+ }
+
+ static void OnBasedOnResourceChanged(BindableObject bindable, object oldValue, object newValue)
+ {
+ // Style style = (bindable as /*VisualElement*/BaseHandle).Style;
+ // if (style == null)
+ // return;
+ // style.UnApplyCore(bindable, (Style)oldValue);
+ // style.ApplyCore(bindable, (Style)newValue);
+ }
+
+ void UnApplyCore(BindableObject bindable, Style basedOn)
+ {
+ ((AttachedCollection<TriggerBase>)Triggers).DetachFrom(bindable);
+ ((AttachedCollection<Behavior>)Behaviors).DetachFrom(bindable);
+ foreach (Setter setter in Setters)
+ setter.UnApply(bindable, true);
+
+ if (basedOn != null)
+ ((IStyle)basedOn).UnApply(bindable);
+ }
+
+ bool ValidateBasedOn(Style value)
+ {
+ if (value == null)
+ return true;
+ return value.TargetType.IsAssignableFrom(TargetType);
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.IO;
+
+namespace Tizen.NUI.StyleSheets
+{
+ /// <summary>
+ /// The class CssReader.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public sealed class CssReader : TextReader
+ {
+ readonly TextReader _reader;
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public CssReader(TextReader reader)
+ {
+ if (reader == null)
+ throw new ArgumentNullException(nameof(reader));
+
+ _reader = reader;
+ }
+
+ readonly Queue<char> _cache = new Queue<char>();
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override int Peek()
+ {
+ if (_cache.Count > 0)
+ return _cache.Peek();
+
+ int p = _reader.Peek();
+ if (p <= 0)
+ return p;
+ if (unchecked((char)p) != '/')
+ return p;
+
+ _cache.Enqueue(unchecked((char)_reader.Read()));
+ p = _reader.Peek();
+ if (p <= 0)
+ return _cache.Peek();
+ if (unchecked((char)p) != '*')
+ return _cache.Peek();
+
+ _cache.Clear();
+ _reader.Read(); //consume the '*'
+
+ bool hasStar = false;
+ while (true) {
+ var next = _reader.Read();
+ if (next <= 0)
+ return next;
+ if (unchecked((char)next) == '*')
+ hasStar = true;
+ else if (hasStar && unchecked((char)next) == '/')
+ return Peek(); //recursively call self for comments following comments
+ else
+ hasStar = false;
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override int Read()
+ {
+ if (_cache.Count > 0)
+ return _cache.Dequeue();
+
+ int p = _reader.Read();
+ if (p <= 0)
+ return p;
+ var c = unchecked((char)p);
+ if (c != '/')
+ return p;
+
+ _cache.Enqueue(c);
+ p = _reader.Read();
+ if (p <= 0)
+ return _cache.Dequeue();
+ c = unchecked((char)p);
+ if (c != '*')
+ return _cache.Dequeue();
+
+ _cache.Clear();
+ _reader.Read(); //consume the '*'
+
+ bool hasStar = false;
+ while (true) {
+ var next = _reader.Read();
+ if (next <= 0)
+ return next;
+ if (unchecked((char)next) == '*')
+ hasStar = true;
+ else if (hasStar && unchecked((char)next) == '/')
+ return Read(); //recursively call self for comments following comments
+ else
+ hasStar = false;
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.ComponentModel;
+using Tizen.NUI.XamlBinding;
+
+namespace Tizen.NUI.StyleSheets
+{
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public interface IStyle
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Type TargetType { get; }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ void Apply(BindableObject bindable);
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ void UnApply(BindableObject bindable);
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using Tizen.NUI.XamlBinding;
+
+namespace Tizen.NUI.StyleSheets
+{
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public interface IStyleSelectable
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ string[] NameAndBases { get; }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ string Id { get; }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ IStyleSelectable Parent { get; }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ IList<string> Classes { get; }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ IEnumerable<IStyleSelectable> Children { get; }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public interface IStylable
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ BindableProperty GetProperty(string key, bool inheriting);
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Reflection;
+using Tizen.NUI.XamlBinding;
+
+namespace Tizen.NUI.StyleSheets
+{
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public sealed class Style
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Style()
+ {
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public IDictionary<string, string> Declarations { get; set; } = new Dictionary<string, string>();
+ Dictionary<KeyValuePair<string, string>, object> convertedValues = new Dictionary<KeyValuePair<string, string>, object>();
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static Style Parse(CssReader reader, char stopChar = '\0')
+ {
+ Style style = new Style();
+ string propertyName = null, propertyValue = null;
+
+ int p;
+ reader.SkipWhiteSpaces();
+ bool readingName = true;
+ while ((p = reader.Peek()) > 0) {
+ switch (unchecked((char)p)) {
+ case ':':
+ reader.Read();
+ readingName = false;
+ reader.SkipWhiteSpaces();
+ break;
+ case ';':
+ reader.Read();
+ if (!string.IsNullOrEmpty(propertyName) && !string.IsNullOrEmpty(propertyValue))
+ style.Declarations.Add(propertyName, propertyValue);
+ propertyName = propertyValue = null;
+ readingName = true;
+ reader.SkipWhiteSpaces();
+ break;
+ default:
+ if ((char)p == stopChar)
+ return style;
+
+ if (readingName) {
+ propertyName = reader.ReadIdent();
+ if (propertyName == null)
+ throw new Exception();
+ } else
+ propertyValue = reader.ReadUntil(stopChar, ';', ':');
+ break;
+ }
+ }
+ return style;
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Apply(Element styleable, bool inheriting = false)
+ {
+ if (styleable == null)
+ throw new ArgumentNullException(nameof(styleable));
+
+ foreach (var decl in Declarations) {
+ var property = ((IStylable)styleable).GetProperty(decl.Key, inheriting);
+ if (property == null)
+ continue;
+ if (string.Equals(decl.Value, "initial", StringComparison.OrdinalIgnoreCase))
+ styleable.ClearValue(property, fromStyle: true);
+ else {
+ object value;
+ if (!convertedValues.TryGetValue(decl, out value))
+ convertedValues[decl] = (value = Convert(styleable, decl.Value, property));
+ styleable.SetValue(property, value, fromStyle: true);
+ }
+ }
+
+ foreach (var child in styleable.LogicalChildrenInternal) {
+ var ve = child as Element;
+ if (ve == null)
+ continue;
+ Apply(ve, inheriting: true);
+ }
+ }
+
+ // [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ static object Convert(object target, object value, BindableProperty property)
+ {
+ Func<MemberInfo> minforetriever = () => property.DeclaringType.GetRuntimeProperty(property.PropertyName) as MemberInfo
+ ?? property.DeclaringType.GetRuntimeMethod("Get" + property.PropertyName, new[] { typeof(BindableObject) }) as MemberInfo;
+ var serviceProvider = new StyleSheetServiceProvider(target, property);
+ // return value.ConvertTo(property.ReturnType, minforetriever, serviceProvider);
+ return null;
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void UnApply(IStylable styleable)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.IO;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Xml;
+using Tizen.NUI.Xaml;
+using Tizen.NUI.XamlBinding;
+
+namespace Tizen.NUI.StyleSheets
+{
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public sealed class StyleSheet : IStyle
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ StyleSheet()
+ {
+ }
+
+ internal IDictionary<Selector, Style> Styles { get; set; } = new Dictionary<Selector, Style>();
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static StyleSheet FromAssemblyResource(Assembly assembly, string resourceId, IXmlLineInfo lineInfo = null)
+ {
+ using (var stream = assembly.GetManifestResourceStream(resourceId)) {
+ if (stream == null)
+ throw new XamlParseException($"No resource found for '{resourceId}'.", lineInfo);
+ using (var reader = new StreamReader(stream)) {
+ return FromReader(reader);
+ }
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static StyleSheet FromString(string stylesheet)
+ {
+ if (stylesheet == null)
+ throw new ArgumentNullException(nameof(stylesheet));
+ using (var reader = new StringReader(stylesheet))
+ return FromReader(reader);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static StyleSheet FromReader(TextReader reader)
+ {
+ if (reader == null)
+ throw new ArgumentNullException(nameof(reader));
+
+ return Parse(new CssReader(reader));
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ static StyleSheet Parse(CssReader reader)
+ {
+ var sheet = new StyleSheet();
+
+ Style style = null;
+ var selector = Selector.All;
+
+ int p;
+ bool inStyle = false;
+ reader.SkipWhiteSpaces();
+ while ((p = reader.Peek()) > 0) {
+ switch ((char)p) {
+ case '@':
+ throw new NotSupportedException("AT-rules not supported");
+ case '{':
+ reader.Read();
+ style = Style.Parse(reader, '}');
+ inStyle = true;
+ break;
+ case '}':
+ reader.Read();
+ if (!inStyle)
+ throw new Exception();
+ inStyle = false;
+ sheet.Styles.Add(selector, style);
+ style = null;
+ selector = Selector.All;
+ break;
+ default:
+ selector = Selector.Parse(reader, '{');
+ break;
+ }
+ }
+ return sheet;
+ }
+
+ Type IStyle.TargetType
+ => typeof(Element);
+
+ void IStyle.Apply(BindableObject bindable)
+ {
+ var styleable = bindable as Element;
+ if (styleable == null)
+ return;
+ Apply(styleable);
+ }
+
+ void Apply(Element styleable)
+ {
+ ApplyCore(styleable);
+ foreach (var child in styleable.LogicalChildrenInternal)
+ ((IStyle)this).Apply(child);
+ }
+
+ void ApplyCore(Element styleable)
+ {
+ var visualStylable = styleable as Element;
+ if (visualStylable == null)
+ return;
+ foreach (var kvp in Styles) {
+ var selector = kvp.Key;
+ var style = kvp.Value;
+ // if (!selector.Matches(styleable))
+ // continue;
+ style.Apply(visualStylable);
+ }
+ }
+
+ void IStyle.UnApply(BindableObject bindable)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.Collections.Generic;
+using System.ComponentModel;
+using Tizen.NUI.XamlBinding;
+
+namespace Tizen.NUI.Xaml
+{
+ /// <summary>
+ /// A page that displays full-screen content with a control template, and the base class for ContentPage.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class TemplatedPage : Page, IControlTemplated
+ {
+ /// <summary>
+ /// Backing store for the ControlTemplate property.
+ /// </summary>
+ internal static readonly BindableProperty ControlTemplateProperty = BindableProperty.Create(nameof(ControlTemplate), typeof(ControlTemplate), typeof(TemplatedPage), null,
+ propertyChanged: TemplateUtilities.OnControlTemplateChanged);
+
+ /// <summary>
+ /// Gets or sets the control template that is used to display content.
+ /// </summary>
+ internal ControlTemplate ControlTemplate
+ {
+ get { return (ControlTemplate)GetValue(ControlTemplateProperty); }
+ set { SetValue(ControlTemplateProperty, value); }
+ }
+
+ IList<Element> IControlTemplated.InternalChildren => InternalChildren;
+
+ // internal override void ComputeConstraintForView(View view)
+ // {
+ // LayoutOptions vOptions = view.VerticalOptions;
+ // LayoutOptions hOptions = view.HorizontalOptions;
+
+ // var result = LayoutConstraint.None;
+ // if (vOptions.Alignment == LayoutAlignment.Fill)
+ // result |= LayoutConstraint.VerticallyFixed;
+ // if (hOptions.Alignment == LayoutAlignment.Fill)
+ // result |= LayoutConstraint.HorizontallyFixed;
+
+ // view.ComputedConstraint = result;
+ // }
+
+ internal override void SetChildInheritedBindingContext(Element child, object context)
+ {
+ if (ControlTemplate == null)
+ base.SetChildInheritedBindingContext(child, context);
+ }
+
+ void IControlTemplated.OnControlTemplateChanged(ControlTemplate oldValue, ControlTemplate newValue)
+ {
+ OnControlTemplateChanged(oldValue, newValue);
+ }
+
+ internal virtual void OnControlTemplateChanged(ControlTemplate oldValue, ControlTemplate newValue)
+ {
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.ComponentModel;
+using System;
+using System.Collections.Generic;
+using Tizen.NUI.Xaml.Forms.BaseComponents;
+using System.Reflection;
+using System.Linq;
+using Tizen.NUI.Xaml;
+using System.Globalization;
+using Tizen.NUI.Xaml.Internals;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class AnimationBehavior
+ {
+ private string _key = null;
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string Key
+ {
+ get
+ {
+ return _key;
+ }
+ set
+ {
+ _key = value;
+ }
+ }
+
+ private string _property = null;
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string Property
+ {
+ get
+ {
+ return _property;
+ }
+ set
+ {
+ _property = value;
+ }
+ }
+
+ private string _destValue = null;
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string DestValue
+ {
+ get
+ {
+ return _destValue;
+ }
+ set
+ {
+ _destValue = value;
+ }
+ }
+
+ private int _startTime = -1;
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int StartTime
+ {
+ get
+ {
+ return _startTime;
+ }
+ set
+ {
+ _startTime = value;
+ }
+ }
+
+ private int _endTime = -1;
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int EndTime
+ {
+ get
+ {
+ return _endTime;
+ }
+ set
+ {
+ _endTime = value;
+ }
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class Transition : Tizen.NUI.Xaml.Forms.BaseHandle
+ {
+ private Tizen.NUI.Animation _animation;
+ internal Tizen.NUI.Animation animation
+ {
+ get
+ {
+ if (null == _animation)
+ {
+ _animation = handleInstance as Tizen.NUI.Animation;
+ }
+
+ return _animation;
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Transition() : this(new Tizen.NUI.Animation())
+ {
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Transition(int durationMilliSeconds) : this(new Tizen.NUI.Animation(durationMilliSeconds))
+ {
+ }
+
+ internal Transition(Tizen.NUI.Animation nuiInstance) : base(nuiInstance)
+ {
+ SetNUIInstance(nuiInstance);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler Finished
+ {
+ add
+ {
+ animation.Finished += value;
+ }
+ remove
+ {
+ animation.Finished -= value;
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler ProgressReached
+ {
+ add
+ {
+ animation.ProgressReached += value;
+ }
+ remove
+ {
+ animation.ProgressReached -= value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the duration in milliseconds of the animation.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int Duration
+ {
+ set
+ {
+ animation.Duration = value;
+ }
+ get
+ {
+ return animation.Duration;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the default alpha function for the animation.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public AlphaFunction DefaultAlphaFunction
+ {
+ set
+ {
+ animation.DefaultAlphaFunction = value;
+ }
+ get
+ {
+ return animation.DefaultAlphaFunction;
+ }
+ }
+
+ /// <summary>
+ /// Queries the state of the animation.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Tizen.NUI.Animation.States State
+ {
+ get
+ {
+ return animation.State;
+ }
+ }
+
+ /// <summary>
+ /// Set: Enables looping for a specified number of repeats. A zero is the same as Looping = true; i.e., repeat forever.<br />
+ /// This property resets the looping value and should not be used with the Looping property.<br />
+ /// Setting this parameter does not cause the animation to Play().<br />
+ /// Get: Gets the loop count. A zero is the same as Looping = true; i.e., repeat forever.<br />
+ /// The loop count is initially 1 for play once.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int LoopCount
+ {
+ set
+ {
+ animation.LoopCount = value;
+ }
+ get
+ {
+ return animation.LoopCount;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the status of whether the animation will loop.<br />
+ /// This property resets the loop count and should not be used with the LoopCount property.<br />
+ /// Setting this parameter does not cause the animation to Play().<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool Looping
+ {
+ set
+ {
+ animation.Looping = value;
+ }
+ get
+ {
+ return animation.Looping;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the end action of the animation.<br />
+ /// This action is performed when the animation ends or if it is stopped.<br />
+ /// The default end action is cancel.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Tizen.NUI.Animation.EndActions EndAction
+ {
+ set
+ {
+ animation.EndAction = value;
+ }
+ get
+ {
+ return animation.EndAction;
+ }
+ }
+
+ /// <summary>
+ /// Gets the current loop count.<br />
+ /// A value 0 indicating the current loop count when looping.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int CurrentLoop
+ {
+ get
+ {
+ return animation.CurrentLoop;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the disconnect action.<br />
+ /// If any of the animated property owners are disconnected from the stage while the animation is being played, then this action is performed.<br />
+ /// The default action is cancel.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Tizen.NUI.Animation.EndActions DisconnectAction
+ {
+ set
+ {
+ animation.DisconnectAction = value;
+ }
+ get
+ {
+ return animation.DisconnectAction;
+ }
+ }
+
+
+ /// <summary>
+ /// Gets or sets the progress of the animation.<br />
+ /// The animation will play (or continue playing) from this point.<br />
+ /// The progress must be in the 0-1 interval or in the play range interval if defined<br />
+ /// otherwise, it will be ignored.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float CurrentProgress
+ {
+ set
+ {
+ animation.CurrentProgress = value;
+ }
+ get
+ {
+ return animation.CurrentProgress;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets specificifications of a speed factor for the animation.<br />
+ /// The speed factor is a multiplier of the normal velocity of the animation.<br />
+ /// Values between [0, 1] will slow down the animation and values above one will speed up the animation.<br />
+ /// It is also possible to specify a negative multiplier to play the animation in reverse.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float SpeedFactor
+ {
+ set
+ {
+ animation.SpeedFactor = value;
+ }
+ get
+ {
+ return animation.SpeedFactor;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the playing range.<br />
+ /// Animation will play between the values specified. Both values (range.x and range.y ) should be between 0-1,
+ /// otherwise they will be ignored. If the range provided is not in proper order (minimum, maximum ), it will be reordered.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public RelativeVector2 PlayRange
+ {
+ set
+ {
+ animation.PlayRange = value;
+ }
+ get
+ {
+ return animation.PlayRange;
+ }
+ }
+
+
+ /// <summary>
+ /// Gets or sets the progress notification marker which triggers the ProgressReachedSignal.<br />
+ /// Percentage of animation progress should be greater than 0 and less than 1, for example, 0.3 for 30% <br />
+ /// One notification can be set on each animation.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float ProgressNotification
+ {
+ set
+ {
+ animation.ProgressNotification = value;
+ }
+ get
+ {
+ return animation.ProgressNotification;
+ }
+ }
+
+ private string[] _properties = null;
+ private string[] _destValue = null;
+ private int[] _startTime = null;
+ private int[] _endTime = null;
+
+ /// <summary>
+ /// Gets or sets the properties of the animation.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string[] Properties
+ {
+ get
+ {
+ return _properties;
+ }
+ set
+ {
+ _properties = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the destination value for each property of the animation.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string[] DestValue
+ {
+ get
+ {
+ return _destValue;
+ }
+ set
+ {
+ _destValue = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the start time for each property of the animation.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int[] StartTime
+ {
+ get
+ {
+ return _startTime;
+ }
+ set
+ {
+ _startTime = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the end time for each property of the animation.
+ /// </summary>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int[] EndTime
+ {
+ get
+ {
+ return _endTime;
+ }
+ set
+ {
+ _endTime = value;
+ }
+ }
+
+ /// <summary>
+ /// Downcasts a handle to animation handle.<br />
+ /// If handle points to an animation object, the downcast produces a valid handle.<br />
+ /// If not, the returned handle is left uninitialized.<br />
+ /// </summary>
+ /// <param name="handle">Handle to an object.</param>
+ /// <returns>Handle to an animation object or an uninitialized handle.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static Transition DownCast(Tizen.NUI.BaseHandle handle)
+ {
+ return Tizen.NUI.Xaml.Forms.BaseHandle.GetHandle(Tizen.NUI.Animation.DownCast(handle)) as Transition;
+ }
+
+ /// <summary>
+ /// Stops the animation.
+ /// </summary>
+ /// <param name="action">The end action can be set.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Stop(Tizen.NUI.Animation.EndActions action)
+ {
+ animation.Stop(action);
+ }
+
+ /// <summary>
+ /// Plays the animation.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Play()
+ {
+ animation.Play();
+ }
+
+ /// <summary>
+ /// Pauses the animation.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Pause()
+ {
+ animation.Pause();
+ }
+
+ /// <summary>
+ /// Stops the animation.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Stop()
+ {
+ animation.Stop();
+ }
+
+ /// <summary>
+ /// Clears the animation.<br />
+ /// This disconnects any objects that were being animated, effectively stopping the animation.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Clear()
+ {
+ animation.Clear();
+ }
+
+ private string name;
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+
+ public string Name
+ {
+ get
+ {
+ return name;
+ }
+ set
+ {
+ name = value;
+ }
+ }
+
+ private Dictionary<string, AnimationBehavior> behaviors = new Dictionary<string, AnimationBehavior>();
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public AnimationBehavior[] Behaviors
+ {
+ set
+ {
+ if (null != value)
+ {
+ foreach (AnimationBehavior behavior in value)
+ {
+ behaviors.Add(behavior.Key, behavior);
+ }
+ }
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void AnimateTo(View instance, string behaviorKey)
+ {
+ AnimationBehavior behavior = null;
+ behaviors.TryGetValue(behaviorKey, out behavior);
+
+ if (null != behavior)
+ {
+ 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)
+ {
+ animation.AnimateTo(instance.view, behavior.Property, destinationValue, behavior.StartTime, behavior.EndTime);
+ }
+ else
+ {
+ animation.AnimateTo(instance.view, behavior.Property, destinationValue);
+ }
+ }
+ }
+ }
+ else
+ {
+ throw new XamlParseException(string.Format("Behaviors don't have key {0}", behaviorKey), new XmlLineInfo());
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void AnimateBy(View instance, string behaviorKey)
+ {
+ AnimationBehavior behavior = null;
+ behaviors.TryGetValue(behaviorKey, out behavior);
+
+ if (null != behavior)
+ {
+ 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)
+ {
+ animation.AnimateBy(instance.view, behavior.Property, destinationValue, behavior.StartTime, behavior.EndTime);
+ }
+ else
+ {
+ animation.AnimateBy(instance.view, behavior.Property, destinationValue);
+ }
+ }
+ }
+ }
+ else
+ {
+ throw new XamlParseException(string.Format("Behaviors don't have key {0}", behaviorKey), new XmlLineInfo());
+ }
+ }
+
+ internal object ConvertTo(object value, Type toType)
+ {
+ Func<object> getConverter = () =>
+ {
+ var converterTypeName = TypeConversionExtensions.GetConverterName(toType);
+
+ if (null == converterTypeName)
+ {
+ return null;
+ }
+
+ Type convertertype = Type.GetType(converterTypeName);
+ return Activator.CreateInstance(convertertype);
+ };
+
+ return ConvertTo(value, toType, getConverter);
+ }
+
+ internal object ConvertTo(object value, Type toType, Func<object> getConverter)
+ {
+ if (value == null)
+ return null;
+
+ var str = value as string;
+ if (str != null)
+ {
+ //If there's a [TypeConverter], use it
+ object converter = getConverter?.Invoke();
+ var xfTypeConverter = converter as TypeConverter;
+ 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 });
+ }
+
+ //If the type is nullable, as the value is not null, it's safe to assume we want the built-in conversion
+ if (toType.GetTypeInfo().IsGenericType && toType.GetGenericTypeDefinition() == typeof(Nullable<>))
+ toType = Nullable.GetUnderlyingType(toType);
+
+ //Obvious Built-in conversions
+ if (toType.GetTypeInfo().IsEnum)
+ return Enum.Parse(toType, str, true);
+ if (toType == typeof(SByte))
+ return SByte.Parse(str, CultureInfo.InvariantCulture);
+ if (toType == typeof(Int16))
+ return Int16.Parse(str, CultureInfo.InvariantCulture);
+ if (toType == typeof(Int32))
+ return Int32.Parse(str, CultureInfo.InvariantCulture);
+ if (toType == typeof(Int64))
+ return Int64.Parse(str, CultureInfo.InvariantCulture);
+ if (toType == typeof(Byte))
+ return Byte.Parse(str, CultureInfo.InvariantCulture);
+ if (toType == typeof(UInt16))
+ return UInt16.Parse(str, CultureInfo.InvariantCulture);
+ if (toType == typeof(UInt32))
+ return UInt32.Parse(str, CultureInfo.InvariantCulture);
+ if (toType == typeof(UInt64))
+ return UInt64.Parse(str, CultureInfo.InvariantCulture);
+ if (toType == typeof(Single))
+ return Single.Parse(str, CultureInfo.InvariantCulture);
+ if (toType == typeof(Double))
+ return Double.Parse(str, CultureInfo.InvariantCulture);
+ if (toType == typeof(Boolean))
+ return Boolean.Parse(str);
+ if (toType == typeof(TimeSpan))
+ return TimeSpan.Parse(str, CultureInfo.InvariantCulture);
+ if (toType == typeof(DateTime))
+ return DateTime.Parse(str, CultureInfo.InvariantCulture);
+ if (toType == typeof(Char))
+ {
+ char c = '\0';
+ Char.TryParse(str, out c);
+ return c;
+ }
+ if (toType == typeof(String) && str.StartsWith("{}", StringComparison.Ordinal))
+ return str.Substring(2);
+ if (toType == typeof(String))
+ return value;
+ if (toType == typeof(Decimal))
+ return Decimal.Parse(str, CultureInfo.InvariantCulture);
+ }
+
+ //if the value is not assignable and there's an implicit conversion, convert
+ if (value != null && !toType.IsAssignableFrom(value.GetType()))
+ {
+ var opImplicit = GetImplicitConversionOperator(value.GetType(), value.GetType(), toType)
+ ?? GetImplicitConversionOperator(toType, value.GetType(), toType);
+ //var opImplicit = value.GetType().GetImplicitConversionOperator(fromType: value.GetType(), toType: toType)
+ // ?? toType.GetImplicitConversionOperator(fromType: value.GetType(), toType: toType);
+
+ if (opImplicit != null)
+ {
+ value = opImplicit.Invoke(null, new[] { value });
+ return value;
+ }
+ }
+
+ var nativeValueConverterService = DependencyService.Get<INativeValueConverterService>();
+
+ object nativeValue = null;
+ if (nativeValueConverterService != null && nativeValueConverterService.ConvertTo(value, toType, out nativeValue))
+ return nativeValue;
+
+ return value;
+ }
+
+ internal string GetTypeConverterTypeName(IEnumerable<CustomAttributeData> attributes)
+ {
+ var converterAttribute =
+ attributes.FirstOrDefault(cad => TypeConverterAttribute.TypeConvertersType.Contains(cad.AttributeType.FullName));
+ if (converterAttribute == null)
+ return null;
+ if (converterAttribute.ConstructorArguments[0].ArgumentType == typeof(string))
+ return (string)converterAttribute.ConstructorArguments[0].Value;
+ if (converterAttribute.ConstructorArguments[0].ArgumentType == typeof(Type))
+ return ((Type)converterAttribute.ConstructorArguments[0].Value).AssemblyQualifiedName;
+ return null;
+ }
+
+ internal MethodInfo GetImplicitConversionOperator(Type onType, Type fromType, Type toType)
+ {
+#if NETSTANDARD1_0
+ var mi = onType.GetRuntimeMethod("op_Implicit", new[] { fromType });
+#else
+ var bindingFlags = BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy;
+ var mi = onType.GetMethod("op_Implicit", bindingFlags, null, new[] { fromType }, null);
+#endif
+ if (mi == null) return null;
+ if (!mi.IsSpecialName) return null;
+ if (!mi.IsPublic) return null;
+ if (!mi.IsStatic) return null;
+ if (!toType.IsAssignableFrom(mi.ReturnType)) return null;
+
+ return mi;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.ComponentModel;
+using System.Globalization;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// <summary>
+ /// The class to converter Type.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public abstract class TypeConverter
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual bool CanConvertFrom(Type sourceType)
+ {
+ if (sourceType == null)
+ throw new ArgumentNullException(nameof(sourceType));
+
+ return sourceType == typeof(string);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [Obsolete("ConvertFrom is obsolete as of version 2.2.0. Please use ConvertFromInvariantString (string) instead.")]
+ public virtual object ConvertFrom(object o)
+ {
+ return null;
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [Obsolete("ConvertFrom is obsolete as of version 2.2.0. Please use ConvertFromInvariantString (string) instead.")]
+ public virtual object ConvertFrom(CultureInfo culture, object o)
+ {
+ return null;
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual object ConvertFromInvariantString(string value)
+ {
+#pragma warning disable 0618 // retain until ConvertFrom removed
+ return ConvertFrom(CultureInfo.InvariantCulture, value);
+#pragma warning restore
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+using System.ComponentModel;
+using System.Globalization;
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [Xaml.ProvideCompiled("Tizen.NUI.Xaml.Forms.XamlC.TypeTypeConverter")]
+ [Xaml.TypeConversion(typeof(Type))]
+ public sealed class TypeTypeConverter : TypeConverter, IExtendedTypeConverter
+ {
+ [Obsolete("IExtendedTypeConverter.ConvertFrom is obsolete as of version 2.2.0. Please use ConvertFromInvariantString (string, IServiceProvider) instead.")]
+ object IExtendedTypeConverter.ConvertFrom(CultureInfo culture, object value, IServiceProvider serviceProvider)
+ {
+ return ((IExtendedTypeConverter)this).ConvertFromInvariantString((string)value, serviceProvider);
+ }
+
+ object IExtendedTypeConverter.ConvertFromInvariantString(string value, IServiceProvider serviceProvider)
+ {
+ if (serviceProvider == null)
+ throw new ArgumentNullException("serviceProvider");
+ var typeResolver = serviceProvider.GetService(typeof(IXamlTypeResolver)) as IXamlTypeResolver;
+ if (typeResolver == null)
+ throw new ArgumentException("No IXamlTypeResolver in IServiceProvider");
+
+ return typeResolver.Resolve(value, serviceProvider);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override object ConvertFromInvariantString(string value)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
--- /dev/null
+using System;
+using System.ComponentModel;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [Xaml.ProvideCompiled("Tizen.NUI.XamlC.UriTypeConverter")]
+ [Xaml.TypeConversion(typeof(Uri))]
+ public class UriTypeConverter : TypeConverter
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override object ConvertFromInvariantString(string value)
+ {
+ if (string.IsNullOrWhiteSpace(value))
+ return null;
+ return new Uri(value, UriKind.RelativeOrAbsolute);
+ }
+
+ bool CanConvert(Type type)
+ {
+ if (type == typeof(string))
+ return true;
+ if (type == typeof(Uri))
+ return true;
+
+ return false;
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Linq;
+using System.Reflection;
+using System.Globalization;
+
+using Tizen.NUI;
+using System.ComponentModel;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class Vector2TypeConverter : TypeConverter
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override object ConvertFromInvariantString(string value)
+ {
+ if (value != null)
+ {
+ string[] parts = value.Split(',');
+ if (parts.Length == 2 )
+ {
+ return new Vector2(Single.Parse(parts[0].Trim(), CultureInfo.InvariantCulture),
+ Single.Parse(parts[1].Trim(), CultureInfo.InvariantCulture));
+ }
+ }
+
+ throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(Vector2)}");
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class Vector3TypeConverter : TypeConverter
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override object ConvertFromInvariantString(string value)
+ {
+ if (value != null)
+ {
+ string[] parts = value.Split(',');
+ if (parts.Length == 3 )
+ {
+ return new Vector3(Single.Parse(parts[0].Trim(), CultureInfo.InvariantCulture),
+ Single.Parse(parts[1].Trim(), CultureInfo.InvariantCulture),
+ Single.Parse(parts[2].Trim(), CultureInfo.InvariantCulture));
+ }
+ }
+
+ throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(Vector3)}");
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class Vector4TypeConverter : TypeConverter
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override object ConvertFromInvariantString(string value)
+ {
+ if (value != null)
+ {
+ string[] parts = value.Split(',');
+ if (parts.Length == 4 )
+ {
+ return new Vector4(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));
+ }
+ }
+
+ throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(Vector4)}");
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class RelativeVector2TypeConverter : TypeConverter
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override object ConvertFromInvariantString(string value)
+ {
+ if (value != null)
+ {
+ string[] parts = value.Split(',');
+ if (parts.Length == 2 )
+ {
+ return new RelativeVector2(Single.Parse(parts[0].Trim(), CultureInfo.InvariantCulture),
+ Single.Parse(parts[1].Trim(), CultureInfo.InvariantCulture));
+ }
+ }
+
+ throw new InvalidOperationException("Cannot convert \"{value}\" into {typeof(RelativeVector2)}");
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class RelativeVector3TypeConverter : TypeConverter
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override object ConvertFromInvariantString(string value)
+ {
+ if (value != null)
+ {
+ string[] parts = value.Split(',');
+ if (parts.Length == 3 )
+ {
+ return new RelativeVector3(Single.Parse(parts[0].Trim(), CultureInfo.InvariantCulture),
+ Single.Parse(parts[1].Trim(), CultureInfo.InvariantCulture),
+ Single.Parse(parts[2].Trim(), CultureInfo.InvariantCulture));
+ }
+ }
+
+ throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(RelativeVector3)}");
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class RelativeVector4TypeConverter : TypeConverter
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override object ConvertFromInvariantString(string value)
+ {
+ if (value != null)
+ {
+ string[] parts = value.Split(',');
+ if (parts.Length == 4 )
+ {
+ return new RelativeVector4(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));
+ }
+ }
+
+ throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(RelativeVector4)}");
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Diagnostics;
+using System.ComponentModel;
+
+namespace Tizen.NUI.XamlBinding
+{
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
+ [DebuggerDisplay("{XmlNamespace}, {ClrNamespace}, {AssemblyName}")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public sealed class XmlnsDefinitionAttribute : Attribute
+ {
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string XmlNamespace { get; }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string ClrNamespace { get; }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string AssemblyName { get; set; }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public XmlnsDefinitionAttribute(string xmlNamespace, string clrNamespace)
+ {
+ if (xmlNamespace == null)
+ throw new ArgumentNullException(nameof(xmlNamespace));
+ if (clrNamespace == null)
+ throw new ArgumentNullException(nameof(clrNamespace));
+
+ ClrNamespace = clrNamespace;
+ XmlNamespace = xmlNamespace;
+ }
+ }
+}
\ No newline at end of file
using System.Runtime.CompilerServices;
using Tizen.NUI;
-
-[assembly: InternalsVisibleTo("Tizen.NUI.Design, Publickey=0024000004800000940000000602000000240000525341310004000001000100d115b1004248416b12d21b626cfb17149c9303fe394693fd3b32d7872e89559a4fa96c98110c2e62eea48aca693bddbe17094ca8ea2e2cd79970ca590fb672b9b371b5d7002076817321f62d6483ea50c56dbd1f37b185a4c24c47718876e6ae6d266508c551170d4cbdda3f82edaff9405ee3d7857282d8269e8e518d2f0fb2")]
-
-// Xamarin.Forms.Loader.dll Xamarin.Forms.Xaml.XamlLoader.Load(object, string), kzu@microsoft.com
-[assembly: XmlnsDefinition("http://tizen.org/Tizen.NUI/2018/XAML", "Tizen.NUI")]
-[assembly: XmlnsDefinition("http://tizen.org/Tizen.NUI/2018/XAML", "Tizen.NUI.BaseComponents")]
-[assembly: XmlnsDefinition("http://tizen.org/Tizen.NUI/2018/XAML", "Tizen.NUI.UIComponents")]
-[assembly: XmlnsDefinition("http://tizen.org/Tizen.NUI/2018/XAML", "Tizen.NUI.Xaml")]
-[assembly: XmlnsDefinition("http://tizen.org/Tizen.NUI/2018/XAML", "Tizen.NUI.Binding")]
-[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml", "Tizen.NUI.Xaml")]
-[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml", "System", AssemblyName = "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
-[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml", "System", AssemblyName = "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
-[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2009/xaml", "Tizen.NUI.Xaml")]
-[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2009/xaml", "System", AssemblyName = "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
-[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2009/xaml", "System", AssemblyName = "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
- using Tizen.NUI.Binding;
- using Tizen.NUI.Binding.Internals;
/**
* @brief Event arguments that passed via NUIApplicationInit signal
}
}
- /// <summary>
- /// A class to get resources in current application.
- /// </summary>
- public class GetResourcesProvider
+ internal class Application : BaseHandle
{
- /// <summary>
- /// Get resources in current application.
- /// </summary>
- static public IResourcesProvider Get()
- {
- return Tizen.NUI.Application.Current;
- }
- }
-
- internal class Application : BaseHandle, IResourcesProvider, IApplicationController, IElementConfiguration<Application>
- {
-
- static Application s_current;
- Task<IDictionary<string, object>> _propertiesTask;
- readonly Lazy<PlatformConfigurationRegistry<Application>> _platformConfigurationRegistry;
-
- IAppIndexingProvider _appIndexProvider;
-
- ReadOnlyCollection<Element> _logicalChildren;
-
- Page _mainPage;
-
static SemaphoreSlim SaveSemaphore = new SemaphoreSlim(1, 1);
- public IAppLinks AppLinks
- {
- get
- {
- 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");
- return _appIndexProvider.AppLinks;
- }
- }
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static void SetCurrentApplication(Application value) => Current = value;
-
- public static Application Current
- {
- get { return s_current; }
- set
- {
- if (s_current == value)
- return;
- if (value == null)
- s_current = null; //Allow to reset current for unittesting
- s_current = value;
- }
- }
-
- public Page MainPage
- {
- get { return _mainPage; }
- set
- {
- if (value == null)
- throw new ArgumentNullException("value");
-
- if (_mainPage == value)
- return;
-
- OnPropertyChanging();
- if (_mainPage != null)
- {
- InternalChildren.Remove(_mainPage);
- _mainPage.Parent = null;
- }
-
- _mainPage = value;
-
- if (_mainPage != null)
- {
- _mainPage.Parent = this;
- _mainPage.NavigationProxy.Inner = NavigationProxy;
- InternalChildren.Add(_mainPage);
- }
- OnPropertyChanged();
- }
- }
-
- public IDictionary<string, object> Properties
- {
- get
- {
- if (_propertiesTask == null)
- {
- _propertiesTask = GetPropertiesAsync();
- }
-
- return _propertiesTask.Result;
- }
- }
-
- internal override ReadOnlyCollection<Element> LogicalChildrenInternal
- {
- get { return _logicalChildren ?? (_logicalChildren = new ReadOnlyCollection<Element>(InternalChildren)); }
- }
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public new NavigationProxy NavigationProxy { get; }
-
[EditorBrowsable(EditorBrowsableState.Never)]
public int PanGestureId { get; set; }
- internal IResourceDictionary SystemResources { get; }
-
- ObservableCollection<Element> InternalChildren { get; } = new ObservableCollection<Element>();
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public void SetAppIndexingProvider(IAppIndexingProvider provider)
- {
- _appIndexProvider = provider;
- }
-
- ResourceDictionary _resources;
- public bool IsResourcesCreated => _resources != null;
-
- public delegate void resChangeCb(object sender, ResourcesChangedEventArgs e);
-
- static private Dictionary<object, Dictionary<resChangeCb, int>> resourceChangeCallbackDict = new Dictionary<object, Dictionary<resChangeCb, int>>();
- static public void AddResourceChangedCallback(object handle, resChangeCb cb)
- {
- Dictionary<resChangeCb, int> cbDict;
- resourceChangeCallbackDict.TryGetValue(handle, out cbDict);
-
- if (null == cbDict)
- {
- cbDict = new Dictionary<resChangeCb, int>();
- resourceChangeCallbackDict.Add(handle, cbDict);
- }
-
- if (false == cbDict.ContainsKey(cb))
- {
- cbDict.Add(cb, 0);
- }
- }
-
- internal override void OnResourcesChanged(object sender, ResourcesChangedEventArgs e)
- {
- base.OnResourcesChanged(sender, e);
-
- foreach (KeyValuePair<object, Dictionary<resChangeCb, int>> resourcePair in resourceChangeCallbackDict)
- {
- foreach (KeyValuePair<resChangeCb, int> cbPair in resourcePair.Value)
- {
- cbPair.Key(sender, e);
- }
- }
- }
-
- public ResourceDictionary XamlResources
- {
- get
- {
- if (_resources != null)
- return _resources;
-
- _resources = new ResourceDictionary();
- int hashCode = _resources.GetHashCode();
- ((IResourceDictionary)_resources).ValuesChanged += OnResourcesChanged;
- return _resources;
- }
- set
- {
- if (_resources == value)
- return;
- OnPropertyChanging();
-
- if (_resources != null)
- ((IResourceDictionary)_resources).ValuesChanged -= OnResourcesChanged;
- _resources = value;
- OnResourcesChanged(value);
- if (_resources != null)
- ((IResourceDictionary)_resources).ValuesChanged += OnResourcesChanged;
-
- OnPropertyChanged();
- }
- }
-
- public event EventHandler<ModalPoppedEventArgs> ModalPopped;
-
- public event EventHandler<ModalPoppingEventArgs> ModalPopping;
-
- public event EventHandler<ModalPushedEventArgs> ModalPushed;
-
- public event EventHandler<ModalPushingEventArgs> ModalPushing;
-
- public event EventHandler<Page> PageAppearing;
-
- public event EventHandler<Page> PageDisappearing;
-
-
- async void SaveProperties()
- {
- try
- {
- await SetPropertiesAsync();
- }
- catch (Exception exc)
- {
- Console.WriteLine(nameof(Application), $"Exception while saving Application Properties: {exc}");
- }
- }
-
- public async Task SavePropertiesAsync()
- {
- if (Device.IsInvokeRequired)
- {
- Device.BeginInvokeOnMainThread(SaveProperties);
- }
- else
- {
- await SetPropertiesAsync();
- }
- }
-
- // Don't use this unless there really is no better option
- internal void SavePropertiesAsFireAndForget()
- {
- if (Device.IsInvokeRequired)
- {
- Device.BeginInvokeOnMainThread(SaveProperties);
- }
- else
- {
- SaveProperties();
- }
- }
-
- public IPlatformElementConfiguration<T, Application> On<T>() where T : IConfigPlatform
- {
- return _platformConfigurationRegistry.Value.On<T>();
- }
-
- protected virtual void OnAppLinkRequestReceived(Uri uri)
- {
- }
-
- protected override void OnParentSet()
- {
- throw new InvalidOperationException("Setting a Parent on Application is invalid.");
- }
-
- protected virtual void OnResume()
- {
- }
-
- protected virtual void OnSleep()
- {
- }
-
- protected virtual void OnStart()
- {
- }
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static void ClearCurrent()
- {
- s_current = null;
- }
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static bool IsApplicationOrNull(Element element)
- {
- return element == null || element is Application;
- }
-
- internal override void OnParentResourcesChanged(IEnumerable<KeyValuePair<string, object>> values)
- {
- if (!((IResourcesProvider)this).IsResourcesCreated || XamlResources.Count == 0)
- {
- base.OnParentResourcesChanged(values);
- return;
- }
-
- var innerKeys = new HashSet<string>();
- var changedResources = new List<KeyValuePair<string, object>>();
- foreach (KeyValuePair<string, object> c in XamlResources)
- innerKeys.Add(c.Key);
- foreach (KeyValuePair<string, object> value in values)
- {
- if (innerKeys.Add(value.Key))
- changedResources.Add(value);
- }
- OnResourcesChanged(changedResources);
- }
-
- internal event EventHandler PopCanceled;
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public void SendOnAppLinkRequestReceived(Uri uri)
- {
- OnAppLinkRequestReceived(uri);
- }
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public void SendResume()
- {
- s_current = this;
- OnResume();
- }
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public void SendSleep()
- {
- OnSleep();
- SavePropertiesAsFireAndForget();
- }
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public Task SendSleepAsync()
- {
- OnSleep();
- return SavePropertiesAsync();
- }
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public void SendStart()
- {
- OnStart();
- }
-
- async Task<IDictionary<string, object>> GetPropertiesAsync()
- {
- var deserializer = DependencyService.Get<IDeserializer>();
- if (deserializer == null)
- {
- Console.WriteLine("Startup", "No IDeserialzier was found registered");
- return new Dictionary<string, object>(4);
- }
-
- IDictionary<string, object> properties = await deserializer.DeserializePropertiesAsync().ConfigureAwait(false);
- if (properties == null)
- properties = new Dictionary<string, object>(4);
-
- return properties;
- }
-
- internal void OnPageAppearing(Page page)
- => PageAppearing?.Invoke(this, page);
-
- internal void OnPageDisappearing(Page page)
- => PageDisappearing?.Invoke(this, page);
-
- void OnModalPopped(Page modalPage)
- => ModalPopped?.Invoke(this, new ModalPoppedEventArgs(modalPage));
-
- bool OnModalPopping(Page modalPage)
- {
- var args = new ModalPoppingEventArgs(modalPage);
- ModalPopping?.Invoke(this, args);
- return args.Cancel;
- }
-
- void OnModalPushed(Page modalPage)
- => ModalPushed?.Invoke(this, new ModalPushedEventArgs(modalPage));
-
- void OnModalPushing(Page modalPage)
- => ModalPushing?.Invoke(this, new ModalPushingEventArgs(modalPage));
-
- void OnPopCanceled()
- => PopCanceled?.Invoke(this, EventArgs.Empty);
-
- async Task SetPropertiesAsync()
- {
- await SaveSemaphore.WaitAsync();
- try
- {
- await DependencyService.Get<IDeserializer>()?.SerializePropertiesAsync(Properties);
- }
- finally
- {
- SaveSemaphore.Release();
- }
-
- }
-
- class NavigationImpl : NavigationProxy
- {
- readonly Application _owner;
-
- public NavigationImpl(Application owner)
- {
- _owner = owner;
- }
-
- protected override async Task<Page> OnPopModal(bool animated)
- {
- Page modal = ModalStack[ModalStack.Count - 1];
- if (_owner.OnModalPopping(modal))
- {
- _owner.OnPopCanceled();
- return null;
- }
- Page result = await base.OnPopModal(animated);
- result.Parent = null;
- _owner.OnModalPopped(result);
- return result;
- }
-
- protected override async Task OnPushModal(Page modal, bool animated)
- {
- _owner.OnModalPushing(modal);
-
- modal.Parent = _owner;
-
- if (modal.NavigationProxy.ModalStack.Count == 0)
- {
- modal.NavigationProxy.Inner = this;
- await base.OnPushModal(modal, animated);
- }
- else
- {
- await base.OnPushModal(modal, animated);
- modal.NavigationProxy.Inner = this;
- }
-
- _owner.OnModalPushed(modal);
- }
- }
-
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
internal Application(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Application_SWIGUpcast(cPtr), cMemoryOwn)
{
- NavigationProxy = new NavigationImpl(this);
- SetCurrentApplication(this);
-
- _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<Application>>(() => new PlatformConfigurationRegistry<Application>(this));
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
-
- SendResume();
}
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Application obj)
{
Application ret = new Application(Interop.Application.Application_New__SWIG_3(argc, stylesheet, (int)windowMode), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- ret.SendResume();
return ret;
}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq.Expressions;
+using System.Reflection;
+using System.ComponentModel;
+
+namespace Tizen.NUI.Binding
+{
+ /// <summary>
+ /// A BindableProperty is a backing store for properties allowing bindings on BindableObject.
+ /// </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 sealed class BindableProperty
+ {
+ /// <summary>
+ /// Delegate for BindableProperty.PropertyChanged.
+ /// </summary>
+ /// <param name="bindable">The bindable object that contains the property.</param>
+ /// <param name="oldValue">The old property value.</param>
+ /// <param name="newValue">The new property value.</param>
+ public delegate void BindingPropertyChangedDelegate(BaseHandle bindable, object oldValue, object newValue);
+
+ /// <summary>
+ /// Delegate for BindableProperty.DefaultValueCreator.
+ /// </summary>
+ /// <param name="bindable">The bindable object that contains the property.</param>
+ /// <returns>System.Object</returns>
+ public delegate object CreateDefaultValueDelegate(BaseHandle bindable);
+
+ BindableProperty(string propertyName, Type returnType, Type declaringType, object defaultValue, BindingPropertyChangedDelegate propertyChanged, CreateDefaultValueDelegate defaultValueCreator)
+ {
+ PropertyName = propertyName;
+ ReturnType = returnType;
+ DeclaringType = declaringType;
+ DefaultValue = defaultValue;
+ PropertyChanged = propertyChanged;
+ DefaultValueCreator = defaultValueCreator;
+ }
+
+ /// <summary>
+ /// Gets the type declaring the BindableProperty.
+ /// </summary>
+ public Type DeclaringType { get; private set; }
+
+ /// <summary>
+ /// Gets the default value for the BindableProperty.
+ /// </summary>
+ public object DefaultValue { get; }
+
+ /// <summary>
+ /// Gets a value indicating if the BindableProperty is created form a BindablePropertyKey.
+ /// </summary>
+ public bool IsReadOnly { get; private set; }
+
+ /// <summary>
+ /// Gets the property name.
+ /// </summary>
+ public string PropertyName { get; }
+
+ /// <summary>
+ /// Gets the type of the BindableProperty.
+ /// </summary>
+ public Type ReturnType { get; }
+
+ internal CreateDefaultValueDelegate DefaultValueCreator { get; }
+
+ internal BindingPropertyChangedDelegate PropertyChanged { get; private set; }
+
+ /// <summary>
+ /// Creates a new instance of the BindableProperty class.
+ /// </summary>
+ /// <param name="propertyName">The name of the BindableProperty.</param>
+ /// <param name="returnType">The type of the property.</param>
+ /// <param name="declaringType">The type of the declaring object.</param>
+ /// <param name="defaultValue">The default value for the property.</param>
+ /// <param name="propertyChanged">A delegate to be run when the value has changed. This parameter is optional. Default is null.</param>
+ /// <param name="defaultValueCreator">A Func used to initialize default value for reference types.</param>
+ /// <returns>A newly created BindableProperty.</returns>
+ public static BindableProperty Create(string propertyName, Type returnType, Type declaringType, object defaultValue = null,
+ BindingPropertyChangedDelegate propertyChanged = null,
+ CreateDefaultValueDelegate defaultValueCreator = null)
+ {
+ return new BindableProperty(propertyName, returnType, declaringType, defaultValue, propertyChanged:propertyChanged, defaultValueCreator: defaultValueCreator);
+ }
+
+ }
+}
+++ /dev/null
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using System.Xml;
-using Tizen.NUI.Binding.Internals;
-using Tizen.NUI.Binding;
-using Tizen.NUI.StyleSheets;
-
-using static System.String;
-
-namespace Tizen.NUI.Xaml
-{
- internal class ApplyPropertiesVisitor : IXamlNodeVisitor
- {
- public static readonly IList<XmlName> Skips = new List<XmlName> {
- XmlName.xKey,
- XmlName.xTypeArguments,
- XmlName.xArguments,
- XmlName.xFactoryMethod,
- XmlName.xName,
- XmlName.xDataType
- };
-
- public ApplyPropertiesVisitor(HydrationContext context, bool stopOnResourceDictionary = false)
- {
- Context = context;
- StopOnResourceDictionary = stopOnResourceDictionary;
- }
-
- Dictionary<INode, object> Values => Context.Values;
- HydrationContext Context { get; }
-
- public TreeVisitingMode VisitingMode => TreeVisitingMode.BottomUp;
- public bool StopOnDataTemplate => true;
- 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)
- {
- var parentElement = parentNode as IElementNode;
- var value = Values [node];
- var source = Values [parentNode];
- XmlName propertyName;
-
- if (TryGetPropertyName(node, parentNode, out propertyName)) {
- if (TrySetRuntimeName(propertyName, source, value, node))
- return;
- if (Skips.Contains(propertyName))
- return;
- if (parentElement.SkipProperties.Contains(propertyName))
- return;
- if (propertyName.Equals(XamlParser.McUri, "Ignorable"))
- return;
- SetPropertyValue(source, propertyName, value, Context.RootElement, node, Context, node);
- } else if (IsCollectionItem(node, parentNode) && parentNode is IElementNode) {
- // Collection element, implicit content, or implicit collection element.
- var contentProperty = GetContentPropertyName(Context.Types[parentElement].GetTypeInfo());
- if (contentProperty != null) {
- var name = new XmlName(((ElementNode)parentNode).NamespaceURI, contentProperty);
- if (Skips.Contains(name))
- return;
- if (parentElement.SkipProperties.Contains(propertyName))
- return;
- SetPropertyValue(source, name, value, Context.RootElement, node, Context, node);
- }
- }
- }
-
- public void Visit(MarkupNode node, INode parentNode)
- {
- }
-
- public void Visit(ElementNode node, INode parentNode)
- {
- XmlName propertyName;
- if (TryGetPropertyName(node, parentNode, out propertyName) && propertyName == XmlName._CreateContent) {
- var s0 = Values[parentNode];
- if (s0 is ElementTemplate) {
- SetTemplate(s0 as ElementTemplate, node);
- return;
- }
- }
-
- var parentElement = parentNode as IElementNode;
- propertyName = XmlName.Empty;
-
- //Simplify ListNodes with single elements
- var pList = parentNode as ListNode;
- if (pList != null && pList.CollectionItems.Count == 1) {
- propertyName = pList.XmlName;
- parentNode = parentNode.Parent;
- parentElement = parentNode as IElementNode;
- }
-
- var value = Values[node];
-
- if (propertyName != XmlName.Empty || TryGetPropertyName(node, parentNode, out propertyName)) {
- if (Skips.Contains(propertyName))
- return;
- if (parentElement == null)
- return;
- if (parentElement.SkipProperties.Contains(propertyName))
- return;
-
- var source = Values[parentNode];
- ProvideValue(ref value, node, source, propertyName);
- SetPropertyValue(source, propertyName, value, Context.RootElement, node, Context, node);
- }
- else if (IsCollectionItem(node, parentNode) && parentNode is IElementNode) {
- var source = Values[parentNode];
- ProvideValue(ref value, node, source, XmlName.Empty);
- string contentProperty;
- Exception xpe = null;
- var xKey = node.Properties.ContainsKey(XmlName.xKey) ? ((ValueNode)node.Properties[XmlName.xKey]).Value as string : null;
-
- //ResourceDictionary
- if (xpe == null && TryAddToResourceDictionary(source as ResourceDictionary, value, xKey, node, out xpe))
- return;
-
- // Collection element, implicit content, or implicit collection element.
- if (xpe == null && typeof(IEnumerable).IsAssignableFrom(Context.Types[parentElement]) && Context.Types[parentElement].GetRuntimeMethods().Any(mi => mi.Name == "Add" && mi.GetParameters().Length == 1)) {
- var addMethod =
- Context.Types[parentElement].GetRuntimeMethods().First(mi => mi.Name == "Add" && mi.GetParameters().Length == 1);
-
- addMethod?.Invoke(source, new[] { value });
- return;
- }
- if (xpe == null && (contentProperty = GetContentPropertyName(Context.Types[parentElement].GetTypeInfo())) != null) {
- var name = new XmlName(node.NamespaceURI, contentProperty);
- if (Skips.Contains(name))
- return;
- if (parentElement.SkipProperties.Contains(propertyName))
- return;
-
- SetPropertyValue(source, name, value, Context.RootElement, node, Context, node);
- return;
- }
- if (xpe == null && Context.Types[parentElement].GetRuntimeMethods().Any(mi => mi.Name == "Add" && mi.GetParameters().Length == 1))
- {
- //if there are similar parameters in the function, this will exist issue.
- var addMethod = Context.Types[parentElement].GetRuntimeMethods().First(mi => mi.Name == "Add" && mi.GetParameters().Length == 1);
- if(addMethod != null) addMethod.Invoke(source, new[] { value });
- return;
- }
- xpe = xpe ?? new XamlParseException($"Can not set the content of {((IElementNode)parentNode).XmlType.Name} as it doesn't have a ContentPropertyAttribute", node);
- if (Context.ExceptionHandler != null)
- Context.ExceptionHandler(xpe);
- throw xpe;
- }
- else if (IsCollectionItem(node, parentNode) && parentNode is ListNode) {
- var source = Values[parentNode.Parent];
- ProvideValue(ref value, node, source, XmlName.Empty);
- var parentList = (ListNode)parentNode;
- if (Skips.Contains(parentList.XmlName))
- return;
- Exception xpe = null;
- var xKey = node.Properties.ContainsKey(XmlName.xKey) ? ((ValueNode)node.Properties[XmlName.xKey]).Value as string : null;
-
- object _;
- var collection = GetPropertyValue(source, parentList.XmlName, Context, parentList, out _) as IEnumerable;
- if (collection == null)
- xpe = new XamlParseException($"Property {parentList.XmlName.LocalName} is null or is not IEnumerable", node);
-
- if (xpe == null && TryAddToResourceDictionary(collection as ResourceDictionary, value, xKey, node, out xpe))
- return;
-
- MethodInfo addMethod;
- if (xpe == null && (addMethod = collection.GetType().GetRuntimeMethods().First(mi => mi.Name == "Add" && mi.GetParameters().Length == 1)) != null) {
- addMethod.Invoke(collection, new[] { Values[node] });
- return;
- }
- xpe = xpe ?? new XamlParseException($"Value of {parentList.XmlName.LocalName} does not have a Add() method", node);
- if (Context.ExceptionHandler != null)
- Context.ExceptionHandler(xpe);
- else
- throw xpe;
- }
- }
-
-
-
- public void Visit(RootNode node, INode parentNode)
- {
- }
-
- public void Visit(ListNode node, INode parentNode)
- {
- }
-
- public static bool TryGetPropertyName(INode node, INode parentNode, out XmlName name)
- {
- name = default(XmlName);
- var parentElement = parentNode as IElementNode;
- if (parentElement == null)
- return false;
- foreach (var kvp in parentElement.Properties) {
- if (kvp.Value != node)
- continue;
- name = kvp.Key;
- return true;
- }
- return false;
- }
-
- internal static bool IsCollectionItem(INode node, INode parentNode)
- {
- var parentList = parentNode as IListNode;
- if (parentList == null)
- return false;
- return parentList.CollectionItems.Contains(node);
- }
-
- internal static string GetContentPropertyName(System.Reflection.TypeInfo typeInfo)
- {
- while (typeInfo != null) {
- var propName = GetContentPropertyName(typeInfo.CustomAttributes);
- if (propName != null)
- return propName;
- typeInfo = typeInfo?.BaseType?.GetTypeInfo();
- }
- return null;
- }
-
- void ProvideValue(ref object value, ElementNode node, object source, XmlName propertyName)
- {
- var markupExtension = value as IMarkupExtension;
- var valueProvider = value as IValueProvider;
-
- if (markupExtension == null && valueProvider == null)
- return;
-
- XamlServiceProvider serviceProvider = null;
- if (value.GetType().GetTypeInfo().GetCustomAttribute<AcceptEmptyServiceProviderAttribute>() == null)
- serviceProvider = new XamlServiceProvider(node, Context);
-
- if (serviceProvider != null && serviceProvider.IProvideValueTarget != null && propertyName != XmlName.Empty) {
- ((XamlValueTargetProvider)serviceProvider.IProvideValueTarget).TargetProperty = GetTargetProperty(source, propertyName, Context, node);
- }
-
- if (markupExtension != null)
- value = markupExtension.ProvideValue(serviceProvider);
- else if (valueProvider != null)
- value = valueProvider.ProvideValue(serviceProvider);
- }
-
- static string GetContentPropertyName(IEnumerable<CustomAttributeData> attributes)
- {
- var contentAttribute =
- attributes.FirstOrDefault(cad => ContentPropertyAttribute.ContentPropertyTypes.Contains(cad.AttributeType.FullName));
- if (contentAttribute == null || contentAttribute.ConstructorArguments.Count != 1)
- return null;
- if (contentAttribute.ConstructorArguments [0].ArgumentType == typeof(string))
- return (string)contentAttribute.ConstructorArguments [0].Value;
- return null;
- }
-
- static bool GetRealNameAndType(ref Type elementType, string namespaceURI, ref string localname,
- HydrationContext context, IXmlLineInfo lineInfo)
- {
- var dotIdx = localname.IndexOf('.');
- if (dotIdx > 0) {
- var typename = localname.Substring(0, dotIdx);
- localname = localname.Substring(dotIdx + 1);
- XamlParseException xpe;
- elementType = XamlParser.GetElementType(new XmlType(namespaceURI, typename, null), lineInfo,
- context.RootElement.GetType().GetTypeInfo().Assembly, out xpe);
-
- if (xpe != null)
- throw xpe;
- return true;
- }
- return false;
- }
-
- static BindableProperty GetBindableProperty(Type elementType, string localName, IXmlLineInfo lineInfo,
- bool throwOnError = false)
- {
-#if NETSTANDARD1_0
- var bindableFieldInfo = elementType.GetFields().FirstOrDefault(fi => fi.Name == localName + "Property");
-#else
- 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) {
- exception =
- new XamlParseException(
- Format("BindableProperty {0} not found on {1}", localName + "Property", elementType.Name), lineInfo);
- }
-
- if (exception == null)
- return bindableFieldInfo.GetValue(null) as BindableProperty;
- if (throwOnError)
- throw exception;
- return null;
- }
-
- static object GetTargetProperty(object xamlelement, XmlName propertyName, HydrationContext context, IXmlLineInfo lineInfo)
- {
- var localName = propertyName.LocalName;
- //If it's an attached BP, update elementType and propertyName
- var bpOwnerType = xamlelement.GetType();
- GetRealNameAndType(ref bpOwnerType, propertyName.NamespaceURI, ref localName, context, lineInfo);
- var property = GetBindableProperty(bpOwnerType, localName, lineInfo, false);
-
- if (property != null)
- return property;
-
- var elementType = xamlelement.GetType();
- var propertyInfo = elementType.GetRuntimeProperties().FirstOrDefault(p => p.Name == localName);
- return propertyInfo;
- }
-
- public static void SetPropertyValue(object xamlelement, XmlName propertyName, object value, object rootElement, INode node, HydrationContext context, IXmlLineInfo lineInfo)
- {
- var localName = propertyName.LocalName;
- var serviceProvider = new XamlServiceProvider(node, context);
- Exception xpe = null;
- var xKey = node is IElementNode && ((IElementNode)node).Properties.ContainsKey(XmlName.xKey) ? ((ValueNode)((IElementNode)node).Properties[XmlName.xKey]).Value as string : null;
-
- //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
- if (xpe == null && TryConnectEvent(xamlelement, localName, attached, value, rootElement, lineInfo, out xpe))
- return;
-
- //If Value is DynamicResource and it's a BP, SetDynamicResource
- if (xpe == null && TrySetDynamicResource(xamlelement, property, value, lineInfo, out xpe))
- return;
-
- //If value is BindingBase, SetBinding
- if (xpe == null && TrySetBinding(xamlelement, property, localName, value, lineInfo, out xpe))
- return;
-
- //If it's a BindableProberty, SetValue
- if (xpe == null && TrySetValue(xamlelement, property, attached, value, lineInfo, serviceProvider, out xpe))
- return;
-
- //If we can assign that value to a normal property, let's do it
- if (xpe == null && TrySetProperty(xamlelement, localName, value, lineInfo, serviceProvider, context, out xpe))
- return;
-
- //If it's an already initialized property, add to it
- if (xpe == null && TryAddToProperty(xamlelement, propertyName, value, xKey, lineInfo, serviceProvider, context, out xpe))
- return;
-
- xpe = xpe ?? new XamlParseException($"Cannot assign property \"{localName}\": Property does not exist, or is not assignable, or mismatching type between value and property", lineInfo);
- if (context.ExceptionHandler != null)
- context.ExceptionHandler(xpe);
- else
- throw xpe;
- }
-
- public static object GetPropertyValue(object xamlElement, XmlName propertyName, HydrationContext context, IXmlLineInfo lineInfo, out object targetProperty)
- {
- var localName = propertyName.LocalName;
- Exception xpe = null;
- object value;
- targetProperty = null;
-
- //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 it's a BindableProberty, GetValue
- if (xpe == null && TryGetValue(xamlElement, property, attached, out value, lineInfo, out xpe, out targetProperty))
- return value;
-
- //If it's a normal property, get it
- if (xpe == null && TryGetProperty(xamlElement, localName, out value, lineInfo, context, out xpe, out targetProperty))
- return value;
-
- xpe = xpe ?? new XamlParseException($"Property {localName} is not found or does not have an accessible getter", lineInfo);
- if (context.ExceptionHandler != null)
- context.ExceptionHandler(xpe);
- else
- throw xpe;
-
- return null;
- }
-
- static bool TryConnectEvent(object element, string localName, bool attached, object value, object rootElement, IXmlLineInfo lineInfo, out Exception exception)
- {
- exception = null;
-
- if (attached)
- return false;
-
- var elementType = element.GetType();
- var eventInfo = elementType.GetRuntimeEvent(localName);
- var stringValue = value as string;
-
- if (eventInfo == null || IsNullOrEmpty(stringValue))
- return false;
-
- var methodInfo = rootElement.GetType().GetRuntimeMethods().FirstOrDefault(mi => mi.Name == (string)value);
- if (methodInfo == null) {
- exception = new XamlParseException($"No method {value} found on type {rootElement.GetType()}", lineInfo);
- return false;
- }
-
- try {
- eventInfo.AddEventHandler(element, methodInfo.CreateDelegate(eventInfo.EventHandlerType, rootElement));
- return true;
- } catch (ArgumentException ae) {
- exception = new XamlParseException($"Method {stringValue} does not have the correct signature", lineInfo, ae);
- }
- return false;
- }
-
- static bool TrySetDynamicResource(object element, BindableProperty property, object value, IXmlLineInfo lineInfo, out Exception exception)
- {
- exception = null;
-
- var elementType = element.GetType();
- var dynamicResource = value as DynamicResource;
- var bindable = element as BindableObject;
-
- if (dynamicResource == null || property == null)
- return false;
-
- if (bindable == null) {
- exception = new XamlParseException($"{elementType.Name} is not a BindableObject", lineInfo);
- return false;
- }
-
- bindable.SetDynamicResource(property, dynamicResource.Key);
- return true;
- }
-
- static bool TrySetBinding(object element, BindableProperty property, string localName, object value, IXmlLineInfo lineInfo, out Exception exception)
- {
- exception = null;
-
- var elementType = element.GetType();
- var binding = value.ConvertTo(typeof(BindingBase),pinfoRetriever:null,serviceProvider:null) as BindingBase;
- var bindable = element as BindableObject;
- var nativeBindingService = DependencyService.Get<INativeBindingService>();
-
- if (binding == null)
- return false;
-
- if (bindable != null && property != null) {
- bindable.SetBinding(property, binding);
- return true;
- }
-
- if (nativeBindingService != null && property != null && nativeBindingService.TrySetBinding(element, property, binding))
- return true;
-
- if (nativeBindingService != null && nativeBindingService.TrySetBinding(element, localName, binding))
- return true;
-
- if (property != null)
- exception = new XamlParseException($"{elementType.Name} is not a BindableObject or does not support native bindings", lineInfo);
-
- return false;
- }
-
- static bool TrySetValue(object element, BindableProperty property, bool attached, object value, IXmlLineInfo lineInfo, XamlServiceProvider serviceProvider, out Exception exception)
- {
- exception = null;
-
- var elementType = element.GetType();
- var bindable = element as BindableObject;
- var nativeBindingService = DependencyService.Get<INativeBindingService>();
-
- if (property == null)
- return false;
-
- if (serviceProvider != null && serviceProvider.IProvideValueTarget != null)
- ((XamlValueTargetProvider)serviceProvider.IProvideValueTarget).TargetProperty = property;
-
- Func<MemberInfo> minforetriever;
- if (attached)
- minforetriever = () => property.DeclaringType.GetRuntimeMethod("Get" + property.PropertyName, new [] { typeof(BindableObject) });
- else
- {
- minforetriever = () => property.DeclaringType.GetRuntimeProperties().LastOrDefault(p => p.Name == property.PropertyName);
- }
- //minforetriever = () => property.DeclaringType.GetRuntimeProperty(property.PropertyName);
- var convertedValue = value.ConvertTo(property.ReturnType, minforetriever, serviceProvider);
-
- if (bindable != null) {
- //SetValue doesn't throw on mismatching type, so check before to get a chance to try the property setting or the collection adding
- var nullable = property.ReturnTypeInfo.IsGenericType &&
- property.ReturnTypeInfo.GetGenericTypeDefinition() == typeof(Nullable<>);
- if ((convertedValue == null && (!property.ReturnTypeInfo.IsValueType || nullable)) ||
- (property.ReturnType.IsInstanceOfType(convertedValue))) {
- bindable.SetValue(property, convertedValue);
- return true;
- }
-
- // This might be a collection; see if we can add to it
- return TryAddValue(bindable, property, value, serviceProvider);
- }
-
- if (nativeBindingService != null && nativeBindingService.TrySetValue(element, property, convertedValue))
- return true;
-
- exception = new XamlParseException($"{elementType.Name} is not a BindableObject or does not support setting native BindableProperties", lineInfo);
- return false;
- }
-
- static bool TryGetValue(object element, BindableProperty property, bool attached, out object value, IXmlLineInfo lineInfo, out Exception exception, out object targetProperty)
- {
- exception = null;
- value = null;
- targetProperty = property;
- var elementType = element.GetType();
- var bindable = element as BindableObject;
-
- if (property == null)
- return false;
-
- if (bindable == null)
- return false;
-
- value = bindable.GetValue(property);
- return true;
- }
-
- static bool TrySetProperty(object element, string localName, object value, IXmlLineInfo lineInfo, XamlServiceProvider serviceProvider, HydrationContext context, out Exception exception)
- {
- exception = null;
-
- var elementType = element.GetType();
- var propertyInfo = elementType.GetRuntimeProperties().FirstOrDefault(p => p.Name == localName);
- MethodInfo setter;
- if (propertyInfo == null || !propertyInfo.CanWrite || (setter = propertyInfo.SetMethod) == null)
- return false;
-
- if (!IsVisibleFrom(setter, context.RootElement))
- return false;
-
- if (serviceProvider != null && serviceProvider.IProvideValueTarget != null)
- ((XamlValueTargetProvider)serviceProvider.IProvideValueTarget).TargetProperty = propertyInfo;
-
- object convertedValue = value.ConvertTo(propertyInfo.PropertyType, () => propertyInfo, serviceProvider);
- if (convertedValue != null && !propertyInfo.PropertyType.IsInstanceOfType(convertedValue))
- return false;
-
- setter.Invoke(element, new object [] { convertedValue });
- return true;
- }
-
- static bool TryGetProperty(object element, string localName, out object value, IXmlLineInfo lineInfo, HydrationContext context, out Exception exception, out object targetProperty)
- {
- exception = null;
- value = null;
- var elementType = element.GetType();
- PropertyInfo propertyInfo = null;
- try {
- propertyInfo = elementType.GetRuntimeProperty(localName);
- } catch (AmbiguousMatchException) {
- // Get most derived instance of property
- foreach (var property in elementType.GetRuntimeProperties().Where(prop => prop.Name == localName)) {
- if (propertyInfo == null || propertyInfo.DeclaringType.IsAssignableFrom(property.DeclaringType))
- propertyInfo = property;
- }
- }
- MethodInfo getter;
- targetProperty = propertyInfo;
- if (propertyInfo == null || !propertyInfo.CanRead || (getter = propertyInfo.GetMethod) == null)
- return false;
-
- if (!IsVisibleFrom(getter, context.RootElement))
- return false;
-
- value = getter.Invoke(element, new object[] { });
- return true;
- }
-
- static bool IsVisibleFrom(MethodInfo method, object rootElement)
- {
- if (method.IsPublic)
- return true;
- if (method.IsPrivate && method.DeclaringType == rootElement.GetType())
- return true;
- if ((method.IsAssembly || method.IsFamilyOrAssembly) && method.DeclaringType.AssemblyQualifiedName == rootElement.GetType().AssemblyQualifiedName)
- return true;
- if (method.IsFamily && method.DeclaringType.IsAssignableFrom(rootElement.GetType()))
- return true;
- return false;
- }
-
- static bool TryAddToProperty(object element, XmlName propertyName, object value, string xKey, IXmlLineInfo lineInfo, XamlServiceProvider serviceProvider, HydrationContext context, out Exception exception)
- {
- exception = null;
-
- object targetProperty;
- var collection = GetPropertyValue(element, propertyName, context, lineInfo, out targetProperty) as IEnumerable;
-
- if (collection == null)
- return false;
-
- if (exception == null && TryAddToResourceDictionary(collection as ResourceDictionary, value, xKey, lineInfo, out exception))
- return true;
-
- if (exception != null)
- return false;
-
- var addMethod = collection.GetType().GetRuntimeMethods().First(mi => mi.Name == "Add" && mi.GetParameters().Length == 1);
- if (addMethod == null)
- return false;
-
- if (serviceProvider != null && serviceProvider.IProvideValueTarget != null)
- ((XamlValueTargetProvider)serviceProvider.IProvideValueTarget).TargetProperty = targetProperty;
-
- addMethod.Invoke(collection, new [] { value.ConvertTo(addMethod.GetParameters() [0].ParameterType, (Func<TypeConverter>)null, serviceProvider) });
- return true;
- }
-
- static bool TryAddToResourceDictionary(ResourceDictionary resourceDictionary, object value, string xKey, IXmlLineInfo lineInfo, out Exception exception)
- {
- exception = null;
-
- if (resourceDictionary == null)
- return false;
-
- if (xKey != null)
- resourceDictionary.Add(xKey, value);
- else if (value is Tizen.NUI.Binding.Style)
- resourceDictionary.Add((Tizen.NUI.Binding.Style)value);
- else if (value is ResourceDictionary)
- resourceDictionary.Add((ResourceDictionary)value);
- else if (value is StyleSheets.StyleSheet)
- resourceDictionary.Add((StyleSheets.StyleSheet)value);
- else {
- exception = new XamlParseException("resources in ResourceDictionary require a x:Key attribute", lineInfo);
- return false;
- }
- return true;
- }
-
- void SetTemplate(ElementTemplate dt, INode node)
- {
-#pragma warning disable 0612
- ((IDataTemplate)dt).LoadTemplate = () => {
-#pragma warning restore 0612
- var cnode = node.Clone();
- var context = new HydrationContext { ParentContext = Context, RootElement = Context.RootElement };
- cnode.Accept(new XamlNodeVisitor((n, parent) => n.Parent = parent), node.Parent); //set parents for {StaticResource}
- cnode.Accept(new ExpandMarkupsVisitor(context), null);
- cnode.Accept(new NamescopingVisitor(context), null);
- cnode.Accept(new CreateValuesVisitor(context), null);
- cnode.Accept(new RegisterXNamesVisitor(context), null);
- cnode.Accept(new FillResourceDictionariesVisitor(context), null);
- cnode.Accept(new ApplyPropertiesVisitor(context, true), null);
- return context.Values [cnode];
- };
- }
-
- static bool TryAddValue(BindableObject bindable, BindableProperty property, object value, XamlServiceProvider serviceProvider)
- {
- if(property?.ReturnTypeInfo?.GenericTypeArguments == null){
- return false;
- }
-
- if(property.ReturnType == null){
- return false;
- }
-
- if (property.ReturnTypeInfo.GenericTypeArguments.Length != 1 ||
- !property.ReturnTypeInfo.GenericTypeArguments[0].IsInstanceOfType(value))
- return false;
-
- // This might be a collection we can add to; see if we can find an Add method
- var addMethod = GetAllRuntimeMethods(property.ReturnType)
- .FirstOrDefault(mi => mi.Name == "Add" && mi.GetParameters().Length == 1);
- if (addMethod == null)
- return false;
-
- // If there's an add method, get the collection
- var collection = bindable.GetValue(property);
-
- // And add the new value to it
- addMethod.Invoke(collection, new[] { value.ConvertTo(addMethod.GetParameters()[0].ParameterType, (Func<TypeConverter>)null, serviceProvider) });
- return true;
- }
-
- static IEnumerable<MethodInfo> GetAllRuntimeMethods(Type type)
- {
- return type.GetRuntimeMethods()
- .Concat(type.GetTypeInfo().ImplementedInterfaces.SelectMany(t => t.GetRuntimeMethods()));
- }
-
- bool TrySetRuntimeName(XmlName propertyName, object source, object value, ValueNode node)
- {
- if (propertyName != XmlName.xName)
- return false;
-
- var runTimeName = source.GetType().GetTypeInfo().GetCustomAttribute<RuntimeNamePropertyAttribute>();
- if (runTimeName == null)
- return false;
-
- SetPropertyValue(source, new XmlName("", runTimeName.Name), value, Context.RootElement, node, Context, node);
- return true;
- }
- }
-}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Reflection;
-using System.Xml;
-using Tizen.NUI.Binding.Internals;
-using Tizen.NUI.Binding;
-
-
-namespace Tizen.NUI.Xaml
-{
- internal class CreateValuesVisitor : IXamlNodeVisitor
- {
- public CreateValuesVisitor(HydrationContext context)
- {
- Context = context;
- }
-
- Dictionary<INode, object> Values
- {
- get { return Context.Values; }
- }
-
- HydrationContext Context { get; }
-
- public TreeVisitingMode VisitingMode => TreeVisitingMode.BottomUp;
- 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)
- {
- Values[node] = node.Value;
- }
-
- public void Visit(MarkupNode node, INode parentNode)
- {
- }
-
- public void Visit(ElementNode node, INode parentNode)
- {
- object value = null;
-
- XamlParseException xpe;
- var type = XamlParser.GetElementType(node.XmlType, node, Context.RootElement?.GetType().GetTypeInfo().Assembly,
- out xpe);
- if (xpe != null)
- throw xpe;
-
- Context.Types[node] = type;
- string ctorargname;
- if (IsXaml2009LanguagePrimitive(node))
- value = CreateLanguagePrimitive(type, node);
- else if (node.Properties.ContainsKey(XmlName.xArguments) || node.Properties.ContainsKey(XmlName.xFactoryMethod))
- value = CreateFromFactory(type, node);
- else if (
- type.GetTypeInfo()
- .DeclaredConstructors.Any(
- ci =>
- ci.IsPublic && ci.GetParameters().Length != 0 &&
- ci.GetParameters().All(pi => pi.CustomAttributes.Any(attr => attr.AttributeType == typeof (ParameterAttribute)))) &&
- ValidateCtorArguments(type, node, out ctorargname))
- value = CreateFromParameterizedConstructor(type, node);
- else if (!type.GetTypeInfo().DeclaredConstructors.Any(ci => ci.IsPublic && ci.GetParameters().Length == 0) &&
- !ValidateCtorArguments(type, node, out ctorargname))
- {
- throw new XamlParseException($"The Property {ctorargname} is required to create a {type?.FullName} object.", node);
- }
- else
- {
- //this is a trick as the DataTemplate parameterless ctor is internal, and we can't CreateInstance(..., false) on WP7
- try
- {
- if (type == typeof (DataTemplate))
- value = new DataTemplate();
- if (type == typeof (ControlTemplate))
- value = new ControlTemplate();
- if (value == null && node.CollectionItems.Any() && node.CollectionItems.First() is ValueNode)
- {
- var serviceProvider = new XamlServiceProvider(node, Context);
- var converted = ((ValueNode)node.CollectionItems.First()).Value.ConvertTo(type, () => type.GetTypeInfo(),
- serviceProvider);
- if (converted != null && converted.GetType() == type)
- value = converted;
- }
- if (value == null)
- {
- value = Activator.CreateInstance(type);
- if (value is Element)
- {
- if (null != Application.Current)
- {
- Application.AddResourceChangedCallback(value, (value as Element).OnResourcesChanged);
- }
-
- if (value is BindableObject)
- {
- ((BindableObject)value).IsCreateByXaml = true;
- }
- }
- }
- }
- catch (TargetInvocationException e)
- {
- if (e.InnerException is XamlParseException || e.InnerException is XmlException)
- throw e.InnerException;
- throw;
- }
- }
-
- Values[node] = value;
-
- var markup = value as IMarkupExtension;
- if (markup != null && (value is TypeExtension || value is StaticExtension || value is ArrayExtension))
- {
- var serviceProvider = new XamlServiceProvider(node, Context);
-
- var visitor = new ApplyPropertiesVisitor(Context);
- foreach (var cnode in node.Properties.Values.ToList())
- cnode.Accept(visitor, node);
- foreach (var cnode in node.CollectionItems)
- cnode.Accept(visitor, node);
-
- value = markup.ProvideValue(serviceProvider);
-
- INode xKey;
- if (!node.Properties.TryGetValue(XmlName.xKey, out xKey))
- xKey = null;
-
- node.Properties.Clear();
- node.CollectionItems.Clear();
-
- if (xKey != null)
- node.Properties.Add(XmlName.xKey, xKey);
-
- Values[node] = value;
- }
-
- if (value is BindableObject)
- NameScope.SetNameScope(value as BindableObject, node.Namescope);
- }
-
- public void Visit(RootNode node, INode parentNode)
- {
- var rnode = (XamlLoader.RuntimeRootNode)node;
- Values[node] = rnode.Root;
- Context.Types[node] = rnode.Root.GetType();
- var bindableRoot = rnode.Root as BindableObject;
- if (bindableRoot != null)
- NameScope.SetNameScope(bindableRoot, node.Namescope);
- }
-
- public void Visit(ListNode node, INode parentNode)
- {
- //this is a gross hack to keep ListNode alive. ListNode must go in favor of Properties
- XmlName name;
- if (ApplyPropertiesVisitor.TryGetPropertyName(node, parentNode, out name))
- node.XmlName = name;
- }
-
- bool ValidateCtorArguments(Type nodeType, IElementNode node, out string missingArgName)
- {
- missingArgName = null;
- var ctorInfo =
- nodeType.GetTypeInfo()
- .DeclaredConstructors.FirstOrDefault(
- ci =>
- ci.GetParameters().Length != 0 && ci.IsPublic &&
- ci.GetParameters().All(pi => pi.CustomAttributes.Any(attr => attr.AttributeType == typeof (ParameterAttribute))));
- if (ctorInfo == null)
- return true;
- foreach (var parameter in ctorInfo.GetParameters())
- {
- // Modify the namespace
- var propname =
- parameter.CustomAttributes.First(ca => ca.AttributeType.FullName == "Tizen.NUI.Binding.ParameterAttribute")?
- .ConstructorArguments.First()
- .Value as string;
- if (!node.Properties.ContainsKey(new XmlName("", propname)))
- {
- missingArgName = propname;
- return false;
- }
- }
-
- return true;
- }
-
- public object CreateFromParameterizedConstructor(Type nodeType, IElementNode node)
- {
- var ctorInfo =
- nodeType.GetTypeInfo()
- .DeclaredConstructors.FirstOrDefault(
- ci =>
- ci.GetParameters().Length != 0 && ci.IsPublic &&
- ci.GetParameters().All(pi => pi.CustomAttributes.Any(attr => attr.AttributeType == typeof (ParameterAttribute))));
- object[] arguments = CreateArgumentsArray(node, ctorInfo);
-
- if (arguments != null)
- {
- return ctorInfo?.Invoke(arguments);
- }
- else
- {
- return null;
- }
- }
-
- public object CreateFromFactory(Type nodeType, IElementNode node)
- {
- object[] arguments = CreateArgumentsArray(node);
-
- if (!node.Properties.ContainsKey(XmlName.xFactoryMethod))
- {
- //non-default ctor
- object ret = Activator.CreateInstance(nodeType, arguments);
- if (ret is Element)
- {
- if (null != Application.Current)
- {
- Application.AddResourceChangedCallback(ret, (ret as Element).OnResourcesChanged);
- }
-
- if (ret is BindableObject)
- {
- ((BindableObject)ret).IsCreateByXaml = true;
- }
- }
- return ret;
- }
-
- var factoryMethod = ((string)((ValueNode)node.Properties[XmlName.xFactoryMethod]).Value);
- Type[] types = arguments == null ? new Type[0] : arguments.Select(a => a.GetType()).ToArray();
- Func<MethodInfo, bool> isMatch = m => {
- if (m.Name != factoryMethod)
- return false;
- var p = m.GetParameters();
- if (p.Length != types.Length)
- return false;
- if (!m.IsStatic)
- return false;
- for (var i = 0; i < p.Length; i++) {
- if ((p [i].ParameterType.IsAssignableFrom(types [i])))
- continue;
- var op_impl = p[i].ParameterType.GetImplicitConversionOperator(fromType: types[i], toType: p[i].ParameterType)
- ?? types[i].GetImplicitConversionOperator(fromType: types[i], toType: p[i].ParameterType);
-
- if (op_impl == null)
- return false;
- arguments [i] = op_impl.Invoke(null, new [] { arguments [i]});
- }
- return true;
- };
- var mi = nodeType.GetRuntimeMethods().FirstOrDefault(isMatch);
- if (mi == null)
- throw new MissingMemberException($"No static method found for {nodeType.FullName}::{factoryMethod} ({string.Join(", ", types.Select(t => t.FullName))})");
- return mi.Invoke(null, arguments);
- }
-
- public object[] CreateArgumentsArray(IElementNode enode)
- {
- if (!enode.Properties.ContainsKey(XmlName.xArguments))
- return null;
- var node = enode.Properties[XmlName.xArguments];
- var elementNode = node as ElementNode;
- if (elementNode != null)
- {
- var array = new object[1];
- array[0] = Values[elementNode];
- return array;
- }
-
- var listnode = node as ListNode;
- if (listnode != null)
- {
- var array = new object[listnode.CollectionItems.Count];
- for (var i = 0; i < listnode.CollectionItems.Count; i++)
- array[i] = Values[(ElementNode)listnode.CollectionItems[i]];
- return array;
- }
- return null;
- }
-
- public object[] CreateArgumentsArray(IElementNode enode, ConstructorInfo ctorInfo)
- {
- if( ctorInfo != null )
- {
- var n = ctorInfo.GetParameters().Length;
- var array = new object[n];
- for (var i = 0; i < n; i++)
- {
- var parameter = ctorInfo.GetParameters()[i];
- var propname =
- parameter?.CustomAttributes?.First(attr => attr.AttributeType == typeof (ParameterAttribute))?
- .ConstructorArguments.First()
- .Value as string;
- var name = new XmlName("", propname);
- INode node;
- if (!enode.Properties.TryGetValue(name, out node))
- {
- String msg = "";
- if (propname != null)
- {
- msg = String.Format("The Property {0} is required to create a {1} object.", propname, ctorInfo.DeclaringType.FullName);
- }
- else
- {
- msg = "propname is null.";
- }
- throw new XamlParseException(msg, enode as IXmlLineInfo);
- }
- if (!enode.SkipProperties.Contains(name))
- enode.SkipProperties.Add(name);
- var value = Context.Values[node];
- var serviceProvider = new XamlServiceProvider(enode, Context);
- var convertedValue = value?.ConvertTo(parameter?.ParameterType, () => parameter, serviceProvider);
- array[i] = convertedValue;
- }
- return array;
- }
-
- return null;
- }
-
- static bool IsXaml2009LanguagePrimitive(IElementNode node)
- {
- return node.NamespaceURI == XamlParser.X2009Uri;
- }
-
- static object CreateLanguagePrimitive(Type nodeType, IElementNode node)
- {
- object value = null;
- if (nodeType == typeof(string))
- value = String.Empty;
- else if (nodeType == typeof(Uri))
- value = null;
- else
- {
- value = Activator.CreateInstance(nodeType);
- if (value is Element)
- {
- if (null != Application.Current)
- {
- Application.AddResourceChangedCallback(value, (value as Element).OnResourcesChanged);
- }
-
- if (value is BindableObject)
- {
- ((BindableObject)value).IsCreateByXaml = true;
- }
- }
- }
-
- if (node.CollectionItems.Count == 1 && node.CollectionItems[0] is ValueNode &&
- ((ValueNode)node.CollectionItems[0]).Value is string)
- {
- var valuestring = ((ValueNode)node.CollectionItems[0]).Value as string;
-
- if (nodeType == typeof(SByte)) {
- sbyte retval;
- if (sbyte.TryParse(valuestring, NumberStyles.Number, CultureInfo.InvariantCulture, out retval))
- return retval;
- }
- if (nodeType == typeof(Int16)) {
- short retval;
- if (short.TryParse(valuestring, NumberStyles.Number, CultureInfo.InvariantCulture, out retval))
- return retval;
- }
- if (nodeType == typeof(Int32)) {
- int retval;
- if (int.TryParse(valuestring, NumberStyles.Number, CultureInfo.InvariantCulture, out retval))
- return retval;
- }
- if (nodeType == typeof(Int64)) {
- long retval;
- if (long.TryParse(valuestring, NumberStyles.Number, CultureInfo.InvariantCulture, out retval))
- return retval;
- }
- if (nodeType == typeof(Byte)) {
- byte retval;
- if (byte.TryParse(valuestring, NumberStyles.Number, CultureInfo.InvariantCulture, out retval))
- return retval;
- }
- if (nodeType == typeof(UInt16)) {
- ushort retval;
- if (ushort.TryParse(valuestring, NumberStyles.Number, CultureInfo.InvariantCulture, out retval))
- return retval;
- }
- if (nodeType == typeof(UInt32)) {
- uint retval;
- if (uint.TryParse(valuestring, NumberStyles.Number, CultureInfo.InvariantCulture, out retval))
- return retval;
- }
- if (nodeType == typeof(UInt64)) {
- ulong retval;
- if (ulong.TryParse(valuestring, NumberStyles.Number, CultureInfo.InvariantCulture, out retval))
- return retval;
- }
- if (nodeType == typeof(Single)) {
- float retval;
- if (float.TryParse(valuestring, NumberStyles.Number, CultureInfo.InvariantCulture, out retval))
- return retval;
- }
- if (nodeType == typeof(Double)) {
- double retval;
- if (double.TryParse(valuestring, NumberStyles.Number, CultureInfo.InvariantCulture, out retval))
- return retval;
- }
- if (nodeType == typeof (Boolean))
- {
- bool outbool;
- if (bool.TryParse(valuestring, out outbool))
- return outbool;
- }
- if (nodeType == typeof(TimeSpan)) {
- TimeSpan retval;
- if (TimeSpan.TryParse(valuestring, CultureInfo.InvariantCulture, out retval))
- return retval;
- }
- if (nodeType == typeof (char))
- {
- char retval;
- if (char.TryParse(valuestring, out retval))
- return retval;
- }
- if (nodeType == typeof (string))
- return valuestring;
- if (nodeType == typeof (decimal))
- {
- decimal retval;
- if (decimal.TryParse(valuestring, NumberStyles.Number, CultureInfo.InvariantCulture, out retval))
- return retval;
- }
-
- else if (nodeType == typeof (Uri))
- {
- Uri retval;
- if (Uri.TryCreate(valuestring, UriKind.RelativeOrAbsolute, out retval))
- return retval;
- }
- }
- return value;
- }
- }
-}
+++ /dev/null
-namespace Tizen.NUI.Xaml
-{
- internal static class DesignMode
- {
- public static bool IsDesignModeEnabled { get; internal set; }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Xml;
-using Tizen.NUI.Binding.Internals;
-
-namespace Tizen.NUI.Xaml
-{
- internal class ExpandMarkupsVisitor : IXamlNodeVisitor
- {
- public ExpandMarkupsVisitor(HydrationContext context)
- {
- Context = context;
- }
-
- public static readonly IList<XmlName> Skips = new List<XmlName>
- {
- XmlName.xKey,
- XmlName.xTypeArguments,
- XmlName.xFactoryMethod,
- XmlName.xName,
- XmlName.xDataType
- };
-
- Dictionary<INode, object> Values
- {
- get { return Context.Values; }
- }
-
- HydrationContext Context { get; }
-
- public TreeVisitingMode VisitingMode => TreeVisitingMode.BottomUp;
- public bool StopOnDataTemplate => false;
- 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)
- {
- }
-
- public void Visit(MarkupNode markupnode, INode parentNode)
- {
- var parentElement = parentNode as IElementNode;
- XmlName propertyName;
- if (!ApplyPropertiesVisitor.TryGetPropertyName(markupnode, parentNode, out propertyName))
- return;
- if (Skips.Contains(propertyName))
- return;
- if (parentElement.SkipProperties.Contains(propertyName))
- return;
-
- var markupString = markupnode.MarkupString;
- var node =
- ParseExpression(ref markupString, markupnode.NamespaceResolver, markupnode, markupnode, parentNode) as IElementNode;
- if (node != null)
- {
- ((IElementNode)parentNode).Properties[propertyName] = node;
- node.Parent = parentNode;
- }
- }
-
- public void Visit(ElementNode node, INode parentNode)
- {
- }
-
- public void Visit(RootNode node, INode parentNode)
- {
- }
-
- public void Visit(ListNode node, INode parentNode)
- {
- }
-
- INode ParseExpression(ref string expression, IXmlNamespaceResolver nsResolver, IXmlLineInfo xmlLineInfo, INode node,
- INode parentNode)
- {
- if (expression.StartsWith("{}", StringComparison.Ordinal))
- return new ValueNode(expression.Substring(2), null);
-
- if (expression[expression.Length - 1] != '}')
- throw new Exception("Expression must end with '}'");
-
- int len;
- string match;
- if (!MarkupExpressionParser.MatchMarkup(out match, expression, out len))
- throw new Exception();
- expression = expression.Substring(len).TrimStart();
- if (expression.Length == 0)
- throw new Exception("Expression did not end in '}'");
-
- var serviceProvider = new XamlServiceProvider(node, Context);
- serviceProvider.Add(typeof (IXmlNamespaceResolver), nsResolver);
-
- return new MarkupExpansionParser().Parse(match, ref expression, serviceProvider);
- }
-
- public class MarkupExpansionParser : MarkupExpressionParser, IExpressionParser<INode>
- {
- IElementNode node;
-
- object IExpressionParser.Parse(string match, ref string remaining, IServiceProvider serviceProvider)
- {
- return Parse(match, ref remaining, serviceProvider);
- }
-
- public INode Parse(string match, ref string remaining, IServiceProvider serviceProvider)
- {
- var nsResolver = serviceProvider.GetService(typeof (IXmlNamespaceResolver)) as IXmlNamespaceResolver;
- if (nsResolver == null)
- throw new ArgumentException();
- IXmlLineInfo xmlLineInfo = null;
- var xmlLineInfoProvider = serviceProvider.GetService(typeof (IXmlLineInfoProvider)) as IXmlLineInfoProvider;
- if (xmlLineInfoProvider != null)
- xmlLineInfo = xmlLineInfoProvider.XmlLineInfo;
-
- var split = match.Split(':');
- if (split.Length > 2)
- throw new ArgumentException();
-
- string prefix; //, name;
- if (split.Length == 2)
- {
- prefix = split[0];
- // name = split [1];
- }
- else
- {
- prefix = "";
- // name = split [0];
- }
-
- Type type;
- var typeResolver = serviceProvider.GetService(typeof (IXamlTypeResolver)) as IXamlTypeResolver;
- if (typeResolver == null)
- type = null;
- // Add Binding and StaticResource support, The ordinal code can't find BindingExtension for Binding
- //else if (match == "Binding")
- //{
- // type = typeof(BindingExtension);
- //}
- //else if (match == "StaticResource")
- //{
- // type = typeof(StaticResourceExtension);
- //}
- else
- {
- //The order of lookup is to look for the Extension-suffixed class name first and then look for the class name without the Extension suffix.
- if (!typeResolver.TryResolve(match + "Extension", out type) && !typeResolver.TryResolve(match, out type))
- {
- var lineInfoProvider = serviceProvider.GetService(typeof (IXmlLineInfoProvider)) as IXmlLineInfoProvider;
- var lineInfo = (lineInfoProvider != null) ? lineInfoProvider.XmlLineInfo : new XmlLineInfo();
- throw new XamlParseException(String.Format("MarkupExtension not found for {0}", match), lineInfo);
- }
- }
-
- var namespaceuri = nsResolver.LookupNamespace(prefix) ?? "";
- var xmltype = new XmlType(namespaceuri, type?.Name, null);
-
- if (type == null)
- throw new NotSupportedException();
-
- node = xmlLineInfo == null
- ? new ElementNode(xmltype, null, nsResolver)
- : new ElementNode(xmltype, null, nsResolver, xmlLineInfo.LineNumber, xmlLineInfo.LinePosition);
-
- if (remaining.StartsWith("}", StringComparison.Ordinal))
- {
- remaining = remaining.Substring(1);
- return node;
- }
-
- char next;
- string piece;
- while ((piece = GetNextPiece(ref remaining, out next)) != null)
- HandleProperty(piece, serviceProvider, ref remaining, next != '=');
-
- return node;
- }
-
- protected override void SetPropertyValue(string prop, string strValue, object value, IServiceProvider serviceProvider)
- {
- var nsResolver = serviceProvider.GetService(typeof (IXmlNamespaceResolver)) as IXmlNamespaceResolver;
-
- var childnode = value as INode ?? new ValueNode(strValue, nsResolver);
- childnode.Parent = node;
- if (prop != null)
- {
- var name = new XmlName(node.NamespaceURI, prop);
- node.Properties[name] = childnode;
- }
- else //ContentProperty
- node.CollectionItems.Add(childnode);
- }
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Reflection;
-using Tizen.NUI.Binding;
-
-namespace Tizen.NUI.Xaml
-{
- internal class FillResourceDictionariesVisitor : IXamlNodeVisitor
- {
- public FillResourceDictionariesVisitor(HydrationContext context)
- {
- Context = context;
- }
-
- HydrationContext Context { get; }
- Dictionary<INode, object> Values => Context.Values;
-
- public TreeVisitingMode VisitingMode => TreeVisitingMode.TopDown;
- public bool StopOnDataTemplate => true;
- 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)]))
- return;
-
- node.Accept(new ApplyPropertiesVisitor(Context, stopOnResourceDictionary: false), parentNode);
- }
-
- public void Visit(MarkupNode node, INode parentNode)
- {
- }
-
- public void Visit(ElementNode node, INode parentNode)
- {
- var value = Values[node];
- XmlName propertyName;
- //Set RD to VE
- if (typeof(ResourceDictionary).IsAssignableFrom(Context.Types[node]) && ApplyPropertiesVisitor.TryGetPropertyName(node, parentNode, out propertyName)) {
- if ((propertyName.LocalName == "Resources" ||
- propertyName.LocalName.EndsWith(".Resources", StringComparison.Ordinal)) && value is ResourceDictionary) {
- var source = Values[parentNode];
- ApplyPropertiesVisitor.SetPropertyValue(source, propertyName, value, Context.RootElement, node, Context, node);
- return;
- }
- }
-
- //Only proceed further if the node is a keyless RD
- if ( parentNode is IElementNode
- && typeof(ResourceDictionary).IsAssignableFrom(Context.Types[((IElementNode)parentNode)])
- && !((IElementNode)parentNode).Properties.ContainsKey(XmlName.xKey))
- node.Accept(new ApplyPropertiesVisitor(Context, stopOnResourceDictionary: false), parentNode);
- else if ( parentNode is ListNode
- && typeof(ResourceDictionary).IsAssignableFrom(Context.Types[((IElementNode)parentNode.Parent)])
- && !((IElementNode)parentNode.Parent).Properties.ContainsKey(XmlName.xKey))
- node.Accept(new ApplyPropertiesVisitor(Context, stopOnResourceDictionary: false), parentNode);
- }
-
- public void Visit(RootNode node, INode parentNode)
- {
- }
-
- public void Visit(ListNode node, INode parentNode)
- {
- }
-
- public bool SkipChildren(INode node, INode parentNode)
- {
- var enode = node as ElementNode;
- if (enode is null)
- return false;
- if ( parentNode is IElementNode
- && typeof(ResourceDictionary).IsAssignableFrom(Context.Types[((IElementNode)parentNode)])
- && !((IElementNode)parentNode).Properties.ContainsKey(XmlName.xKey))
- return true;
- if ( parentNode is ListNode
- && typeof(ResourceDictionary).IsAssignableFrom(Context.Types[((IElementNode)parentNode.Parent)])
- && !((IElementNode)parentNode.Parent).Properties.ContainsKey(XmlName.xKey))
- return true;
- return false;
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-
-namespace Tizen.NUI.Xaml
-{
- internal class HydrationContext
- {
- public HydrationContext()
- {
- Values = new Dictionary<INode, object>();
- Types = new Dictionary<IElementNode, Type>();
- }
-
- public Dictionary<INode, object> Values { get; }
- public Dictionary<IElementNode, Type> Types { get; }
- public HydrationContext ParentContext { get; set; }
- public Action<Exception> ExceptionHandler { get; set; }
- public object RootElement { get; set; }
- }
-}
+++ /dev/null
-namespace Tizen.NUI.Xaml
-{
- internal interface IConverterOptions
- {
- bool IgnoreCase { get; }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System.Collections.Generic;
-
-namespace Tizen.NUI.Xaml
-{
- internal static class IDictionaryExtensions
- {
- public static void AddRange<TKey, TValue>(this IDictionary<TKey, TValue> dictionary,
- IEnumerable<KeyValuePair<TKey, TValue>> collection)
- {
- foreach (var kvp in collection)
- dictionary.Add(kvp);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Xaml
-{
- internal interface IExpressionParser
- {
- object Parse(string match, ref string expression, IServiceProvider serviceProvider);
- }
-
- internal interface IExpressionParser<out T> : IExpressionParser
- where T : class
- {
- new T Parse(string match, ref string expression, IServiceProvider serviceProvider);
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Xaml
-{
- internal interface IMarkupExtension<out T> : IMarkupExtension
- {
- new T ProvideValue(IServiceProvider serviceProvider);
- }
-
- internal interface IMarkupExtension
- {
- object ProvideValue(IServiceProvider serviceProvider);
- }
-
- [AttributeUsage(AttributeTargets.Class, Inherited = false)]
- internal sealed class AcceptEmptyServiceProviderAttribute : Attribute
- {
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Xaml.Internals
-{
- internal interface INativeValueConverterService
- {
- bool ConvertTo(object value, Type toType, out object nativeValue);
- }
-}
\ No newline at end of file
+++ /dev/null
-using System.Collections.Generic;
-
-namespace Tizen.NUI.Xaml
-{
- internal interface IProvideParentValues : IProvideValueTarget
- {
- IEnumerable<object> ParentObjects { get; }
- }
-}
\ No newline at end of file
+++ /dev/null
-namespace Tizen.NUI.Xaml
-{
- internal interface IProvideValueTarget
- {
- object TargetObject { get; }
- object TargetProperty { get; }
- }
-}
\ No newline at end of file
+++ /dev/null
-namespace Tizen.NUI.Xaml
-{
- internal interface IReferenceProvider
- {
- object FindByName(string name);
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Reflection;
-using System.Xml;
-using System.IO;
-
-namespace Tizen.NUI
-{
- internal interface IResourcesLoader
- {
- T CreateFromResource<T>(string resourcePath, Assembly assembly, IXmlLineInfo lineInfo) where T : new();
- string GetResource(string resourcePath, Assembly assembly, IXmlLineInfo lineInfo);
- }
-}
\ No newline at end of file
+++ /dev/null
-namespace Tizen.NUI.Xaml
-{
- internal interface IRootObjectProvider
- {
- object RootObject { get; }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Reflection;
-
-namespace Tizen.NUI.Xaml
-{
- internal interface IValueConverterProvider
- {
- object Convert(object value, Type toType, Func<MemberInfo> minfoRetriever, IServiceProvider serviceProvider);
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Xaml
-{
- internal interface IValueProvider
- {
- object ProvideValue(IServiceProvider serviceProvider);
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Xaml
-{
- internal interface IXamlTypeResolver
- {
- Type Resolve(string qualifiedTypeName, IServiceProvider serviceProvider = null);
- bool TryResolve(string qualifiedTypeName, out Type type);
- }
-}
\ No newline at end of file
+++ /dev/null
-using System.Xml;
-
-namespace Tizen.NUI.Xaml
-{
- internal interface IXmlLineInfoProvider
- {
- IXmlLineInfo XmlLineInfo { get; }
- }
-}
\ No newline at end of file
+++ /dev/null
-//
-// MarkupExpressionParser.cs
-//
-// This code is partly salvaged from moonlight. Following licence apply.
-//
-//
-// Author(s):
-// Moonlight List (moonlight-list@lists.ximian.com)
-// Stephane Delcroix (stephane@mi8.be)
-//
-// Copyright 2009 Novell, Inc.
-// Copyright 2013 Xamarin, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Text;
-
-namespace Tizen.NUI.Xaml
-{
- internal abstract class MarkupExpressionParser
- {
- public object ParseExpression(ref string expression, IServiceProvider serviceProvider)
- {
- if (serviceProvider == null)
- throw new ArgumentNullException(nameof(serviceProvider));
- if (expression.StartsWith("{}", StringComparison.Ordinal))
- return expression.Substring(2);
-
- if (expression[expression.Length - 1] != '}')
- throw new Exception("Expression must end with '}'");
-
- int len;
- string match;
- if (!MatchMarkup(out match, expression, out len))
- return false;
- expression = expression.Substring(len).TrimStart();
- if (expression.Length == 0)
- throw new Exception("Expression did not end in '}'");
-
- var parser = Activator.CreateInstance(GetType()) as IExpressionParser;
- return parser?.Parse(match, ref expression, serviceProvider);
- }
-
- internal static bool MatchMarkup(out string match, string expression, out int end)
- {
- if (expression.Length < 2)
- {
- end = 1;
- match = null;
- return false;
- }
-
- if (expression[0] != '{')
- {
- end = 2;
- match = null;
- return false;
- }
-
- int i;
- bool found = false;
- for (i = 1; i < expression.Length; i++)
- {
- if (expression[i] == ' ')
- continue;
- found = true;
- break;
- }
-
- if (!found)
- {
- end = 3;
- match = null;
- return false;
- }
-
- int c;
- for (c = 0; c + i < expression.Length; c++)
- {
- if (expression[i + c] == ' ' || expression[i + c] == '}')
- break;
- }
-
- if (i + c == expression.Length)
- {
- end = 6;
- match = null;
- return false;
- }
-
- end = i + c;
- match = expression.Substring(i, c);
- return true;
- }
-
- protected void HandleProperty(string prop, IServiceProvider serviceProvider, ref string remaining, bool isImplicit)
- {
- char next;
- object value = null;
- string str_value;
-
- if (isImplicit)
- {
- SetPropertyValue(null, prop, null, serviceProvider);
- return;
- }
- remaining = remaining.TrimStart();
- if (remaining.StartsWith("{", StringComparison.Ordinal))
- {
- value = ParseExpression(ref remaining, serviceProvider);
- remaining = remaining.TrimStart();
-
- if (remaining.Length > 0 && remaining[0] == ',')
- remaining = remaining.Substring(1);
- else if (remaining.Length > 0 && remaining[0] == '}')
- remaining = remaining.Substring(1);
-
- str_value = value as string;
- }
- else
- str_value = GetNextPiece(ref remaining, out next);
-
- SetPropertyValue(prop, str_value, value, serviceProvider);
- }
-
- protected abstract void SetPropertyValue(string prop, string strValue, object value, IServiceProvider serviceProvider);
-
- protected string GetNextPiece(ref string remaining, out char next)
- {
- bool inString = false;
- int end = 0;
- char stringTerminator = '\0';
- remaining = remaining.TrimStart();
- if (remaining.Length == 0)
- {
- next = Char.MaxValue;
- return null;
- }
-
- var piece = new StringBuilder();
- // If we're inside a quoted string we append all chars to our piece until we hit the ending quote.
- while (end < remaining.Length &&
- (inString || (remaining[end] != '}' && remaining[end] != ',' && remaining[end] != '=')))
- {
- if (inString)
- {
- if (remaining[end] == stringTerminator)
- {
- inString = false;
- end ++;
- break;
- }
- }
- else
- {
- if (remaining[end] == '\'' || remaining[end] == '"')
- {
- inString = true;
- stringTerminator = remaining[end];
- end ++;
- continue;
- }
- }
-
- // If this is an escape char, consume it and append the next char to our piece.
- if (remaining[end] == '\\')
- {
- end ++;
- if (end == remaining.Length)
- break;
- }
- piece.Append(remaining[end]);
- end++;
- }
-
- if (inString && end == remaining.Length)
- throw new Exception("Unterminated quoted string");
-
- if (end == remaining.Length && !remaining.EndsWith("}", StringComparison.Ordinal))
- throw new Exception("Expression did not end with '}'");
-
- if (end == 0)
- {
- next = Char.MaxValue;
- return null;
- }
-
- next = remaining[end];
- remaining = remaining.Substring(end + 1);
-
- // Whitespace is trimmed from the end of the piece before stripping
- // quote chars from the start/end of the string.
- while (piece.Length > 0 && char.IsWhiteSpace(piece[piece.Length - 1]))
- piece.Length --;
-
- if (piece.Length >= 2)
- {
- char first = piece[0];
- char last = piece[piece.Length - 1];
- if ((first == '\'' && last == '\'') || (first == '"' && last == '"'))
- {
- piece.Remove(piece.Length - 1, 1);
- piece.Remove(0, 1);
- }
- }
-
- return piece.ToString();
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Reflection;
-using Tizen.NUI.Binding;
-
-namespace Tizen.NUI.Xaml
-{
- internal sealed class MarkupExtensionParser : MarkupExpressionParser, IExpressionParser<object>
- {
- IMarkupExtension markupExtension;
-
- public object Parse(string match, ref string remaining, IServiceProvider serviceProvider)
- {
- var typeResolver = serviceProvider.GetService(typeof (IXamlTypeResolver)) as IXamlTypeResolver;
-
- //shortcut for Binding and StaticResource, to avoid too many reflection calls.
- if (match == "Binding")
- markupExtension = new BindingExtension();
- else if (match == "TemplateBinding")
- markupExtension = new TemplateBindingExtension();
- else if (match == "StaticResource")
- markupExtension = new StaticResourceExtension();
- else
- {
- if (typeResolver == null)
- return null;
- Type type;
-
- //The order of lookup is to look for the Extension-suffixed class name first and then look for the class name without the Extension suffix.
- if (!typeResolver.TryResolve(match + "Extension", out type) && !typeResolver.TryResolve(match, out type))
- {
- var lineInfoProvider = serviceProvider.GetService(typeof (IXmlLineInfoProvider)) as IXmlLineInfoProvider;
- var lineInfo = (lineInfoProvider != null) ? lineInfoProvider.XmlLineInfo : new XmlLineInfo();
- throw new XamlParseException(String.Format("MarkupExtension not found for {0}", match), lineInfo);
- }
- markupExtension = Activator.CreateInstance(type) as IMarkupExtension;
- }
-
- if (markupExtension == null)
- {
- var lineInfoProvider = serviceProvider.GetService(typeof (IXmlLineInfoProvider)) as IXmlLineInfoProvider;
- var lineInfo = (lineInfoProvider != null) ? lineInfoProvider.XmlLineInfo : new XmlLineInfo();
- throw new XamlParseException(String.Format("Missing public default constructor for MarkupExtension {0}", match),
- lineInfo);
- }
-
- char next;
- if (remaining == "}")
- return markupExtension.ProvideValue(serviceProvider);
-
- string piece;
- while ((piece = GetNextPiece(ref remaining, out next)) != null)
- HandleProperty(piece, serviceProvider, ref remaining, next != '=');
-
- return markupExtension.ProvideValue(serviceProvider);
- }
-
- protected override void SetPropertyValue(string prop, string strValue, object value, IServiceProvider serviceProvider)
- {
- MethodInfo setter;
- if (prop == null)
- {
- //implicit property
- var t = markupExtension.GetType();
- prop = ApplyPropertiesVisitor.GetContentPropertyName(t.GetTypeInfo());
- if (prop == null)
- return;
- setter = t.GetRuntimeProperty(prop)?.SetMethod;
- }
- else
- setter = markupExtension.GetType().GetRuntimeProperty(prop)?.SetMethod;
-
- if (value == null && strValue != null)
- {
- value = strValue.ConvertTo(markupExtension.GetType().GetRuntimeProperty(prop)?.PropertyType,
- (Func<TypeConverter>)null, serviceProvider);
- }
-
- setter?.Invoke(markupExtension, new[] { value });
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using Tizen.NUI.Binding;
-
-namespace Tizen.NUI.Xaml
-{
- [ContentProperty("Items")]
- [AcceptEmptyServiceProvider]
- internal class ArrayExtension : IMarkupExtension<Array>
- {
- public ArrayExtension()
- {
- Items = new List<object>();
- }
-
- public IList Items { get; }
-
- public Type Type { get; set; }
-
- public Array ProvideValue(IServiceProvider serviceProvider)
- {
- if (Type == null)
- throw new InvalidOperationException("Type argument mandatory for x:Array extension");
-
- if (Items == null)
- return null;
-
- var array = Array.CreateInstance(Type, Items.Count);
- for (var i = 0; i < Items.Count; i++)
- ((IList)array)[i] = Items[i];
-
- return array;
- }
-
- object IMarkupExtension.ProvideValue(IServiceProvider serviceProvider)
- {
- return (this as IMarkupExtension<Array>).ProvideValue(serviceProvider);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using Tizen.NUI.Binding.Internals;
-using Tizen.NUI.Binding;
-
-namespace Tizen.NUI.Xaml
-{
- [ContentProperty("Path")]
- [AcceptEmptyServiceProvider]
- internal sealed class BindingExtension : IMarkupExtension<BindingBase>
- {
- public string Path { get; set; } = Binding.Binding.SelfPath;
- public BindingMode Mode { get; set; } = BindingMode.Default;
-
- public IValueConverter Converter { get; set; }
-
- public object ConverterParameter { get; set; }
-
- public string StringFormat { get; set; }
-
- public object Source { get; set; }
-
- 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,
- FallbackValue = FallbackValue,
- TargetNullValue = TargetNullValue,
- };
-
- TypedBinding.Mode = Mode;
- TypedBinding.Converter = Converter;
- TypedBinding.ConverterParameter = ConverterParameter;
- TypedBinding.StringFormat = StringFormat;
- TypedBinding.Source = Source;
- TypedBinding.UpdateSourceEventName = UpdateSourceEventName;
- TypedBinding.FallbackValue = FallbackValue;
- TypedBinding.TargetNullValue = TargetNullValue;
- return TypedBinding;
- }
-
- object IMarkupExtension.ProvideValue(IServiceProvider serviceProvider)
- {
- return (this as IMarkupExtension<BindingBase>).ProvideValue(serviceProvider);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using Tizen.NUI.Binding;
-using Tizen.NUI.Binding.Internals;
-
-namespace Tizen.NUI.Xaml
-{
- [ContentProperty("Key")]
- internal sealed class DynamicResourceExtension : IMarkupExtension<DynamicResource>
- {
- public string Key { get; set; }
-
- public object ProvideValue(IServiceProvider serviceProvider)
- {
- return ((IMarkupExtension<DynamicResource>)this).ProvideValue(serviceProvider);
- }
-
- DynamicResource IMarkupExtension<DynamicResource>.ProvideValue(IServiceProvider serviceProvider)
- {
- if (Key == null)
- {
- var lineInfoProvider = serviceProvider.GetService(typeof (IXmlLineInfoProvider)) as IXmlLineInfoProvider;
- var lineInfo = (lineInfoProvider != null) ? lineInfoProvider.XmlLineInfo : new XmlLineInfo();
- throw new XamlParseException("DynamicResource markup require a Key", lineInfo);
- }
- return new DynamicResource(Key);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Xaml
-{
- [ProvideCompiled("Tizen.NUI.Xaml.Build.Tasks.NullExtension")]
- [AcceptEmptyServiceProvider]
- internal class NullExtension : IMarkupExtension
- {
- public object ProvideValue(IServiceProvider serviceProvider)
- {
- return null;
- }
- }
-}
+++ /dev/null
-using System;
-using Tizen.NUI.Binding.Internals;
-using Tizen.NUI.Xaml.Internals;
-using Tizen.NUI.Binding;
-
-namespace Tizen.NUI.Xaml
-{
- [ContentProperty("Name")]
- internal class ReferenceExtension : IMarkupExtension
- {
- public string Name { get; set; }
-
- public object ProvideValue(IServiceProvider serviceProvider)
- {
- if (serviceProvider == null)
- throw new ArgumentNullException(nameof(serviceProvider));
- var valueProvider = serviceProvider.GetService(typeof (IProvideValueTarget)) as IProvideParentValues;
- if (valueProvider == null)
- throw new ArgumentException("serviceProvider does not provide an IProvideValueTarget");
- var namescopeprovider = serviceProvider.GetService(typeof (INameScopeProvider)) as INameScopeProvider;
- if (namescopeprovider != null && namescopeprovider.NameScope != null)
- {
- var value = namescopeprovider.NameScope.FindByName(Name);
- if (value != null)
- return value;
- }
-
- foreach (var target in valueProvider.ParentObjects)
- {
- var ns = target as INameScope;
- if (ns == null)
- continue;
- var value = ns.FindByName(Name);
- if (value != null)
- return value;
- }
-
- var lineInfo = (serviceProvider?.GetService(typeof(IXmlLineInfoProvider)) as IXmlLineInfoProvider)?.XmlLineInfo ?? new XmlLineInfo();
- throw new XamlParseException($"Can not find the object referenced by `{Name}`", lineInfo);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Linq;
-using System.Reflection;
-using System.Xml;
-using Tizen.NUI.Binding;
-
-namespace Tizen.NUI.Xaml
-{
- [ContentProperty(nameof(Member))]
- [ProvideCompiled("Tizen.NUI.Xaml.Build.Tasks.StaticExtension")]
- internal class StaticExtension : IMarkupExtension
- {
- public string Member { get; set; }
-
- public object ProvideValue(IServiceProvider serviceProvider)
- {
- IXmlLineInfoProvider lineInfoProvider;
- IXmlLineInfo lineInfo;
-
- if (serviceProvider == null)
- throw new ArgumentNullException(nameof(serviceProvider));
- var typeResolver = serviceProvider.GetService(typeof (IXamlTypeResolver)) as IXamlTypeResolver;
- if (typeResolver == null)
- throw new ArgumentException("No IXamlTypeResolver in IServiceProvider");
-
- if (string.IsNullOrEmpty(Member) || !Member.Contains("."))
- {
- lineInfoProvider = serviceProvider.GetService(typeof (IXmlLineInfoProvider)) as IXmlLineInfoProvider;
- lineInfo = (lineInfoProvider != null) ? lineInfoProvider.XmlLineInfo : new XmlLineInfo();
- throw new XamlParseException("Syntax for x:Static is [Member=][prefix:]typeName.staticMemberName", lineInfo);
- }
-
- var dotIdx = Member.LastIndexOf('.');
- var typename = Member.Substring(0, dotIdx);
- var membername = Member.Substring(dotIdx + 1);
-
- var type = typeResolver.Resolve(typename, serviceProvider);
-
- var pinfo = type.GetRuntimeProperties().FirstOrDefault(pi => pi.GetMethod != null && pi.Name == membername && pi.GetMethod.IsStatic);
- if (pinfo != null)
- return pinfo.GetMethod?.Invoke(null, Array.Empty<object>());
-
- var finfo = type.GetRuntimeFields().FirstOrDefault(fi => fi.Name == membername && fi.IsStatic);
- if (finfo != null)
- return finfo.GetValue(null);
-
- lineInfoProvider = serviceProvider.GetService(typeof (IXmlLineInfoProvider)) as IXmlLineInfoProvider;
- lineInfo = (lineInfoProvider != null) ? lineInfoProvider.XmlLineInfo : new XmlLineInfo();
- throw new XamlParseException($"No static member found for {Member}", lineInfo);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Xml;
-using System.Reflection;
-using System.Linq;
-using Tizen.NUI.Binding;
-
-
-namespace Tizen.NUI.Xaml
-{
- [ContentProperty("Key")]
- internal sealed class StaticResourceExtension : IMarkupExtension
- {
- public string Key { get; set; }
-
- public object ProvideValue(IServiceProvider serviceProvider)
- {
- if (serviceProvider == null)
- throw new ArgumentNullException(nameof(serviceProvider));
- if (Key == null) {
- var lineInfoProvider = serviceProvider.GetService(typeof(IXmlLineInfoProvider)) as IXmlLineInfoProvider;
- var lineInfo = (lineInfoProvider != null) ? lineInfoProvider.XmlLineInfo : new XmlLineInfo();
- throw new XamlParseException("you must specify a key in {StaticResource}", lineInfo);
- }
- var valueProvider = serviceProvider.GetService(typeof(IProvideValueTarget)) as IProvideParentValues;
- if (valueProvider == null)
- throw new ArgumentException();
- var xmlLineInfoProvider = serviceProvider.GetService(typeof(IXmlLineInfoProvider)) as IXmlLineInfoProvider;
- var xmlLineInfo = xmlLineInfoProvider != null ? xmlLineInfoProvider.XmlLineInfo : null;
- object resource = null;
-
- foreach (var p in valueProvider.ParentObjects) {
- var irp = p as IResourcesProvider;
- var resDict = irp != null && irp.IsResourcesCreated ? irp.XamlResources : p as ResourceDictionary;
- if (resDict == null)
- continue;
- if (resDict.TryGetValue(Key, out resource))
- break;
- }
- resource = resource ?? GetApplicationLevelResource(Key, xmlLineInfo);
-
- var bp = valueProvider.TargetProperty as BindableProperty;
- var pi = valueProvider.TargetProperty as PropertyInfo;
- var propertyType = bp?.ReturnType ?? pi?.PropertyType;
- if (propertyType == null) {
- if (resource != null) {
- if (resource.GetType().GetTypeInfo().IsGenericType && (resource.GetType().GetGenericTypeDefinition() == typeof(OnPlatform<>) || resource.GetType().GetGenericTypeDefinition() == typeof(OnIdiom<>))) {
- // This is only there to support our backward compat story with pre 2.3.3 compiled Xaml project who was not providing TargetProperty
- var method = resource.GetType().GetRuntimeMethod("op_Implicit", new[] { resource.GetType() });
- if (method != null) {
- resource = method.Invoke(null, new[] { resource });
- }
- }
- }
- return resource;
- }
- if (propertyType.IsAssignableFrom(resource?.GetType()))
- return resource;
- var implicit_op = resource?.GetType().GetImplicitConversionOperator(fromType: resource?.GetType(), toType: propertyType)
- ?? propertyType.GetImplicitConversionOperator(fromType: resource?.GetType(), toType: propertyType);
- if (implicit_op != null)
- return implicit_op.Invoke(resource, new [] { resource });
-
- if (resource != null) {
- //Special case for https://bugzilla.xamarin.com/show_bug.cgi?id=59818
- //On OnPlatform, check for an opImplicit from the targetType
- if ( Device.Flags != null
- && Device.Flags.Contains("xamlDoubleImplicitOpHack")
- && resource.GetType().GetTypeInfo().IsGenericType
- && (resource.GetType().GetGenericTypeDefinition() == typeof(OnPlatform<>))) {
- var tType = resource.GetType().GenericTypeArguments[0];
- var opImplicit = tType.GetImplicitConversionOperator(fromType: tType, toType: propertyType)
- ?? propertyType.GetImplicitConversionOperator(fromType: tType, toType: propertyType);
-
- if (opImplicit != null) {
- //convert the OnPlatform<T> to T
- var opPlatformImplicitConversionOperator = resource?.GetType().GetImplicitConversionOperator(fromType: resource?.GetType(), toType: tType);
- resource = opPlatformImplicitConversionOperator?.Invoke(null, new[] { resource });
-
- //and convert to toType
- resource = opImplicit.Invoke(null, new[] { resource });
- return resource;
- }
- }
- }
- return resource;
- }
-
- internal object GetApplicationLevelResource(string key, IXmlLineInfo xmlLineInfo)
- {
- object resource = null;
- if (Application.Current == null || !((IResourcesProvider)Application.Current).IsResourcesCreated || !Application.Current.XamlResources.TryGetValue(Key, out resource))
- throw new XamlParseException($"StaticResource not found for key {Key}", xmlLineInfo);
- return resource;
- }
- }
-}
+++ /dev/null
-using System;
-using System.Xml;
-using Tizen.NUI.StyleSheets;
-using System.Reflection;
-using System.IO;
-using Tizen.NUI.Binding;
-
-namespace Tizen.NUI.Xaml
-{
- [ContentProperty(nameof(Style))]
- [ProvideCompiled("Tizen.NUI.Core.XamlC.StyleSheetProvider")]
- internal sealed class StyleSheetExtension : IValueProvider
- {
- public string Style { get; set; }
- public Uri Source { get; set; }
-
- object IValueProvider.ProvideValue(IServiceProvider serviceProvider)
- {
- IXmlLineInfo lineInfo;
-
- if (!string.IsNullOrEmpty(Style) && Source != null) {
- lineInfo = (serviceProvider.GetService(typeof(IXmlLineInfoProvider)) as IXmlLineInfoProvider)?.XmlLineInfo;
- throw new XamlParseException($"StyleSheet can not have both a Source and a content", lineInfo);
- }
-
- if (Source != null) {
- lineInfo = (serviceProvider.GetService(typeof(IXmlLineInfoProvider)) as IXmlLineInfoProvider)?.XmlLineInfo;
- if (Source.IsAbsoluteUri)
- throw new XamlParseException($"Source only accepts Relative URIs", lineInfo);
-
- var rootObjectType = (serviceProvider.GetService(typeof(IRootObjectProvider)) as IRootObjectProvider)?.RootObject.GetType();
- if (rootObjectType == null)
- return null;
- var rootTargetPath = XamlResourceIdAttribute.GetPathForType(rootObjectType);
- var resourcePath = ResourceDictionary.RDSourceTypeConverter.GetResourcePath(Source, rootTargetPath);
- var resString = DependencyService.Get<IResourcesLoader>()?.GetResource(resourcePath, rootObjectType.GetTypeInfo().Assembly, lineInfo);
- return StyleSheet.FromString(resString);
- }
-
- if (!string.IsNullOrEmpty(Style)) {
- using (var reader = new StringReader(Style))
- return StyleSheet.FromReader(reader);
- }
-
- lineInfo = (serviceProvider.GetService(typeof(IXmlLineInfoProvider)) as IXmlLineInfoProvider)?.XmlLineInfo;
- throw new XamlParseException($"StyleSheet require either a Source or a content", lineInfo);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using Tizen.NUI.Binding;
-
-namespace Tizen.NUI.Xaml
-{
- [ContentProperty("Path")]
- [AcceptEmptyServiceProvider]
- internal sealed class TemplateBindingExtension : IMarkupExtension<BindingBase>
- {
- internal TemplateBindingExtension()
- {
- Mode = BindingMode.Default;
- Path = Tizen.NUI.Binding.Binding.SelfPath;
- }
-
- public string Path { get; set; }
-
- public BindingMode Mode { get; set; }
-
- public IValueConverter Converter { get; set; }
-
- public object ConverterParameter { get; set; }
-
- public string StringFormat { get; set; }
-
- BindingBase IMarkupExtension<BindingBase>.ProvideValue(IServiceProvider serviceProvider)
- {
- return new TemplateBinding(Path, Mode, Converter, ConverterParameter, StringFormat);
- }
-
- object IMarkupExtension.ProvideValue(IServiceProvider serviceProvider)
- {
- return (this as IMarkupExtension<BindingBase>).ProvideValue(serviceProvider);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using Tizen.NUI.Binding;
-
-namespace Tizen.NUI.Xaml
-{
- [ContentProperty(nameof(TypeName))]
- [ProvideCompiled("Tizen.NUI.Xaml.Build.Tasks.TypeExtension")]
- internal class TypeExtension : IMarkupExtension<Type>
- {
- public string TypeName { get; set; }
-
- public Type ProvideValue(IServiceProvider serviceProvider)
- {
- if (string.IsNullOrEmpty(TypeName))
- throw new InvalidOperationException("TypeName isn't set.");
- if (serviceProvider == null)
- throw new ArgumentNullException(nameof(serviceProvider));
- var typeResolver = serviceProvider.GetService(typeof (IXamlTypeResolver)) as IXamlTypeResolver;
- if (typeResolver == null)
- throw new ArgumentException("No IXamlTypeResolver in IServiceProvider");
-
- return typeResolver.Resolve(TypeName, serviceProvider);
- }
-
- object IMarkupExtension.ProvideValue(IServiceProvider serviceProvider)
- {
- return (this as IMarkupExtension<Type>).ProvideValue(serviceProvider);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System.Collections.Generic;
-using Tizen.NUI.Binding.Internals;
-
-namespace Tizen.NUI.Xaml
-{
- internal class NamescopingVisitor : IXamlNodeVisitor
- {
- readonly Dictionary<INode, INameScope> scopes = new Dictionary<INode, INameScope>();
-
- public NamescopingVisitor(HydrationContext context)
- {
- Values = context.Values;
- }
-
- Dictionary<INode, object> Values { get; set; }
-
- public TreeVisitingMode VisitingMode => TreeVisitingMode.TopDown;
- public bool StopOnDataTemplate => false;
- 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)
- {
- scopes[node] = scopes[parentNode];
- }
-
- public void Visit(MarkupNode node, INode parentNode)
- {
- scopes[node] = scopes[parentNode];
- }
-
- public void Visit(ElementNode node, INode parentNode)
- {
- var ns = parentNode == null || IsDataTemplate(node, parentNode) || IsStyle(node, parentNode) || IsVisualStateGroupList(node)
- ? new NameScope()
- : scopes[parentNode];
- node.Namescope = ns;
- scopes[node] = ns;
- }
-
- public void Visit(RootNode node, INode parentNode)
- {
- var ns = new NameScope();
- node.Namescope = ns;
- scopes[node] = ns;
- }
-
- public void Visit(ListNode node, INode parentNode)
- {
- scopes[node] = scopes[parentNode];
- }
-
- static bool IsDataTemplate(INode node, INode parentNode)
- {
- var parentElement = parentNode as IElementNode;
- INode createContent;
- if (parentElement != null && parentElement.Properties.TryGetValue(XmlName._CreateContent, out createContent) &&
- createContent == node)
- return true;
- return false;
- }
-
- static bool IsStyle(INode node, INode parentNode)
- {
- var pnode = parentNode as ElementNode;
- return pnode != null && pnode.XmlType.Name == "Style";
- }
-
- static bool IsVisualStateGroupList(ElementNode node)
- {
- return node != null && node.XmlType.Name == "VisualStateGroup" && node.Parent is IListNode;
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System.Collections.Generic;
-using System.Linq;
-
-namespace Tizen.NUI.Xaml
-{
- internal class PruneIgnoredNodesVisitor : IXamlNodeVisitor
- {
- public TreeVisitingMode VisitingMode => TreeVisitingMode.TopDown;
- public bool StopOnDataTemplate => false;
- 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)
- {
- foreach (var propertyKvp in node.Properties)
- {
- var propertyName = propertyKvp.Key;
- var propertyValue = (propertyKvp.Value as ValueNode)?.Value as string;
- if (propertyValue == null)
- continue;
- if (!propertyName.Equals(XamlParser.McUri, "Ignorable"))
- continue;
- (parentNode.IgnorablePrefixes ?? (parentNode.IgnorablePrefixes = new List<string>())).AddRange(propertyValue.Split(','));
- }
-
- foreach (var propertyKvp in node.Properties.ToList())
- {
- // skip d:foo="bar"
- var prefix = node.NamespaceResolver.LookupPrefix(propertyKvp.Key.NamespaceURI);
- if (node.SkipPrefix(prefix))
- node.Properties.Remove(propertyKvp.Key);
- var propNs = (propertyKvp.Value as IElementNode)?.NamespaceURI ?? "";
- var propPrefix = node.NamespaceResolver.LookupPrefix(propNs);
- if (node.SkipPrefix(propPrefix))
- node.Properties.Remove(propertyKvp.Key);
- }
-
- foreach (var prop in node.CollectionItems.ToList())
- {
- var propNs = (prop as IElementNode)?.NamespaceURI ?? "";
- var propPrefix = node.NamespaceResolver.LookupPrefix(propNs);
- if (node.SkipPrefix(propPrefix))
- node.CollectionItems.Remove(prop);
- }
-
- if (node.SkipPrefix(node.NamespaceResolver.LookupPrefix(node.NamespaceURI)))
- {
- node.Properties.Clear();
- node.CollectionItems.Clear();
- }
- }
-
- public void Visit(RootNode node, INode parentNode)
- {
- Visit((ElementNode)node, node);
- }
-
- public void Visit(MarkupNode node, INode parentNode)
- {
- }
-
- public void Visit(ListNode node, INode parentNode)
- {
- foreach (var prop in node.CollectionItems.ToList())
- {
- var propNs = (prop as IElementNode)?.NamespaceURI ?? "";
- var propPrefix = node.NamespaceResolver.LookupPrefix(propNs);
- if (node.SkipPrefix(propPrefix))
- node.CollectionItems.Remove(prop);
- }
- }
-
- public void Visit(ValueNode node, INode parentNode)
- {
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Reflection;
-
-namespace Tizen.NUI.Binding.Internals
-{
- internal static class ReflectionExtensions
- {
- public static FieldInfo GetField(this Type type, Func<FieldInfo, bool> predicate)
- {
- return GetFields(type).FirstOrDefault(predicate);
- }
-
- public static FieldInfo GetField(this Type type, string name)
- {
- return type.GetField(fi => fi.Name == name);
- }
-
- public static IEnumerable<FieldInfo> GetFields(this Type type)
- {
- return GetParts(type, i => i.DeclaredFields);
- }
-
- public static IEnumerable<PropertyInfo> GetProperties(this Type type)
- {
- return GetParts(type, ti => ti.DeclaredProperties);
- }
-
- public static PropertyInfo GetProperty(this Type type, string name)
- {
- Type t = type;
- while (t != null)
- {
- System.Reflection.TypeInfo ti = t.GetTypeInfo();
- PropertyInfo property = ti.GetDeclaredProperty(name);
- if (property != null)
- return property;
-
- t = ti.BaseType;
- }
-
- return null;
- }
-
- public static bool IsAssignableFrom(this Type self, Type c)
- {
- return self.GetTypeInfo().IsAssignableFrom(c.GetTypeInfo());
- }
-
- public static bool IsInstanceOfType(this Type self, object o)
- {
- return self.GetTypeInfo().IsAssignableFrom(o.GetType().GetTypeInfo());
- }
-
- static IEnumerable<T> GetParts<T>(Type type, Func<System.Reflection.TypeInfo, IEnumerable<T>> selector)
- {
- Type t = type;
- while (t != null)
- {
- System.Reflection.TypeInfo ti = t.GetTypeInfo();
- foreach (T f in selector(ti))
- yield return f;
- t = ti.BaseType;
- }
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using Tizen.NUI.Binding;
-
-namespace Tizen.NUI.Xaml
-{
- internal class RegisterXNamesVisitor : IXamlNodeVisitor
- {
- 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)
- {
- if (!IsXNameProperty(node, parentNode))
- return;
- try
- {
- ((IElementNode)parentNode).Namescope.RegisterName((string)node.Value, Values[parentNode]);
- }
- catch (ArgumentException ae)
- {
- if (ae.ParamName != "name")
- throw ae;
- throw new XamlParseException($"An element with the name \"{(string)node.Value}\" already exists in this NameScope", node);
- }
- var element = Values[parentNode] as Element;
- if (element != null)
- element.StyleId = element.StyleId ?? (string)node.Value;
- }
-
- public void Visit(MarkupNode node, INode parentNode)
- {
- }
-
- public void Visit(ElementNode node, INode parentNode)
- {
- }
-
- public void Visit(RootNode node, INode parentNode)
- {
- }
-
- public void Visit(ListNode node, INode parentNode)
- {
- }
-
- static bool IsXNameProperty(ValueNode node, INode parentNode)
- {
- var parentElement = parentNode as IElementNode;
- INode xNameNode;
- if (parentElement != null && parentElement.Properties.TryGetValue(XmlName.xName, out xNameNode) && xNameNode == node)
- return true;
- return false;
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.IO;
-using System.Reflection;
-using Tizen.NUI;
-using System.Xml;
-using Tizen.NUI.Binding.Internals;
-
-// [assembly:Dependency(typeof(Tizen.NUI.Xaml.ResourcesLoader))]
-namespace Tizen.NUI.Xaml
-{
- internal class ResourcesLoader : IResourcesLoader
- {
- public T CreateFromResource<T>(string resourcePath, Assembly assembly, IXmlLineInfo lineInfo) where T: new()
- {
- var alternateResource = ResourceLoader.ResourceProvider?.Invoke(assembly.GetName(), resourcePath);
- if (alternateResource != null) {
- var rd = new T();
- rd.LoadFromXaml(alternateResource);
- return rd;
- }
-
- var resourceId = XamlResourceIdAttribute.GetResourceIdForPath(assembly, resourcePath);
- if (resourceId == null)
- throw new XamlParseException($"Resource '{resourcePath}' not found.", lineInfo);
-
- using (var stream = assembly.GetManifestResourceStream(resourceId)) {
- if (stream == null)
- throw new XamlParseException($"No resource found for '{resourceId}'.", lineInfo);
- using (var reader = new StreamReader(stream)) {
- var rd = new T();
- rd.LoadFromXaml(reader.ReadToEnd());
- return rd;
- }
- }
- }
-
- public string GetResource(string resourcePath, Assembly assembly, IXmlLineInfo lineInfo)
- {
- var alternateResource = ResourceLoader.ResourceProvider?.Invoke(assembly.GetName(), resourcePath);
- if (alternateResource != null)
- return alternateResource;
-
- var resourceId = XamlResourceIdAttribute.GetResourceIdForPath(assembly, resourcePath);
- if (resourceId == null)
- throw new XamlParseException($"Resource '{resourcePath}' not found.", lineInfo);
-
- using (var stream = assembly.GetManifestResourceStream(resourceId)) {
- if (stream == null)
- throw new XamlParseException($"No resource found for '{resourceId}'.", lineInfo);
- using (var reader = new StreamReader(stream))
- return reader.ReadToEnd();
- }
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Xaml
-{
- [AttributeUsage(AttributeTargets.Class)]
- internal sealed class RuntimeNamePropertyAttribute : Attribute
- {
- public RuntimeNamePropertyAttribute(string name)
- {
- Name = name;
- }
-
- public string Name { get; }
- }
-}
\ No newline at end of file
+++ /dev/null
-
-using System.Collections.Generic;
-using System.Xml;
-
-namespace Tizen.NUI.Xaml
-{
- internal static class TypeArgumentsParser
- {
- public static IList<XmlType> ParseExpression(string expression, IXmlNamespaceResolver resolver, IXmlLineInfo lineInfo)
- {
- var typeList = new List<XmlType>();
- while (!string.IsNullOrWhiteSpace(expression))
- {
- var match = expression;
- typeList.Add(Parse(match, ref expression, resolver, lineInfo));
- }
- return typeList;
- }
-
- static XmlType Parse(string match, ref string remaining, IXmlNamespaceResolver resolver, IXmlLineInfo lineinfo)
- {
- remaining = null;
- int parensCount = 0;
- int pos = 0;
- bool isGeneric = false;
-
- for (pos = 0; pos < match.Length; pos++)
- {
- if (match[pos] == '(')
- {
- parensCount++;
- isGeneric = true;
- }
- else if (match[pos] == ')')
- parensCount--;
- else if (match[pos] == ',' && parensCount == 0)
- {
- remaining = match.Substring(pos + 1);
- break;
- }
- }
- var type = match.Substring(0, pos).Trim();
-
- IList<XmlType> typeArguments = null;
- if (isGeneric)
- {
- typeArguments = ParseExpression(
- type.Substring(type.IndexOf('(') + 1, type.LastIndexOf(')') - type.IndexOf('(') - 1), resolver, lineinfo);
- type = type.Substring(0, type.IndexOf('('));
- }
-
- var split = type.Split(':');
- if (split.Length > 2)
- return null;
-
- string prefix, name;
- if (split.Length == 2) {
- prefix = split [0];
- name = split [1];
- } else {
- prefix = "";
- name = split [0];
- }
-
- var namespaceuri = resolver.LookupNamespace(prefix);
- if (namespaceuri == null)
- throw new XamlParseException($"No xmlns declaration for prefix '{prefix}'.", lineinfo, null);
- return new XmlType(namespaceuri, name, typeArguments);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Xaml
-{
- [System.AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
- internal sealed class TypeConversionAttribute : Attribute
- {
- public Type TargetType { get; private set; }
-
- public TypeConversionAttribute(Type targetType)
- {
- TargetType = targetType;
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-//
-// TypeConversionExtensions.cs
-//
-// Author:
-// Stephane Delcroix <stephane@mi8.be>
-//
-// Copyright (c) 2013 Mobile Inception
-// Copyright (c) 2014 Xamarin, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Reflection;
-// using Tizen.NUI.Binding.Internals;
-using Tizen.NUI.Xaml.Internals;
-using Tizen.NUI.Binding;
-
-namespace Tizen.NUI.Xaml
-{
- internal static class TypeConversionExtensions
- {
- internal static object ConvertTo(this object value, Type toType, Func<ParameterInfo> pinfoRetriever,
- IServiceProvider serviceProvider)
- {
- Func<TypeConverter> getConverter = () =>
- {
- ParameterInfo pInfo;
- if (pinfoRetriever == null || (pInfo = pinfoRetriever()) == null)
- return null;
-
- var converterTypeName = pInfo.CustomAttributes.GetTypeConverterTypeName();
- if (converterTypeName == null)
- return null;
- var convertertype = Type.GetType(converterTypeName);
- return (TypeConverter)Activator.CreateInstance(convertertype);
- };
-
- return ConvertTo(value, toType, getConverter, serviceProvider);
- }
-
- internal static object ConvertTo(this object value, Type toType, Func<MemberInfo> minfoRetriever,
- IServiceProvider serviceProvider)
- {
- Func<object> getConverter = () =>
- {
- MemberInfo memberInfo;
-
- var converterTypeName = toType.GetTypeInfo().CustomAttributes.GetTypeConverterTypeName();
- if (minfoRetriever != null && (memberInfo = minfoRetriever()) != null)
- converterTypeName = memberInfo.CustomAttributes.GetTypeConverterTypeName() ?? converterTypeName;
- if (converterTypeName == null)
- return null;
-
- var convertertype = Type.GetType(converterTypeName);
- return Activator.CreateInstance(convertertype);
- };
-
- return ConvertTo(value, toType, getConverter, serviceProvider);
- }
-
- static string GetTypeConverterTypeName(this IEnumerable<CustomAttributeData> attributes)
- {
- var converterAttribute =
- attributes.FirstOrDefault(cad => TypeConverterAttribute.TypeConvertersType.Contains(cad.AttributeType.FullName));
- if (converterAttribute == null)
- return null;
- if (converterAttribute.ConstructorArguments[0].ArgumentType == typeof (string))
- return (string)converterAttribute.ConstructorArguments[0].Value;
- if (converterAttribute.ConstructorArguments[0].ArgumentType == typeof (Type))
- return ((Type)converterAttribute.ConstructorArguments[0].Value).AssemblyQualifiedName;
- return null;
- }
-
- //Don't change the name or the signature of this, it's used by XamlC
- public static object ConvertTo(this object value, Type toType, Type convertertype, IServiceProvider serviceProvider)
- {
- if (convertertype == null)
- return value.ConvertTo(toType, (Func<object>)null, serviceProvider);
- Func<object> getConverter = () => Activator.CreateInstance(convertertype);
- ;
- 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)
- {
- if (value == null)
- return null;
-
- var str = value as string;
- if (str != null)
- {
- //If there's a [TypeConverter], use it
- object converter = getConverter?.Invoke();
- if (null != converter)
- {
- 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
- if (toType.GetTypeInfo().IsGenericType && toType.GetGenericTypeDefinition() == typeof (Nullable<>))
- toType = Nullable.GetUnderlyingType(toType);
-
- //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))
- return Int16.Parse(str, CultureInfo.InvariantCulture);
- if (toType == typeof(Int32))
- return Int32.Parse(str, CultureInfo.InvariantCulture);
- if (toType == typeof(Int64))
- return Int64.Parse(str, CultureInfo.InvariantCulture);
- if (toType == typeof(Byte))
- return Byte.Parse(str, CultureInfo.InvariantCulture);
- if (toType == typeof(UInt16))
- return UInt16.Parse(str, CultureInfo.InvariantCulture);
- if (toType == typeof(UInt32))
- return UInt32.Parse(str, CultureInfo.InvariantCulture);
- if (toType == typeof(UInt64))
- return UInt64.Parse(str, CultureInfo.InvariantCulture);
- if (toType == typeof (Single))
- return Single.Parse(str, CultureInfo.InvariantCulture);
- if (toType == typeof (Double))
- return Double.Parse(str, CultureInfo.InvariantCulture);
- if (toType == typeof (Boolean))
- return Boolean.Parse(str);
- if (toType == typeof (TimeSpan))
- return TimeSpan.Parse(str, CultureInfo.InvariantCulture);
- if (toType == typeof (DateTime))
- return DateTime.Parse(str, CultureInfo.InvariantCulture);
- if (toType == typeof(Char)) {
- char c = '\0';
- Char.TryParse(str, out c);
- return c;
- }
- if (toType == typeof (String) && str.StartsWith("{}", StringComparison.Ordinal))
- return str.Substring(2);
- if (toType == typeof (String))
- return value;
- if (toType == typeof(Decimal))
- return Decimal.Parse(str, CultureInfo.InvariantCulture);
- }
-
- //if the value is not assignable and there's an implicit conversion, convert
- if (value != null && !toType.IsAssignableFrom(value.GetType())) {
- var opImplicit = value.GetType().GetImplicitConversionOperator(fromType: value.GetType(), toType: toType)
- ?? toType.GetImplicitConversionOperator(fromType: value.GetType(), toType: toType);
-
- if (opImplicit != null) {
- value = opImplicit.Invoke(null, new[] { value });
- return value;
- }
- }
-
- var nativeValueConverterService = DependencyService.Get<INativeValueConverterService>();
-
- object nativeValue = null;
- if (nativeValueConverterService != null && nativeValueConverterService.ConvertTo(value, toType, out nativeValue))
- return nativeValue;
-
- return value;
- }
-
- internal static MethodInfo GetImplicitConversionOperator(this Type onType, Type fromType, Type toType)
- {
-#if NETSTANDARD1_0
- var mi = onType.GetRuntimeMethod("op_Implicit", new[] { fromType });
-#else
- var bindingFlags = BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy;
- var mi = onType.GetMethod("op_Implicit", bindingFlags, null, new[] { fromType }, null);
-#endif
- if (mi == null) return null;
- if (!mi.IsSpecialName) return null;
- if (!mi.IsPublic) return null;
- if (!mi.IsStatic) return null;
- if (!toType.IsAssignableFrom(mi.ReturnType)) return null;
-
- return mi;
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Reflection;
-
-using Tizen.NUI;
-using Tizen.NUI.Xaml;
-
-namespace Tizen.NUI.Xaml
-{
- internal class ValueConverterProvider : IValueConverterProvider
- {
- public object Convert(object value, Type toType, Func<MemberInfo> minfoRetriever, IServiceProvider serviceProvider)
- {
- return value.ConvertTo(toType, minfoRetriever, serviceProvider);
- }
- }
-}
+++ /dev/null
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Linq;
-using Tizen.NUI;
-using Tizen.NUI.Binding;
-
-namespace Tizen.NUI.Xaml
-{
- internal static class VisualStateManager
- {
- internal class CommonStates
- {
- public const string Normal = "Normal";
- public const string Disabled = "Disabled";
- public const string Focused = "Focused";
- }
-
- public static readonly BindableProperty VisualStateGroupsProperty =
- BindableProperty.CreateAttached("VisualStateGroups", typeof(VisualStateGroupList), typeof(/*VisualElement*/BaseHandle),
- defaultValue: null, propertyChanged: VisualStateGroupsPropertyChanged,
- defaultValueCreator: bindable => new VisualStateGroupList());
-
- static void VisualStateGroupsPropertyChanged(BindableObject bindable, object oldValue, object newValue)
- {
- GoToState((/*VisualElement*/BaseHandle)bindable, CommonStates.Normal);
- }
-
- public static IList<VisualStateGroup> GetVisualStateGroups(/*VisualElement*/BaseHandle visualElement)
- {
- return (IList<VisualStateGroup>)visualElement.GetValue(VisualStateGroupsProperty);
- }
-
- public static void SetVisualStateGroups(/*VisualElement*/BaseHandle visualElement, VisualStateGroupList value)
- {
- visualElement.SetValue(VisualStateGroupsProperty, value);
- }
-
- public static bool GoToState(/*VisualElement*/BaseHandle visualElement, string name)
- {
- if (!visualElement.IsSet(VisualStateGroupsProperty))
- {
- return false;
- }
-
- var groups = (IList<VisualStateGroup>)visualElement.GetValue(VisualStateGroupsProperty);
-
- foreach (VisualStateGroup group in groups)
- {
- if (group.CurrentState?.Name == name)
- {
- // We're already in the target state; nothing else to do
- return true;
- }
-
- // See if this group contains the new state
- var target = group.GetState(name);
- if (target == null)
- {
- continue;
- }
-
- // If we've got a new state to transition to, unapply the setters from the current state
- if (group.CurrentState != null)
- {
- foreach (Setter setter in group.CurrentState.Setters)
- {
- setter.UnApply(visualElement);
- }
- }
-
- // Update the current state
- group.CurrentState = target;
-
- // Apply the setters from the new state
- foreach (Setter setter in target.Setters)
- {
- setter.Apply(visualElement);
- }
-
- return true;
- }
-
- return false;
- }
-
- public static bool HasVisualStateGroups(this /*VisualElement*/BaseHandle element)
- {
- return element.IsSet(VisualStateGroupsProperty);
- }
- }
-
- internal class VisualStateGroupList : IList<VisualStateGroup>
- {
- readonly IList<VisualStateGroup> _internalList;
-
- void Validate(IList<VisualStateGroup> groups)
- {
- // If we have 1 group, no need to worry about duplicate group names
- if (groups.Count > 1)
- {
- if (groups.GroupBy(vsg => vsg.Name).Any(g => g.Count() > 1))
- {
- throw new InvalidOperationException("VisualStateGroup Names must be unique");
- }
- }
-
- // State names must be unique within this group list, so pull in all
- // the states in all the groups, group them by name, and see if we have
- // and duplicates
- if (groups.SelectMany(group => group.States)
- .GroupBy(state => state.Name)
- .Any(g => g.Count() > 1))
- {
- throw new InvalidOperationException("VisualState Names must be unique");
- }
- }
-
- public VisualStateGroupList()
- {
- _internalList = new WatchAddList<VisualStateGroup>(Validate);
- }
-
- void ValidateOnStatesChanged(object sender, EventArgs eventArgs)
- {
- Validate(_internalList);
- }
-
- public IEnumerator<VisualStateGroup> GetEnumerator()
- {
- return _internalList.GetEnumerator();
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- return ((IEnumerable)_internalList).GetEnumerator();
- }
-
- public void Add(VisualStateGroup item)
- {
- _internalList.Add(item);
- item.StatesChanged += ValidateOnStatesChanged;
- }
-
- public void Clear()
- {
- foreach (var group in _internalList)
- {
- group.StatesChanged -= ValidateOnStatesChanged;
- }
-
- _internalList.Clear();
- }
-
- public bool Contains(VisualStateGroup item)
- {
- return _internalList.Contains(item);
- }
-
- public void CopyTo(VisualStateGroup[] array, int arrayIndex)
- {
- _internalList.CopyTo(array, arrayIndex);
- }
-
- public bool Remove(VisualStateGroup item)
- {
- item.StatesChanged -= ValidateOnStatesChanged;
- return _internalList.Remove(item);
- }
-
- public int Count => _internalList.Count;
-
- public bool IsReadOnly => false;
-
- public int IndexOf(VisualStateGroup item)
- {
- return _internalList.IndexOf(item);
- }
-
- public void Insert(int index, VisualStateGroup item)
- {
- item.StatesChanged += ValidateOnStatesChanged;
- _internalList.Insert(index, item);
- }
-
- public void RemoveAt(int index)
- {
- _internalList[index].StatesChanged -= ValidateOnStatesChanged;
- _internalList.RemoveAt(index);
- }
-
- public VisualStateGroup this[int index]
- {
- get => _internalList[index];
- set => _internalList[index] = value;
- }
- }
-
- [RuntimeNameProperty(nameof(Name))]
- [ContentProperty(nameof(States))]
- internal sealed class VisualStateGroup
- {
- public VisualStateGroup()
- {
- States = new WatchAddList<VisualState>(OnStatesChanged);
- }
-
- public Type TargetType { get; set; }
- public string Name { get; set; }
- public IList<VisualState> States { get; }
- public VisualState CurrentState { get; internal set; }
-
- internal VisualState GetState(string name)
- {
- foreach (VisualState state in States)
- {
- if (string.CompareOrdinal(state.Name, name) == 0)
- {
- return state;
- }
- }
-
- return null;
- }
-
- internal VisualStateGroup Clone()
- {
- var clone = new VisualStateGroup {TargetType = TargetType, Name = Name, CurrentState = CurrentState};
- foreach (VisualState state in States)
- {
- clone.States.Add(state.Clone());
- }
-
- return clone;
- }
-
- internal event EventHandler StatesChanged;
-
- void OnStatesChanged(IList<VisualState> list)
- {
- if (list.Any(state => string.IsNullOrEmpty(state.Name)))
- {
- throw new InvalidOperationException("State names may not be null or empty");
- }
-
- StatesChanged?.Invoke(this, EventArgs.Empty);
- }
- }
-
- [RuntimeNameProperty(nameof(Name))]
- internal sealed class VisualState
- {
- public VisualState()
- {
- Setters = new ObservableCollection<Setter>();
- }
-
- public string Name { get; set; }
- public IList<Setter> Setters { get;}
- public Type TargetType { get; set; }
-
- internal VisualState Clone()
- {
- var clone = new VisualState { Name = Name, TargetType = TargetType };
- foreach (var setter in Setters)
- {
- clone.Setters.Add(setter);
- }
-
- return clone;
- }
- }
-
- internal static class VisualStateGroupListExtensions
- {
- internal static IList<VisualStateGroup> Clone(this IList<VisualStateGroup> groups)
- {
- var actual = new VisualStateGroupList();
- foreach (var group in groups)
- {
- actual.Add(group.Clone());
- }
-
- return actual;
- }
- }
-
- internal class WatchAddList<T> : IList<T>
- {
- readonly Action<List<T>> _onAdd;
- readonly List<T> _internalList;
-
- public WatchAddList(Action<List<T>> onAdd)
- {
- _onAdd = onAdd;
- _internalList = new List<T>();
- }
-
- public IEnumerator<T> GetEnumerator()
- {
- return _internalList.GetEnumerator();
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- return ((IEnumerable)_internalList).GetEnumerator();
- }
-
- public void Add(T item)
- {
- _internalList.Add(item);
- _onAdd(_internalList);
- }
-
- public void Clear()
- {
- _internalList.Clear();
- }
-
- public bool Contains(T item)
- {
- return _internalList.Contains(item);
- }
-
- public void CopyTo(T[] array, int arrayIndex)
- {
- _internalList.CopyTo(array, arrayIndex);
- }
-
- public bool Remove(T item)
- {
- return _internalList.Remove(item);
- }
-
- public int Count => _internalList.Count;
-
- public bool IsReadOnly => false;
-
- public int IndexOf(T item)
- {
- return _internalList.IndexOf(item);
- }
-
- public void Insert(int index, T item)
- {
- _internalList.Insert(index, item);
- _onAdd(_internalList);
- }
-
- public void RemoveAt(int index)
- {
- _internalList.RemoveAt(index);
- }
-
- public T this[int index]
- {
- get => _internalList[index];
- set => _internalList[index] = value;
- }
- }
-}
+++ /dev/null
-using System;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-namespace Tizen.NUI.Xaml
-{
- [Flags]
- internal enum XamlCompilationOptions
- {
- Skip = 1 << 0,
- Compile = 1 << 1
- }
-
- [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class, Inherited = false)]
- internal sealed class XamlCompilationAttribute : Attribute
- {
- public XamlCompilationAttribute(XamlCompilationOptions xamlCompilationOptions)
- {
- XamlCompilationOptions = xamlCompilationOptions;
- }
-
- public XamlCompilationOptions XamlCompilationOptions { get; set; }
- }
-
- internal static class XamlCExtensions
- {
- public static bool IsCompiled(this Type type)
- {
- var attr = type.GetTypeInfo().GetCustomAttribute<XamlCompilationAttribute>();
- if (attr != null)
- return attr.XamlCompilationOptions == XamlCompilationOptions.Compile;
- attr = type.GetTypeInfo().Module.GetCustomAttribute<XamlCompilationAttribute>();
- if (attr != null)
- return attr.XamlCompilationOptions == XamlCompilationOptions.Compile;
- attr = type.GetTypeInfo().Assembly.GetCustomAttribute<XamlCompilationAttribute>();
- if (attr != null)
- return attr.XamlCompilationOptions == XamlCompilationOptions.Compile;
-
- return false;
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Runtime.CompilerServices;
-
-namespace Tizen.NUI.Xaml
-{
- [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
- internal sealed class XamlFilePathAttribute : Attribute
- {
- public XamlFilePathAttribute([CallerFilePath] string filePath = "")
- {
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-//
-// XamlLoader.cs
-//
-// Author:
-// Stephane Delcroix <stephane@mi8.be>
-//
-// Copyright (c) 2018 Mobile Inception
-// Copyright (c) 2018-2014 Xamarin, Inc
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-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;
-
-namespace Tizen.NUI.Xaml.Internals
-{
- [Obsolete ("Replaced by ResourceLoader")]
- internal static class XamlLoader
- {
- static Func<Type, string> xamlFileProvider;
-
- public static Func<Type, string> XamlFileProvider {
- get { return xamlFileProvider; }
- internal set {
- xamlFileProvider = value;
- Tizen.NUI.Xaml.DesignMode.IsDesignModeEnabled = true;
- //¯\_(ツ)_/¯ the previewer forgot to set that bool
- DoNotThrowOnExceptions = value != null;
- }
- }
-
- internal static bool DoNotThrowOnExceptions { get; set; }
- }
-}
-
-namespace Tizen.NUI.Xaml
-{
- static internal class XamlLoader
- {
- public static void Load(object view, Type callingType)
- {
- try
- {
- 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);
- }
- }
-
- public static T LoadObject<T>(string path)
- {
- var xaml = GetAnimationXaml(path);
- if (string.IsNullOrEmpty(xaml))
- 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))
- {
- 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), ret, (IXmlNamespaceResolver)reader);
- XamlParser.ParseXaml(rootnode, reader);
- Visit(rootnode, new HydrationContext
- {
- RootElement = ret,
-#pragma warning disable 0618
- ExceptionHandler = ResourceLoader.ExceptionHandler ?? (Internals.XamlLoader.DoNotThrowOnExceptions ? e => { } : (Action<Exception>)null)
-#pragma warning restore 0618
- });
- break;
- }
- }
-
- NameScopeExtensions.PopElement();
- return ret;
- }
-
- public static void Load(object view, string xaml)
- {
- using (var textReader = new StringReader(xaml))
- using (var reader = XmlReader.Create(textReader))
- {
- 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;
- }
-
- if (view is Element)
- {
- (view as Element).IsCreateByXaml = true;
- }
-
- var rootnode = new RuntimeRootNode (new XmlType (reader.NamespaceURI, reader.Name, null), view, (IXmlNamespaceResolver)reader);
- XamlParser.ParseXaml (rootnode, reader);
- Visit (rootnode, new HydrationContext {
- RootElement = view,
-#pragma warning disable 0618
- ExceptionHandler = ResourceLoader.ExceptionHandler ?? (Internals.XamlLoader.DoNotThrowOnExceptions ? e => { }: (Action<Exception>)null)
-#pragma warning restore 0618
- });
- break;
- }
- }
- }
-
- [Obsolete ("Use the XamlFileProvider to provide xaml files. We will remove this when Cycle 8 hits Stable.")]
- public static object Create (string xaml, bool doNotThrow = false)
- {
- object inflatedView = null;
- using (var textreader = new StringReader(xaml))
- using (var reader = XmlReader.Create (textreader)) {
- 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), null, (IXmlNamespaceResolver)reader);
- XamlParser.ParseXaml (rootnode, reader);
- var visitorContext = new HydrationContext {
- ExceptionHandler = doNotThrow ? e => { } : (Action<Exception>)null,
- };
- var cvv = new CreateValuesVisitor (visitorContext);
- cvv.Visit ((ElementNode)rootnode, null);
- inflatedView = rootnode.Root = visitorContext.Values [rootnode];
- visitorContext.RootElement = inflatedView as BindableObject;
-
- Visit (rootnode, visitorContext);
- break;
- }
- }
- return inflatedView;
- }
-
- static void Visit (RootNode rootnode, HydrationContext visitorContext)
- {
- rootnode.Accept (new XamlNodeVisitor ((node, parent) => node.Parent = parent), null); //set parents for {StaticResource}
- rootnode.Accept (new ExpandMarkupsVisitor (visitorContext), null);
- rootnode.Accept (new PruneIgnoredNodesVisitor(), null);
- rootnode.Accept (new NamescopingVisitor (visitorContext), null); //set namescopes for {x:Reference}
- rootnode.Accept (new CreateValuesVisitor (visitorContext), null);
- rootnode.Accept (new RegisterXNamesVisitor (visitorContext), null);
- rootnode.Accept (new FillResourceDictionariesVisitor (visitorContext), null);
- rootnode.Accept (new ApplyPropertiesVisitor (visitorContext, true), null);
- }
-
- static string GetAnimationXaml(string animationXamlPath)
- {
- string xaml;
- if (File.Exists(animationXamlPath))
- {
- StreamReader reader = new StreamReader(animationXamlPath);
- xaml = reader.ReadToEnd();
- reader.Close();
- reader.Dispose();
- Tizen.Log.Fatal("NUI", "File is exist!, try with xaml: " + xaml);
- return xaml;
- }
-
- return null;
- }
- static string GetXamlForType(Type type)
- {
- //the Previewer might want to provide it's own xaml for this... let them do that
- //the check at the end is preferred (using ResourceLoader). keep this until all the previewers are updated
-
- string xaml;
- string resourceName = type.Name + ".xaml";
- string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
-
- Tizen.Log.Fatal("NUI", "the resource path: " + resource);
- int windowWidth = Window.Instance.Size.Width;
- int windowHeight = Window.Instance.Size.Height;
-
- string likelyResourcePath = resource + "layout/" + windowWidth.ToString() + "x" + windowHeight.ToString() + "/" + resourceName;
- Tizen.Log.Fatal("NUI", "the resource path: " + likelyResourcePath);
-
- if (!File.Exists(likelyResourcePath))
- {
- likelyResourcePath = resource + "layout/" + resourceName;
- }
-
- //Find the xaml file in the layout folder
- if (File.Exists(likelyResourcePath))
- {
- StreamReader reader = new StreamReader(likelyResourcePath);
- xaml = reader.ReadToEnd();
- reader.Close();
- reader.Dispose();
- Tizen.Log.Fatal("NUI", "File is exist!, try with xaml: " + xaml);
- var pattern = String.Format("x:Class *= *\"{0}\"", type.FullName);
- var regex = new Regex(pattern, RegexOptions.ECMAScript);
- if (regex.IsMatch(xaml) || xaml.Contains(String.Format("x:Class=\"{0}\"", type.FullName)))
- {
- return xaml;
- }
- else
- {
- throw new XamlParseException(string.Format("Can't find type {0}", type.FullName), new XmlLineInfo());
- }
- }
-
- return null;
- }
-
- //if the assembly was generated using a version of XamlG that doesn't outputs XamlResourceIdAttributes, we still need to find the resource, and load it
- static readonly Dictionary<Type, string> XamlResources = new Dictionary<Type, string>();
- static string LegacyGetXamlForType(Type type)
- {
- var assembly = type.GetTypeInfo().Assembly;
-
- string resourceId;
- if (XamlResources.TryGetValue(type, out resourceId)) {
- var result = ReadResourceAsXaml(type, assembly, resourceId);
- if (result != null)
- return result;
- }
-
- var likelyResourceName = type.Name + ".xaml";
- var resourceNames = assembly.GetManifestResourceNames();
- string resourceName = null;
-
- // first pass, pray to find it because the user named it correctly
-
- foreach (var resource in resourceNames) {
- if (ResourceMatchesFilename(assembly, resource, likelyResourceName)) {
- resourceName = resource;
- var xaml = ReadResourceAsXaml(type, assembly, resource);
- if (xaml != null)
- return xaml;
- }
- }
-
- // okay maybe they at least named it .xaml
-
- foreach (var resource in resourceNames) {
- if (!resource.EndsWith(".xaml", StringComparison.OrdinalIgnoreCase))
- continue;
-
- resourceName = resource;
- var xaml = ReadResourceAsXaml(type, assembly, resource);
- if (xaml != null)
- return xaml;
- }
-
- foreach (var resource in resourceNames) {
- if (resource.EndsWith(".xaml", StringComparison.OrdinalIgnoreCase))
- continue;
-
- resourceName = resource;
- var xaml = ReadResourceAsXaml(type, assembly, resource, true);
- if (xaml != null)
- return xaml;
- }
-
- return null;
- }
-
- //legacy...
- static bool ResourceMatchesFilename(Assembly assembly, string resource, string filename)
- {
- try {
- var info = assembly.GetManifestResourceInfo(resource);
-
- if (!string.IsNullOrEmpty(info.FileName) &&
- string.Compare(info.FileName, filename, StringComparison.OrdinalIgnoreCase) == 0)
- return true;
- }
- catch (PlatformNotSupportedException) {
- // Because Win10 + .NET Native
- }
-
- if (resource.EndsWith("." + filename, StringComparison.OrdinalIgnoreCase) ||
- string.Compare(resource, filename, StringComparison.OrdinalIgnoreCase) == 0)
- return true;
-
- return false;
- }
-
- //part of the legacy as well...
- static string ReadResourceAsXaml(Type type, Assembly assembly, string likelyTargetName, bool validate = false)
- {
- using (var stream = assembly.GetManifestResourceStream(likelyTargetName))
- using (var reader = new StreamReader(stream)) {
- if (validate) {
- // terrible validation of XML. Unfortunately it will probably work most of the time since comments
- // also start with a <. We can't bring in any real deps.
-
- var firstNonWhitespace = (char)reader.Read();
- while (char.IsWhiteSpace(firstNonWhitespace))
- firstNonWhitespace = (char)reader.Read();
-
- if (firstNonWhitespace != '<')
- return null;
-
- stream.Seek(0, SeekOrigin.Begin);
- }
-
- var xaml = reader.ReadToEnd();
-
- var pattern = String.Format("x:Class *= *\"{0}\"", type.FullName);
- var regex = new Regex(pattern, RegexOptions.ECMAScript);
- if (regex.IsMatch(xaml) || xaml.Contains(String.Format("x:Class=\"{0}\"", type.FullName)))
- return xaml;
- }
- return null;
- }
-
- public class RuntimeRootNode : RootNode
- {
- public RuntimeRootNode(XmlType xmlType, object root, IXmlNamespaceResolver resolver) : base (xmlType, resolver)
- {
- Root = root;
- }
-
- public object Root { get; internal set; }
- }
- }
-}
+++ /dev/null
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Xml;
-using Tizen.NUI.Binding;
-using Tizen.NUI.Binding.Internals;
-
-namespace Tizen.NUI.Xaml
-{
- internal interface INode
- {
- List<string> IgnorablePrefixes { get; set; }
-
- IXmlNamespaceResolver NamespaceResolver { get; }
-
- INode Parent { get; set; }
-
- void Accept(IXamlNodeVisitor visitor, INode parentNode);
- INode Clone();
- }
-
- internal interface IValueNode : INode
- {
- }
-
- internal interface IElementNode : INode, IListNode
- {
- Dictionary<XmlName, INode> Properties { get; }
- List<XmlName> SkipProperties { get; }
- INameScope Namescope { get; }
- XmlType XmlType { get; }
- string NamespaceURI { get; }
- }
-
- internal interface IListNode : INode
- {
- List<INode> CollectionItems { get; }
- }
-
- [DebuggerDisplay("{NamespaceUri}:{Name}")]
- internal class XmlType
- {
- public XmlType(string namespaceUri, string name, IList<XmlType> typeArguments)
- {
- NamespaceUri = namespaceUri;
- Name = name;
- TypeArguments = typeArguments;
- }
-
- public string NamespaceUri { get; }
- public string Name { get; }
- public IList<XmlType> TypeArguments { get; }
- }
-
- internal abstract class BaseNode : IXmlLineInfo, INode
- {
- protected BaseNode(IXmlNamespaceResolver namespaceResolver, int linenumber = -1, int lineposition = -1)
- {
- NamespaceResolver = namespaceResolver;
- LineNumber = linenumber;
- LinePosition = lineposition;
- }
-
- public IXmlNamespaceResolver NamespaceResolver { get; }
- public INode Parent { get; set; }
- public List<string> IgnorablePrefixes { get; set; }
- public int LineNumber { get; set; }
- public int LinePosition { get; set; }
-
- public bool HasLineInfo() => LineNumber >= 0 && LinePosition >= 0;
-
- public abstract void Accept(IXamlNodeVisitor visitor, INode parentNode);
- public abstract INode Clone();
- }
-
- [DebuggerDisplay("{Value}")]
- internal class ValueNode : BaseNode, IValueNode
- {
- public ValueNode(object value, IXmlNamespaceResolver namespaceResolver, int linenumber = -1, int lineposition = -1)
- : base(namespaceResolver, linenumber, lineposition)
- {
- Value = value;
- }
-
- public object Value { get; set; }
-
- public override void Accept(IXamlNodeVisitor visitor, INode parentNode)
- {
- visitor.Visit(this, parentNode);
- }
-
- public override INode Clone() => new ValueNode(Value, NamespaceResolver, LineNumber, LinePosition) {
- IgnorablePrefixes = IgnorablePrefixes
- };
- }
-
- [DebuggerDisplay("{MarkupString}")]
- internal class MarkupNode : BaseNode, IValueNode
- {
- public MarkupNode(string markupString, IXmlNamespaceResolver namespaceResolver, int linenumber = -1, int lineposition = -1)
- : base(namespaceResolver, linenumber, lineposition)
- {
- MarkupString = markupString;
- }
-
- public string MarkupString { get; }
-
- public override void Accept(IXamlNodeVisitor visitor, INode parentNode)
- {
- visitor.Visit(this, parentNode);
- }
-
- public override INode Clone() => new MarkupNode(MarkupString, NamespaceResolver, LineNumber, LinePosition) {
- IgnorablePrefixes = IgnorablePrefixes
- };
- }
-
- [DebuggerDisplay("{XmlType.Name}")]
- internal class ElementNode : BaseNode, IValueNode, IElementNode
- {
- public ElementNode(XmlType type, string namespaceURI, IXmlNamespaceResolver namespaceResolver, int linenumber = -1,
- int lineposition = -1)
- : base(namespaceResolver, linenumber, lineposition)
- {
- Properties = new Dictionary<XmlName, INode>();
- SkipProperties = new List<XmlName>();
- CollectionItems = new List<INode>();
- XmlType = type;
- NamespaceURI = namespaceURI;
- }
-
- public Dictionary<XmlName, INode> Properties { get; }
- public List<XmlName> SkipProperties { get; }
- public List<INode> CollectionItems { get; }
- public XmlType XmlType { get; }
- public string NamespaceURI { get; }
- public INameScope Namescope { get; set; }
-
- public override void Accept(IXamlNodeVisitor visitor, INode parentNode)
- {
- if (!SkipVisitNode(visitor, parentNode) && visitor.VisitingMode == TreeVisitingMode.TopDown)
- visitor.Visit(this, parentNode);
-
- if (!SkipChildren(visitor, this, parentNode)) {
- foreach (var node in Properties.Values.ToList())
- node.Accept(visitor, this);
- foreach (var node in CollectionItems)
- node.Accept(visitor, this);
- }
-
- if (!SkipVisitNode(visitor, parentNode) && visitor.VisitingMode == TreeVisitingMode.BottomUp)
- visitor.Visit(this, parentNode);
-
- }
-
- bool IsDataTemplate(INode parentNode)
- {
- var parentElement = parentNode as IElementNode;
- INode createContent;
- if (parentElement != null &&
- parentElement.Properties.TryGetValue(XmlName._CreateContent, out createContent) &&
- createContent == this)
- return true;
- return false;
- }
-
- protected bool SkipChildren(IXamlNodeVisitor visitor, INode node, INode parentNode) =>
- (visitor.StopOnDataTemplate && IsDataTemplate(parentNode))
- || (visitor.StopOnResourceDictionary && visitor.IsResourceDictionary(this))
- || visitor.SkipChildren(node, parentNode);
-
- protected bool SkipVisitNode(IXamlNodeVisitor visitor, INode parentNode) =>
- !visitor.VisitNodeOnDataTemplate && IsDataTemplate(parentNode);
-
- public override INode Clone()
- {
- var clone = new ElementNode(XmlType, NamespaceURI, NamespaceResolver, LineNumber, LinePosition) {
- IgnorablePrefixes = IgnorablePrefixes
- };
- foreach (var kvp in Properties)
- clone.Properties.Add(kvp.Key, kvp.Value.Clone());
- foreach (var p in SkipProperties)
- clone.SkipProperties.Add(p);
- foreach (var p in CollectionItems)
- clone.CollectionItems.Add(p.Clone());
- return clone;
- }
- }
-
- internal abstract class RootNode : ElementNode
- {
- protected RootNode(XmlType xmlType, IXmlNamespaceResolver nsResolver) : base(xmlType, xmlType.NamespaceUri, nsResolver)
- {
- }
-
- public override void Accept(IXamlNodeVisitor visitor, INode parentNode)
- {
- if (!SkipVisitNode(visitor, parentNode) && visitor.VisitingMode == TreeVisitingMode.TopDown)
- visitor.Visit(this, parentNode);
-
- if (!SkipChildren(visitor, this, parentNode)) {
- foreach (var node in Properties.Values.ToList())
- node.Accept(visitor, this);
- foreach (var node in CollectionItems)
- node.Accept(visitor, this);
- }
-
- if (!SkipVisitNode(visitor, parentNode) && visitor.VisitingMode == TreeVisitingMode.BottomUp)
- visitor.Visit(this, parentNode);
- }
- }
-
- internal class ListNode : BaseNode, IListNode, IValueNode
- {
- public ListNode(IList<INode> nodes, IXmlNamespaceResolver namespaceResolver, int linenumber = -1, int lineposition = -1)
- : base(namespaceResolver, linenumber, lineposition)
- {
- CollectionItems = nodes.ToList();
- }
-
- public XmlName XmlName { get; set; }
- public List<INode> CollectionItems { get; set; }
-
- public override void Accept(IXamlNodeVisitor visitor, INode parentNode)
- {
- if (visitor.VisitingMode == TreeVisitingMode.TopDown)
- visitor.Visit(this, parentNode);
- foreach (var node in CollectionItems)
- node.Accept(visitor, this);
- if (visitor.VisitingMode == TreeVisitingMode.BottomUp)
- visitor.Visit(this, parentNode);
- }
-
- public override INode Clone()
- {
- var items = new List<INode>();
- foreach (var p in CollectionItems)
- items.Add(p.Clone());
- return new ListNode(items, NamespaceResolver, LineNumber, LinePosition) {
- IgnorablePrefixes = IgnorablePrefixes
- };
- }
- }
-
- internal static class INodeExtensions
- {
- public static bool SkipPrefix(this INode node, string prefix)
- {
- do {
- if (node.IgnorablePrefixes != null && node.IgnorablePrefixes.Contains(prefix))
- return true;
- node = node.Parent;
- } while (node != null);
- return false;
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Xaml
-{
- internal interface IXamlNodeVisitor
- {
- TreeVisitingMode VisitingMode { get; }
- bool StopOnDataTemplate { get; }
- bool VisitNodeOnDataTemplate { get; }
- bool StopOnResourceDictionary { get; }
-
- void Visit(ValueNode node, INode parentNode);
- void Visit(MarkupNode node, INode parentNode);
- void Visit(ElementNode node, INode parentNode);
- 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 {
- TopDown,
- BottomUp
- }
-
- internal class XamlNodeVisitor : IXamlNodeVisitor
- {
- readonly Action<INode, INode> action;
-
- public XamlNodeVisitor(Action<INode, INode> action, TreeVisitingMode visitingMode = TreeVisitingMode.TopDown, bool stopOnDataTemplate = false, bool visitNodeOnDataTemplate = true)
- {
- this.action = action;
- VisitingMode = visitingMode;
- StopOnDataTemplate = stopOnDataTemplate;
- VisitNodeOnDataTemplate = visitNodeOnDataTemplate;
- }
-
- public TreeVisitingMode VisitingMode { get; }
- public bool StopOnDataTemplate { get; }
- public bool StopOnResourceDictionary { get; }
- public bool VisitNodeOnDataTemplate { get; }
-
- public void Visit(ValueNode node, INode parentNode) => action(node, parentNode);
- public void Visit(MarkupNode node, INode parentNode) => action(node, parentNode);
- public void Visit(ElementNode node, INode parentNode) => action(node, parentNode);
- 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
+++ /dev/null
-using System;
-using System.Diagnostics;
-using System.Text;
-using System.Xml;
-
-namespace Tizen.NUI.Xaml
-{
- internal class XamlParseException : Exception
- {
- readonly string _unformattedMessage;
-
- 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;
- }
-
- public IXmlLineInfo XmlInfo { get; private set; }
-
- internal string UnformattedMessage
- {
- get { return _unformattedMessage ?? Message; }
- }
-
- static string FormatMessage(string message, IXmlLineInfo xmlinfo)
- {
- if (xmlinfo == null || !xmlinfo.HasLineInfo())
- return message;
- return string.Format("Position {0}:{1}. {2}", xmlinfo.LineNumber, xmlinfo.LinePosition, message);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-//
-// XamlParser.cs
-//
-// Author:
-// Stephane Delcroix <stephane@mi8.be>
-//
-// Copyright (c) 2013 Mobile Inception
-// Copyright (c) 2013-2014 Xamarin, Inc
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Reflection;
-using System.Xml;
-using Tizen.NUI.Binding;
-using Tizen.NUI.BaseComponents;
-using Tizen.NUI.UIComponents;
-using Tizen.NUI.Binding.Internals;
-
-namespace Tizen.NUI.Xaml
-{
- internal static class XamlParser
- {
- 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";
- public const string McUri = "http://schemas.openxmlformats.org/markup-compatibility/2006";
-
- public static void ParseXaml(RootNode rootNode, XmlReader reader)
- {
- IList<KeyValuePair<string, string>> xmlns;
- var attributes = ParseXamlAttributes(reader, out xmlns);
- var prefixes = PrefixesToIgnore(xmlns);
- (rootNode.IgnorablePrefixes ?? (rootNode.IgnorablePrefixes=new List<string>())).AddRange(prefixes);
- rootNode.Properties.AddRange(attributes);
- ParseXamlElementFor(rootNode, reader);
- }
-
- static void ParseXamlElementFor(IElementNode node, XmlReader reader)
- {
- Debug.Assert(reader.NodeType == XmlNodeType.Element);
-
- var elementName = reader.Name;
- var isEmpty = reader.IsEmptyElement;
-
- if (isEmpty)
- return;
-
- while (reader.Read())
- {
- switch (reader.NodeType)
- {
- case XmlNodeType.EndElement:
- Debug.Assert(reader.Name == elementName); //make sure we close the right element
- return;
- case XmlNodeType.Element:
- // 1. Property Element.
- if (reader.Name.Contains("."))
- {
- XmlName name;
- if (reader.Name.StartsWith(elementName + ".", StringComparison.Ordinal))
- name = new XmlName(reader.NamespaceURI, reader.Name.Substring(elementName.Length + 1));
- else //Attached DP
- name = new XmlName(reader.NamespaceURI, reader.LocalName);
-
- var prop = ReadNode(reader);
- if (prop != null)
- node.Properties.Add(name, prop);
- }
- // 2. Xaml2009 primitives, x:Arguments, ...
- else if (reader.NamespaceURI == X2009Uri && reader.LocalName == "Arguments")
- {
- var prop = ReadNode(reader);
- if (prop != null)
- node.Properties.Add(XmlName.xArguments, prop);
- }
- // 3. DataTemplate (should be handled by 4.)
- else if ((node.XmlType.NamespaceUri == XFUri || node.XmlType.NamespaceUri == NUI2018Uri) &&
- (node.XmlType.Name == "DataTemplate" || node.XmlType.Name == "ControlTemplate"))
- {
- var prop = ReadNode(reader, true);
- if (prop != null)
- node.Properties.Add(XmlName._CreateContent, prop);
- }
- // 4. Implicit content, implicit collection, or collection syntax. Add to CollectionItems, resolve case later.
- else
- {
- var item = ReadNode(reader, true);
- if (item != null)
- node.CollectionItems.Add(item);
- }
- break;
- case XmlNodeType.Whitespace:
- break;
- case XmlNodeType.Text:
- case XmlNodeType.CDATA:
- if (node.CollectionItems.Count == 1 && node.CollectionItems[0] is ValueNode)
- ((ValueNode)node.CollectionItems[0]).Value += reader.Value.Trim();
- else
- node.CollectionItems.Add(new ValueNode(reader.Value.Trim(), (IXmlNamespaceResolver)reader));
- break;
- default:
- Debug.WriteLine("Unhandled node {0} {1} {2}", reader.NodeType, reader.Name, reader.Value);
- break;
- }
- }
- }
-
- static INode ReadNode(XmlReader reader, bool nested = false)
- {
- var skipFirstRead = nested;
- Debug.Assert(reader.NodeType == XmlNodeType.Element);
- var name = reader.Name;
- List<INode> nodes = new List<INode>();
- INode node = null;
-
- while (skipFirstRead || reader.Read())
- {
- skipFirstRead = false;
-
- switch (reader.NodeType)
- {
- case XmlNodeType.EndElement:
- Debug.Assert(reader.Name == name);
- if (nodes.Count == 0) //Empty element
- return null;
- if (nodes.Count == 1)
- return nodes[0];
- return new ListNode(nodes, (IXmlNamespaceResolver)reader, ((IXmlLineInfo)reader).LineNumber,
- ((IXmlLineInfo)reader).LinePosition);
- case XmlNodeType.Element:
- var isEmpty = reader.IsEmptyElement && reader.Name == name;
- var elementName = reader.Name;
- var elementNsUri = reader.NamespaceURI;
- var elementXmlInfo = (IXmlLineInfo)reader;
- IList<KeyValuePair<string, string>> xmlns;
-
- var attributes = ParseXamlAttributes(reader, out xmlns);
- var prefixes = PrefixesToIgnore(xmlns);
-
- IList<XmlType> typeArguments = null;
- if (attributes.Any(kvp => kvp.Key == XmlName.xTypeArguments))
- {
- typeArguments =
- ((ValueNode)attributes.First(kvp => kvp.Key == XmlName.xTypeArguments).Value).Value as IList<XmlType>;
- }
-
- node = new ElementNode(new XmlType(elementNsUri, elementName, typeArguments), elementNsUri,
- reader as IXmlNamespaceResolver, elementXmlInfo.LineNumber, elementXmlInfo.LinePosition);
- ((IElementNode)node).Properties.AddRange(attributes);
- (node.IgnorablePrefixes ?? (node.IgnorablePrefixes = new List<string>()))?.AddRange(prefixes);
-
- ParseXamlElementFor((IElementNode)node, reader);
- nodes.Add(node);
- if (isEmpty || nested)
- return node;
- break;
- case XmlNodeType.Text:
- node = new ValueNode(reader.Value.Trim(), (IXmlNamespaceResolver)reader, ((IXmlLineInfo)reader).LineNumber,
- ((IXmlLineInfo)reader).LinePosition);
- nodes.Add(node);
- break;
- case XmlNodeType.Whitespace:
- break;
- default:
- Debug.WriteLine("Unhandled node {0} {1} {2}", reader.NodeType, reader.Name, reader.Value);
- break;
- }
- }
- throw new XamlParseException("Closing PropertyElement expected", (IXmlLineInfo)reader);
- }
-
- static IList<KeyValuePair<XmlName, INode>> ParseXamlAttributes(XmlReader reader, out IList<KeyValuePair<string,string>> xmlns)
- {
- Debug.Assert(reader.NodeType == XmlNodeType.Element);
- var attributes = new List<KeyValuePair<XmlName, INode>>();
- xmlns = new List<KeyValuePair<string, string>>();
- for (var i = 0; i < reader.AttributeCount; i++)
- {
- reader.MoveToAttribute(i);
-
- //skip xmlns
- if (reader.NamespaceURI == "http://www.w3.org/2000/xmlns/") {
- xmlns.Add(new KeyValuePair<string, string>(reader.LocalName, reader.Value));
- continue;
- }
-
- var namespaceUri = reader.NamespaceURI;
- if (reader.LocalName.Contains(".") && namespaceUri == "")
- namespaceUri = ((IXmlNamespaceResolver)reader).LookupNamespace("");
- var propertyName = new XmlName(namespaceUri, reader.LocalName);
-
- object value = reader.Value;
-
- if (reader.NamespaceURI == X2006Uri)
- {
- switch (reader.Name) {
- case "x:Key":
- propertyName = XmlName.xKey;
- break;
- case "x:Name":
- propertyName = XmlName.xName;
- break;
- case "x:Class":
- case "x:FieldModifier":
- continue;
- default:
- Debug.WriteLine("Unhandled attribute {0}", reader.Name);
- continue;
- }
- }
-
- if (reader.NamespaceURI == X2009Uri)
- {
- switch (reader.Name) {
- case "x:Key":
- propertyName = XmlName.xKey;
- break;
- case "x:Name":
- propertyName = XmlName.xName;
- break;
- case "x:TypeArguments":
- propertyName = XmlName.xTypeArguments;
- value = TypeArgumentsParser.ParseExpression((string)value, (IXmlNamespaceResolver)reader, (IXmlLineInfo)reader);
- break;
- case "x:DataType":
- propertyName = XmlName.xDataType;
- break;
- case "x:Class":
- case "x:FieldModifier":
- continue;
- case "x:FactoryMethod":
- propertyName = XmlName.xFactoryMethod;
- break;
- case "x:Arguments":
- propertyName = XmlName.xArguments;
- break;
- default:
- Debug.WriteLine("Unhandled attribute {0}", reader.Name);
- continue;
- }
- }
-
- var propertyNode = GetValueNode(value, reader);
- attributes.Add(new KeyValuePair<XmlName, INode>(propertyName, propertyNode));
- }
- reader.MoveToElement();
- return attributes;
- }
-
- static IList<string> PrefixesToIgnore(IList<KeyValuePair<string, string>> xmlns)
- {
- var prefixes = new List<string>();
- foreach (var kvp in xmlns) {
- var prefix = kvp.Key;
-
- string typeName = null, ns = null, asm = null, targetPlatform = null;
- XmlnsHelper.ParseXmlns(kvp.Value, out typeName, out ns, out asm, out targetPlatform);
- if (targetPlatform == null)
- continue;
- try {
- if (targetPlatform != Device.RuntimePlatform)
- {
- // Special case for Windows backward compatibility
- if (targetPlatform == "Windows" && Device.RuntimePlatform == Device.UWP)
- continue;
-
- prefixes.Add(prefix);
- }
- } catch (InvalidOperationException) {
- prefixes.Add(prefix);
- }
- }
- return prefixes;
- }
-
- static IValueNode GetValueNode(object value, XmlReader reader)
- {
- var valueString = value as string;
- if (valueString != null && valueString.Trim().StartsWith("{}", StringComparison.Ordinal))
- {
- return new ValueNode(valueString.Substring(2), (IXmlNamespaceResolver)reader, ((IXmlLineInfo)reader).LineNumber,
- ((IXmlLineInfo)reader).LinePosition);
- }
- if (valueString != null && valueString.Trim().StartsWith("{", StringComparison.Ordinal))
- {
- return new MarkupNode(valueString.Trim(), reader as IXmlNamespaceResolver, ((IXmlLineInfo)reader).LineNumber,
- ((IXmlLineInfo)reader).LinePosition);
- }
- return new ValueNode(value, (IXmlNamespaceResolver)reader, ((IXmlLineInfo)reader).LineNumber,
- ((IXmlLineInfo)reader).LinePosition);
- }
-
- static IList<XmlnsDefinitionAttribute> s_xmlnsDefinitions;
- public static IList<Assembly> s_assemblies = new List<Assembly>();// = new Assembly[]{};
-
- static void GatherXmlnsDefinitionAttributes()
- {
- //this could be extended to look for [XmlnsDefinition] in all assemblies
- // var assemblies = new [] {
- // typeof(View).GetTypeInfo().Assembly,
- // //typeof(XamlLoader).GetTypeInfo().Assembly,
- // };
- // s_assemblies = new Assembly[]{typeof(View).GetTypeInfo().Assembly};
- s_assemblies.Add(typeof(View).GetTypeInfo().Assembly);
-
- s_xmlnsDefinitions = new List<XmlnsDefinitionAttribute>();
-
- foreach (var assembly in s_assemblies)
- foreach (XmlnsDefinitionAttribute attribute in assembly.GetCustomAttributes(typeof(XmlnsDefinitionAttribute))) {
- s_xmlnsDefinitions.Add(attribute);
- attribute.AssemblyName = attribute.AssemblyName ?? assembly.FullName;
- }
- }
-
- public static Type GetElementType(XmlType xmlType, IXmlLineInfo xmlInfo, Assembly currentAssembly,
- out XamlParseException exception)
- {
- if (s_xmlnsDefinitions == null)
- GatherXmlnsDefinitionAttributes();
-
- var namespaceURI = xmlType.NamespaceUri;
- var elementName = xmlType.Name;
- var typeArguments = xmlType.TypeArguments;
- exception = null;
-
- var lookupAssemblies = new List<XmlnsDefinitionAttribute>();
- var lookupNames = new List<string>();
-
- foreach (var xmlnsDef in s_xmlnsDefinitions) {
- if (xmlnsDef.XmlNamespace != namespaceURI)
- continue;
- lookupAssemblies.Add(xmlnsDef);
- }
-
- if (lookupAssemblies.Count == 0) {
- string ns, asmstring, _;
- XmlnsHelper.ParseXmlns(namespaceURI, out _, out ns, out asmstring, out _);
- lookupAssemblies.Add(new XmlnsDefinitionAttribute(namespaceURI, ns) {
- AssemblyName = asmstring ?? currentAssembly.FullName
- });
- }
-
- lookupNames.Add(elementName);
- lookupNames.Add(elementName + "Extension");
-
- for (var i = 0; i < lookupNames.Count; i++)
- {
- var name = lookupNames[i];
- if (name.Contains(":"))
- name = name.Substring(name.LastIndexOf(':') + 1);
- if (typeArguments != null)
- name += "`" + typeArguments.Count; //this will return an open generic Type
- lookupNames[i] = name;
- }
-
- Type type = null;
- foreach (var asm in lookupAssemblies) {
- foreach (var name in lookupNames)
- if ((type = Type.GetType($"{asm.ClrNamespace}.{name}, {asm.AssemblyName}")) != null)
- break;
- if (type != null)
- break;
- }
-
- if (type != null && typeArguments != null)
- {
- XamlParseException innerexception = null;
- var args = typeArguments.Select(delegate(XmlType xmltype)
- {
- XamlParseException xpe;
- var t = GetElementType(xmltype, xmlInfo, currentAssembly, out xpe);
- if (xpe != null)
- {
- innerexception = xpe;
- return null;
- }
- return t;
- }).ToArray();
- if (innerexception != null)
- {
- exception = innerexception;
- return null;
- }
- type = type.MakeGenericType(args);
- }
-
- if (type == null)
- exception = new XamlParseException($"Type {elementName} not found in xmlns {namespaceURI}", xmlInfo);
-
- return type;
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Reflection;
-
-namespace Tizen.NUI.Xaml
-{
- [AttributeUsage(AttributeTargets.Assembly, Inherited = false, AllowMultiple = true)]
- internal sealed class XamlResourceIdAttribute : Attribute
- {
- public string ResourceId { get; set; }
- public string Path { get; set; }
- public Type Type { get; set; }
-
- public XamlResourceIdAttribute(string resourceId, string path, Type type)
- {
- ResourceId = resourceId;
- Path = path;
- Type = type;
- }
-
- internal static string GetResourceIdForType(Type type)
- {
- var assembly = type.GetTypeInfo().Assembly;
- foreach (var xria in assembly.GetCustomAttributes<XamlResourceIdAttribute>()) {
- if (xria.Type == type)
- return xria.ResourceId;
- }
- return null;
- }
-
- internal static string GetPathForType(Type type)
- {
- var assembly = type.GetTypeInfo().Assembly;
- foreach (var xria in assembly.GetCustomAttributes<XamlResourceIdAttribute>()) {
- if (xria.Type == type)
- return xria.Path;
- }
- return null;
- }
-
- internal static string GetResourceIdForPath(Assembly assembly, string path)
- {
- foreach (var xria in assembly.GetCustomAttributes<XamlResourceIdAttribute>()) {
- if (xria.Path == path)
- return xria.ResourceId;
- }
- return null;
- }
-
- internal static Type GetTypeForResourceId(Assembly assembly, string resourceId)
- {
- foreach (var xria in assembly.GetCustomAttributes<XamlResourceIdAttribute>()) {
- if (xria.ResourceId == resourceId)
- return xria.Type;
- }
- return null;
- }
-
- internal static Type GetTypeForPath(Assembly assembly, string path)
- {
- foreach (var xria in assembly.GetCustomAttributes<XamlResourceIdAttribute>()) {
- if (xria.Path == path)
- return xria.Type;
- }
- return null;
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-using System.Xml;
-using Tizen.NUI.Binding.Internals;
-
-namespace Tizen.NUI.Xaml
-{
- internal class XamlServiceProvider : IServiceProvider
- {
- readonly Dictionary<Type, object> services = new Dictionary<Type, object>();
-
- internal XamlServiceProvider(INode node, HydrationContext context)
- {
- object targetObject;
- if (node != null && node.Parent != null && context.Values.TryGetValue(node.Parent, out targetObject))
- IProvideValueTarget = new XamlValueTargetProvider(targetObject, node, context, null);
- if (context != null)
- IRootObjectProvider = new XamlRootObjectProvider(context.RootElement);
- if (node != null)
- {
- IXamlTypeResolver = new XamlTypeResolver(node.NamespaceResolver, XamlParser.GetElementType,
- context?.RootElement.GetType().GetTypeInfo().Assembly);
-
- var enode = node;
- while (enode != null && !(enode is IElementNode))
- enode = enode.Parent;
- if (enode != null)
- INameScopeProvider = new NameScopeProvider { NameScope = (enode as IElementNode).Namescope };
- }
-
- var xmlLineInfo = node as IXmlLineInfo;
- if (xmlLineInfo != null)
- IXmlLineInfoProvider = new XmlLineInfoProvider(xmlLineInfo);
-
- IValueConverterProvider = new ValueConverterProvider();
- }
-
- public XamlServiceProvider()
- {
- IValueConverterProvider = new ValueConverterProvider();
- }
-
- internal IProvideValueTarget IProvideValueTarget
- {
- get { return (IProvideValueTarget)GetService(typeof (IProvideValueTarget)); }
- set { services[typeof (IProvideValueTarget)] = value; }
- }
-
- internal IXamlTypeResolver IXamlTypeResolver
- {
- get { return (IXamlTypeResolver)GetService(typeof (IXamlTypeResolver)); }
- set { services[typeof (IXamlTypeResolver)] = value; }
- }
-
- internal IRootObjectProvider IRootObjectProvider
- {
- get { return (IRootObjectProvider)GetService(typeof (IRootObjectProvider)); }
- set { services[typeof (IRootObjectProvider)] = value; }
- }
-
- internal IXmlLineInfoProvider IXmlLineInfoProvider
- {
- get { return (IXmlLineInfoProvider)GetService(typeof (IXmlLineInfoProvider)); }
- set { services[typeof (IXmlLineInfoProvider)] = value; }
- }
-
- internal INameScopeProvider INameScopeProvider
- {
- get { return (INameScopeProvider)GetService(typeof (INameScopeProvider)); }
- set { services[typeof (INameScopeProvider)] = value; }
- }
-
- internal IValueConverterProvider IValueConverterProvider
- {
- get { return (IValueConverterProvider)GetService(typeof (IValueConverterProvider)); }
- set { services[typeof (IValueConverterProvider)] = value; }
- }
-
- public object GetService(Type serviceType)
- {
- object service;
- return services.TryGetValue(serviceType, out service) ? service : null;
- }
-
- public void Add(Type type, object service)
- {
- services.Add(type, service);
- }
- }
-
- internal class XamlValueTargetProvider : IProvideParentValues, IProvideValueTarget
- {
- public XamlValueTargetProvider(object targetObject, INode node, HydrationContext context, object targetProperty)
- {
- Context = context;
- Node = node;
- TargetObject = targetObject;
- TargetProperty = targetProperty;
- }
-
- INode Node { get; }
-
- HydrationContext Context { get; }
- public object TargetObject { get; }
- public object TargetProperty { get; internal set; } = null;
-
- IEnumerable<object> IProvideParentValues.ParentObjects
- {
- get
- {
- if (Node == null || Context == null)
- yield break;
- var n = Node;
- object obj = null;
- var context = Context;
- while (n.Parent != null && context != null)
- {
- if (n.Parent is IElementNode)
- {
- if (context.Values.TryGetValue(n.Parent, out obj))
- yield return obj;
- else
- {
- context = context.ParentContext;
- continue;
- }
- }
- n = n.Parent;
- }
- }
- }
- }
-
- internal class SimpleValueTargetProvider : IProvideParentValues, IProvideValueTarget
- {
- readonly object[] objectAndParents;
- readonly object targetProperty;
-
- [Obsolete("SimpleValueTargetProvider(object[] objectAndParents) is obsolete as of version 2.3.4. Please use SimpleValueTargetProvider(object[] objectAndParents, object targetProperty) instead.")]
- public SimpleValueTargetProvider(object[] objectAndParents) : this (objectAndParents, null)
- {
- }
-
- public SimpleValueTargetProvider(object[] objectAndParents, object targetProperty)
- {
- if (objectAndParents == null)
- throw new ArgumentNullException(nameof(objectAndParents));
- if (objectAndParents.Length == 0)
- throw new ArgumentException();
-
- this.objectAndParents = objectAndParents;
- this.targetProperty = targetProperty;
- }
-
- IEnumerable<object> IProvideParentValues.ParentObjects
- {
- get { return objectAndParents; }
- }
-
- object IProvideValueTarget.TargetObject
- {
- get { return objectAndParents[0]; }
- }
-
- object IProvideValueTarget.TargetProperty
- {
- get { return targetProperty; }
- }
- }
-
- internal class XamlTypeResolver : IXamlTypeResolver
- {
- readonly Assembly currentAssembly;
- readonly GetTypeFromXmlName getTypeFromXmlName;
- readonly IXmlNamespaceResolver namespaceResolver;
-
- public XamlTypeResolver(IXmlNamespaceResolver namespaceResolver, Assembly currentAssembly)
- : this(namespaceResolver, XamlParser.GetElementType, currentAssembly)
- {
- }
-
- internal XamlTypeResolver(IXmlNamespaceResolver namespaceResolver, GetTypeFromXmlName getTypeFromXmlName,
- Assembly currentAssembly)
- {
- this.currentAssembly = currentAssembly;
- if (namespaceResolver == null)
- throw new ArgumentNullException();
- if (getTypeFromXmlName == null)
- throw new ArgumentNullException();
-
- this.namespaceResolver = namespaceResolver;
- this.getTypeFromXmlName = getTypeFromXmlName;
- }
-
- Type IXamlTypeResolver.Resolve(string qualifiedTypeName, IServiceProvider serviceProvider)
- {
- XamlParseException e;
- var type = Resolve(qualifiedTypeName, serviceProvider, out e);
- if (e != null)
- throw e;
- return type;
- }
-
- bool IXamlTypeResolver.TryResolve(string qualifiedTypeName, out Type type)
- {
- XamlParseException exception;
- type = Resolve(qualifiedTypeName, null, out exception);
- return exception == null;
- }
-
- Type Resolve(string qualifiedTypeName, IServiceProvider serviceProvider, out XamlParseException exception)
- {
- exception = null;
- var split = qualifiedTypeName.Split(':');
- if (split.Length > 2)
- return null;
-
- string prefix, name;
- if (split.Length == 2)
- {
- prefix = split[0];
- name = split[1];
- }
- else
- {
- prefix = "";
- name = split[0];
- }
-
- IXmlLineInfo xmlLineInfo = null;
- if (serviceProvider != null)
- {
- var lineInfoProvider = serviceProvider.GetService(typeof (IXmlLineInfoProvider)) as IXmlLineInfoProvider;
- if (lineInfoProvider != null)
- xmlLineInfo = lineInfoProvider.XmlLineInfo;
- }
-
- var namespaceuri = namespaceResolver.LookupNamespace(prefix);
- if (namespaceuri == null)
- {
- exception = new XamlParseException(string.Format("No xmlns declaration for prefix \"{0}\"", prefix), xmlLineInfo);
- return null;
- }
-
- return getTypeFromXmlName(new XmlType(namespaceuri, name, null), xmlLineInfo, currentAssembly, out exception);
- }
-
- internal delegate Type GetTypeFromXmlName(
- XmlType xmlType, IXmlLineInfo xmlInfo, Assembly currentAssembly, out XamlParseException exception);
- }
-
- internal class XamlRootObjectProvider : IRootObjectProvider
- {
- public XamlRootObjectProvider(object rootObject)
- {
- RootObject = rootObject;
- }
-
- public object RootObject { get; }
- }
-
- internal class XmlLineInfoProvider : IXmlLineInfoProvider
- {
- public XmlLineInfoProvider(IXmlLineInfo xmlLineInfo)
- {
- XmlLineInfo = xmlLineInfo;
- }
-
- public IXmlLineInfo XmlLineInfo { get; }
- }
-
- internal class NameScopeProvider : INameScopeProvider
- {
- public INameScope NameScope { get; set; }
- }
-
- internal class XmlNamespaceResolver : IXmlNamespaceResolver
- {
- readonly Dictionary<string, string> namespaces = new Dictionary<string, string>();
-
- public IDictionary<string, string> GetNamespacesInScope(XmlNamespaceScope scope)
- {
- throw new NotImplementedException();
- }
-
- public string LookupNamespace(string prefix)
- {
- string result;
- if (namespaces.TryGetValue(prefix, out result))
- return result;
- return null;
- }
-
- public string LookupPrefix(string namespaceName)
- {
- throw new NotImplementedException();
- }
-
- public void Add(string prefix, string ns)
- {
- namespaces.Add(prefix, ns);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System.Xml;
-
-namespace Tizen.NUI.Xaml
-{
- internal class XmlLineInfo : IXmlLineInfo
- {
- readonly bool _hasLineInfo;
-
- public XmlLineInfo()
- {
- }
-
- public XmlLineInfo(int linenumber, int lineposition)
- {
- _hasLineInfo = true;
- LineNumber = linenumber;
- LinePosition = lineposition;
- }
-
- public bool HasLineInfo()
- {
- return _hasLineInfo;
- }
-
- public int LineNumber { get; }
-
- public int LinePosition { get; }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System.Diagnostics;
-
-namespace Tizen.NUI.Xaml
-{
- [DebuggerDisplay("{NamespaceURI}:{LocalName}")]
- internal struct XmlName
- {
- public static readonly XmlName _CreateContent = new XmlName("_", "CreateContent");
- public static readonly XmlName xKey = new XmlName("x", "Key");
- public static readonly XmlName xName = new XmlName("x", "Name");
- public static readonly XmlName xTypeArguments = new XmlName("x", "TypeArguments");
- public static readonly XmlName xArguments = new XmlName("x", "Arguments");
- public static readonly XmlName xFactoryMethod = new XmlName("x", "FactoryMethod");
- public static readonly XmlName xDataType = new XmlName("x", "DataType");
- public static readonly XmlName Empty = new XmlName();
-
- public string NamespaceURI { get; }
- public string LocalName { get; }
-
- public XmlName(string namespaceUri, string localName)
- {
- NamespaceURI = namespaceUri;
- LocalName = localName;
- }
-
- public override bool Equals(object obj)
- {
- if (obj == null)
- return false;
- if (obj.GetType() != typeof (XmlName))
- return false;
- var other = (XmlName)obj;
- return NamespaceURI == other.NamespaceURI && LocalName == other.LocalName;
- }
-
- public bool Equals(string namespaceUri, string localName)
- => Equals(new XmlName(namespaceUri, localName));
-
- public override int GetHashCode()
- {
- unchecked
- {
- int hashCode = 0;
- if (NamespaceURI != null)
- hashCode = NamespaceURI.GetHashCode();
- if (LocalName != null)
- hashCode = (hashCode * 397) ^ LocalName.GetHashCode();
- return hashCode;
- }
- }
-
- public static bool operator ==(XmlName x1, XmlName x2)
- => x1.NamespaceURI == x2.NamespaceURI && x1.LocalName == x2.LocalName;
-
- public static bool operator !=(XmlName x1, XmlName x2)
- => !(x1 == x2);
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Xaml
-{
- internal static class XmlnsHelper
- {
- public static string ParseNamespaceFromXmlns(string xmlns)
- {
- string typeName;
- string ns;
- string asm;
- string targetPlatform;
-
- ParseXmlns(xmlns, out typeName, out ns, out asm, out targetPlatform);
-
- return ns;
- }
-
- public static void ParseXmlns(string xmlns, out string typeName, out string ns, out string asm, out string targetPlatform)
- {
- typeName = ns = asm = targetPlatform = null;
-
- xmlns = xmlns.Trim();
-
- if (xmlns.StartsWith("using:", StringComparison.Ordinal)) {
- ParseUsing(xmlns, out typeName, out ns, out asm, out targetPlatform);
- return;
- }
- ParseClrNamespace(xmlns, out typeName, out ns, out asm, out targetPlatform);
- }
-
- static void ParseClrNamespace(string xmlns, out string typeName, out string ns, out string asm, out string targetPlatform)
- {
- typeName = ns = asm = targetPlatform = null;
-
- foreach (var decl in xmlns.Split(';'))
- {
- if (decl.StartsWith("clr-namespace:", StringComparison.Ordinal))
- {
- ns = decl.Substring(14, decl.Length - 14);
- continue;
- }
- if (decl.StartsWith("assembly=", StringComparison.Ordinal))
- {
- asm = decl.Substring(9, decl.Length - 9);
- continue;
- }
- if (decl.StartsWith("targetPlatform=", StringComparison.Ordinal)) {
- targetPlatform = decl.Substring(15, decl.Length - 15);
- continue;
- }
- var nsind = decl.LastIndexOf(".", StringComparison.Ordinal);
- if (nsind > 0)
- {
- ns = decl.Substring(0, nsind);
- typeName = decl.Substring(nsind + 1, decl.Length - nsind - 1);
- }
- else
- typeName = decl;
- }
- }
-
- static void ParseUsing(string xmlns, out string typeName, out string ns, out string asm, out string targetPlatform)
- {
- typeName = ns = asm = targetPlatform = null;
-
- foreach (var decl in xmlns.Split(';')) {
- if (decl.StartsWith("using:", StringComparison.Ordinal)) {
- ns = decl.Substring(6, decl.Length - 6);
- continue;
- }
- }
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding
-{
- [System.ComponentModel.TypeConverter(typeof(AcceleratorTypeConverter))]
- internal class Accelerator
- {
- const char Separator = '+';
- string _text;
-
- internal Accelerator(string text)
- {
- if (string.IsNullOrEmpty(text))
- throw new ArgumentNullException(nameof(text));
- _text = text;
- }
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public IEnumerable<string> Modifiers { get; set; }
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public IEnumerable<string> Keys { get; set; }
-
- public static Accelerator FromString(string text)
- {
- var accelarat = new Accelerator(text);
-
- var acceleratorParts = text.Split(Separator);
-
- if (acceleratorParts.Length > 1)
- {
- var modifiers = new List<string>();
- for (int i = 0; i < acceleratorParts.Length; i++)
- {
- var modifierMask = acceleratorParts[i];
- var modiferMaskLower = modifierMask.ToLower();
- switch (modiferMaskLower)
- {
- case "ctrl":
- case "cmd":
- case "alt":
- case "shift":
- case "fn":
- case "win":
- modifiers.Add(modiferMaskLower);
- text = text.Replace(modifierMask, "");
- break;
- }
- }
- accelarat.Modifiers = modifiers;
-
- }
-
- var keys = text.Split(new char[] { Separator }, StringSplitOptions.RemoveEmptyEntries);
- accelarat.Keys = keys;
- return accelarat;
- }
-
- public override string ToString()
- {
- return _text;
- }
-
- public override bool Equals(object obj)
- {
- return obj != null && obj is Accelerator && Equals((Accelerator)obj);
- }
-
- bool Equals(Accelerator other)
- {
- return other.ToString() == ToString();
- }
-
- public override int GetHashCode()
- {
- return ToString().GetHashCode();
- }
-
- public static implicit operator Accelerator(string accelerator)
- {
- return FromString(accelerator);
- }
- }
-}
+++ /dev/null
-namespace Tizen.NUI.Binding
-{
- internal class AcceleratorTypeConverter : TypeConverter
- {
- public override object ConvertFromInvariantString(string value)
- {
- if (value == null)
- return null;
-
- return Accelerator.FromString(value);
- }
- }
-}
+++ /dev/null
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Threading.Tasks;
-
-namespace Tizen.NUI.Binding
-{
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal class ActionSheetArguments
- {
- public ActionSheetArguments(string title, string cancel, string destruction, IEnumerable<string> buttons)
- {
- Title = title;
- Cancel = cancel;
- Destruction = destruction;
- Buttons = buttons;
- Result = new TaskCompletionSource<string>();
- }
-
- /// <summary>
- /// Gets titles of any buttons on the action sheet that aren't <see cref="Cancel" /> or <see cref="Destruction" />. Can
- /// be <c>null</c>.
- /// </summary>
- public IEnumerable<string> Buttons { get; private set; }
-
- /// <summary>
- /// Gets the text for a cancel button. Can be null.
- /// </summary>
- public string Cancel { get; private set; }
-
- /// <summary>
- /// Gets the text for a destructive button. Can be null.
- /// </summary>
- public string Destruction { get; private set; }
-
- public TaskCompletionSource<string> Result { get; }
-
- /// <summary>
- /// Gets the title for the action sheet. Can be null.
- /// </summary>
- public string Title { get; private set; }
-
- public void SetResult(string result)
- {
- Result.TrySetResult(result);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System.ComponentModel;
-using System.Threading.Tasks;
-
-namespace Tizen.NUI.Binding
-{
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal class AlertArguments
- {
- public AlertArguments(string title, string message, string accept, string cancel)
- {
- Title = title;
- Message = message;
- Accept = accept;
- Cancel = cancel;
- Result = new TaskCompletionSource<bool>();
- }
-
- /// <summary>
- /// Gets the text for the accept button. Can be null.
- /// </summary>
- public string Accept { get; private set; }
-
- /// <summary>
- /// Gets the text of the cancel button.
- /// </summary>
- public string Cancel { get; private set; }
-
- /// <summary>
- /// Gets the message for the alert. Can be null.
- /// </summary>
- public string Message { get; private set; }
-
- public TaskCompletionSource<bool> Result { get; }
-
- /// <summary>
- /// Gets the title for the alert. Can be null.
- /// </summary>
- public string Title { get; private set; }
-
- public void SetResult(bool result)
- {
- Result.TrySetResult(result);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Threading;
-using System.ComponentModel;
-using System.Threading.Tasks;
-using Tizen.NUI.Binding.Internals;
-
-namespace Tizen.NUI.Binding
-{
- internal class Application : Element, IResourcesProvider, IApplicationController, IElementConfiguration<Application>
- {
- static Application s_current;
- Task<IDictionary<string, object>> _propertiesTask;
- readonly Lazy<PlatformConfigurationRegistry<Application>> _platformConfigurationRegistry;
-
- IAppIndexingProvider _appIndexProvider;
-
- ReadOnlyCollection<Element> _logicalChildren;
-
- Page _mainPage;
-
- static SemaphoreSlim SaveSemaphore = new SemaphoreSlim(1, 1);
-
- public Application()
- {
- // var f = false;
- // if (f)
- // Loader.Load();
- NavigationProxy = new NavigationImpl(this);
- SetCurrentApplication(this);
-
- SystemResources = DependencyService.Get<ISystemResourcesProvider>()?.GetSystemResources();
- SystemResources.ValuesChanged += OnParentResourcesChanged;
- _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<Application>>(() => new PlatformConfigurationRegistry<Application>(this));
- }
-
- public void Quit()
- {
- Device.PlatformServices?.QuitApplication();
- }
-
- public IAppLinks AppLinks
- {
- get
- {
- 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 Tizen.NUI.Binding.AppLinks");
- return _appIndexProvider.AppLinks;
- }
- }
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static void SetCurrentApplication(Application value) => Current = value;
-
- public static Application Current
- {
- get { return s_current; }
- set
- {
- if (s_current == value)
- return;
- if (value == null)
- s_current = null; //Allow to reset current for unittesting
- s_current = value;
- }
- }
-
- public Page MainPage
- {
- get { return _mainPage; }
- set
- {
- if (value == null)
- throw new ArgumentNullException("value");
-
- if (_mainPage == value)
- return;
-
- OnPropertyChanging();
- if (_mainPage != null)
- {
- InternalChildren.Remove(_mainPage);
- _mainPage.Parent = null;
- }
-
- _mainPage = value;
-
- if (_mainPage != null)
- {
- _mainPage.Parent = this;
- _mainPage.NavigationProxy.Inner = NavigationProxy;
- InternalChildren.Add(_mainPage);
- }
- OnPropertyChanged();
- }
- }
-
- public IDictionary<string, object> Properties
- {
- get
- {
- if (_propertiesTask == null)
- {
- _propertiesTask = GetPropertiesAsync();
- }
-
- return _propertiesTask.Result;
- }
- }
-
- internal override ReadOnlyCollection<Element> LogicalChildrenInternal
- {
- get { return _logicalChildren ?? (_logicalChildren = new ReadOnlyCollection<Element>(InternalChildren)); }
- }
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public NavigationProxy NavigationProxy { get; }
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public int PanGestureId { get; set; }
-
- internal IResourceDictionary SystemResources { get; }
-
- ObservableCollection<Element> InternalChildren { get; } = new ObservableCollection<Element>();
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public void SetAppIndexingProvider(IAppIndexingProvider provider)
- {
- _appIndexProvider = provider;
- }
-
- ResourceDictionary _resources;
- bool IResourcesProvider.IsResourcesCreated => _resources != null;
-
- public ResourceDictionary XamlResources
- {
- get
- {
- if (_resources != null)
- return _resources;
-
- _resources = new ResourceDictionary();
- ((IResourceDictionary)_resources).ValuesChanged += OnResourcesChanged;
- return _resources;
- }
- set
- {
- if (_resources == value)
- return;
- OnPropertyChanging();
- if (_resources != null)
- ((IResourceDictionary)_resources).ValuesChanged -= OnResourcesChanged;
- _resources = value;
- OnResourcesChanged(value);
- if (_resources != null)
- ((IResourceDictionary)_resources).ValuesChanged += OnResourcesChanged;
- OnPropertyChanged();
- }
- }
-
- public event EventHandler<ModalPoppedEventArgs> ModalPopped;
-
- public event EventHandler<ModalPoppingEventArgs> ModalPopping;
-
- public event EventHandler<ModalPushedEventArgs> ModalPushed;
-
- public event EventHandler<ModalPushingEventArgs> ModalPushing;
-
- public event EventHandler<Page> PageAppearing;
-
- public event EventHandler<Page> PageDisappearing;
-
-
- async void SaveProperties()
- {
- try
- {
- await SetPropertiesAsync();
- }
- catch (Exception exc)
- {
- Console.WriteLine(nameof(Application), $"Exception while saving Application Properties: {exc}");
- }
- }
-
- public async Task SavePropertiesAsync()
- {
- if (Device.IsInvokeRequired)
- {
- Device.BeginInvokeOnMainThread(SaveProperties);
- }
- else
- {
- await SetPropertiesAsync();
- }
- }
-
- // Don't use this unless there really is no better option
- internal void SavePropertiesAsFireAndForget()
- {
- if (Device.IsInvokeRequired)
- {
- Device.BeginInvokeOnMainThread(SaveProperties);
- }
- else
- {
- SaveProperties();
- }
- }
-
- public IPlatformElementConfiguration<T, Application> On<T>() where T : IConfigPlatform
- {
- return _platformConfigurationRegistry.Value.On<T>();
- }
-
- protected virtual void OnAppLinkRequestReceived(Uri uri)
- {
- }
-
- protected override void OnParentSet()
- {
- throw new InvalidOperationException("Setting a Parent on Application is invalid.");
- }
-
- protected virtual void OnResume()
- {
- }
-
- protected virtual void OnSleep()
- {
- }
-
- protected virtual void OnStart()
- {
- }
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static void ClearCurrent()
- {
- s_current = null;
- }
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static bool IsApplicationOrNull(Element element)
- {
- return element == null || element is Application;
- }
-
- internal override void OnParentResourcesChanged(IEnumerable<KeyValuePair<string, object>> values)
- {
- if (!((IResourcesProvider)this).IsResourcesCreated || XamlResources.Count == 0)
- {
- base.OnParentResourcesChanged(values);
- return;
- }
-
- var innerKeys = new HashSet<string>();
- var changedResources = new List<KeyValuePair<string, object>>();
- foreach (KeyValuePair<string, object> c in XamlResources)
- innerKeys.Add(c.Key);
- foreach (KeyValuePair<string, object> value in values)
- {
- if (innerKeys.Add(value.Key))
- changedResources.Add(value);
- }
- OnResourcesChanged(changedResources);
- }
-
- internal event EventHandler PopCanceled;
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public void SendOnAppLinkRequestReceived(Uri uri)
- {
- OnAppLinkRequestReceived(uri);
- }
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public void SendResume()
- {
- s_current = this;
- OnResume();
- }
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public void SendSleep()
- {
- OnSleep();
- SavePropertiesAsFireAndForget();
- }
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public Task SendSleepAsync()
- {
- OnSleep();
- return SavePropertiesAsync();
- }
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public void SendStart()
- {
- OnStart();
- }
-
- async Task<IDictionary<string, object>> GetPropertiesAsync()
- {
- var deserializer = DependencyService.Get<IDeserializer>();
- if (deserializer == null)
- {
- Console.WriteLine("Startup", "No IDeserialzier was found registered");
- return new Dictionary<string, object>(4);
- }
-
- IDictionary<string, object> properties = await deserializer.DeserializePropertiesAsync().ConfigureAwait(false);
- if (properties == null)
- properties = new Dictionary<string, object>(4);
-
- return properties;
- }
-
- internal void OnPageAppearing(Page page)
- => PageAppearing?.Invoke(this, page);
-
- internal void OnPageDisappearing(Page page)
- => PageDisappearing?.Invoke(this, page);
-
- void OnModalPopped(Page modalPage)
- => ModalPopped?.Invoke(this, new ModalPoppedEventArgs(modalPage));
-
- bool OnModalPopping(Page modalPage)
- {
- var args = new ModalPoppingEventArgs(modalPage);
- ModalPopping?.Invoke(this, args);
- return args.Cancel;
- }
-
- void OnModalPushed(Page modalPage)
- => ModalPushed?.Invoke(this, new ModalPushedEventArgs(modalPage));
-
- void OnModalPushing(Page modalPage)
- => ModalPushing?.Invoke(this, new ModalPushingEventArgs(modalPage));
-
- void OnPopCanceled()
- => PopCanceled?.Invoke(this, EventArgs.Empty);
-
- async Task SetPropertiesAsync()
- {
- await SaveSemaphore.WaitAsync();
- try
- {
- await DependencyService.Get<IDeserializer>()?.SerializePropertiesAsync(Properties);
- }
- finally
- {
- SaveSemaphore.Release();
- }
-
- }
-
- class NavigationImpl : NavigationProxy
- {
- readonly Application _owner;
-
- public NavigationImpl(Application owner)
- {
- _owner = owner;
- }
-
- protected override async Task<Page> OnPopModal(bool animated)
- {
- Page modal = ModalStack[ModalStack.Count - 1];
- if (_owner.OnModalPopping(modal))
- {
- _owner.OnPopCanceled();
- return null;
- }
- Page result = await base.OnPopModal(animated);
- result.Parent = null;
- _owner.OnModalPopped(result);
- return result;
- }
-
- protected override async Task OnPushModal(Page modal, bool animated)
- {
- _owner.OnModalPushing(modal);
-
- modal.Parent = _owner;
-
- if (modal.NavigationProxy.ModalStack.Count == 0)
- {
- modal.NavigationProxy.Inner = this;
- await base.OnPushModal(modal, animated);
- }
- else
- {
- await base.OnPushModal(modal, animated);
- modal.NavigationProxy.Inner = this;
- }
-
- _owner.OnModalPushed(modal);
- }
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using Tizen.NUI.Binding;
-
-namespace Tizen.NUI.Binding
-{
- internal abstract class BaseMenuItem : Element
- {
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Linq.Expressions;
-
-namespace Tizen.NUI.Binding
-{
- internal static class BindableObjectExtensions
- {
- public static void SetBinding(this BindableObject self, BindableProperty targetProperty, string path, BindingMode mode = BindingMode.Default, IValueConverter converter = null,
- string stringFormat = null)
- {
- if (self == null)
- throw new ArgumentNullException("self");
- if (targetProperty == null)
- throw new ArgumentNullException("targetProperty");
-
- var binding = new Binding(path, mode, converter, stringFormat: stringFormat);
- self.SetBinding(targetProperty, binding);
- }
-
- [Obsolete]
- public static void SetBinding<TSource>(this BindableObject self, BindableProperty targetProperty, Expression<Func<TSource, object>> sourceProperty, BindingMode mode = BindingMode.Default,
- IValueConverter converter = null, string stringFormat = null)
- {
- if (self == null)
- throw new ArgumentNullException("self");
- if (targetProperty == null)
- throw new ArgumentNullException("targetProperty");
- if (sourceProperty == null)
- throw new ArgumentNullException("sourceProperty");
-
- Binding binding = Binding.Create(sourceProperty, mode, converter, stringFormat: stringFormat);
- self.SetBinding(targetProperty, binding);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq.Expressions;
-using System.Reflection;
-using System.ComponentModel;
-using Tizen.NUI.Binding.Internals;
-using Tizen.NUI.Xaml;
-
-namespace Tizen.NUI.Binding
-{
- /// <summary>
- /// A BindableProperty is a backing store for properties allowing bindings on BindableObject.
- /// </summary>
- [DebuggerDisplay("{PropertyName}")]
- [TypeConverter(typeof(BindablePropertyConverter))]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public sealed class BindableProperty
- {
- /// <summary>
- /// Delegate for BindableProperty.PropertyChanged.
- /// </summary>
- /// <param name="bindable">The bindable object that contains the property.</param>
- /// <param name="oldValue">The old property value.</param>
- /// <param name="newValue">The new property value.</param>
- public delegate void BindingPropertyChangedDelegate(BindableObject bindable, object oldValue, object newValue);
-
- /// <summary>
- /// Strongly-typed delegate for BindableProperty.PropertyChanged.
- /// </summary>
- /// <typeparam name="TPropertyType">The type of the bound property.</typeparam>
- /// <param name="bindable">The bindable object that contains the property.</param>
- /// <param name="oldValue">The old property value.</param>
- /// <param name="newValue">The new property value.</param>
- public delegate void BindingPropertyChangedDelegate<in TPropertyType>(BindableObject bindable, TPropertyType oldValue, TPropertyType newValue);
-
- /// <summary>
- /// Delegate for BindableProperty.PropertyChanging.
- /// </summary>
- /// <param name="bindable">The bindable object that contains the property.</param>
- /// <param name="oldValue">The old property value.</param>
- /// <param name="newValue">The new property value.</param>
- public delegate void BindingPropertyChangingDelegate(BindableObject bindable, object oldValue, object newValue);
-
- /// <summary>
- /// Strongly-typed delegate for BindableProperty.PropertyChanging.
- /// </summary>
- /// <typeparam name="TPropertyType">The type of the bound property.</typeparam>
- /// <param name="bindable">The bindable object that contains the property.</param>
- /// <param name="oldValue">The old property value.</param>
- /// <param name="newValue">The new property value.</param>
- public delegate void BindingPropertyChangingDelegate<in TPropertyType>(BindableObject bindable, TPropertyType oldValue, TPropertyType newValue);
-
- /// <summary>
- /// Delegate for BindableProperty.CoerceValue.
- /// </summary>
- /// <param name="bindable">The bindable object that contains the property.</param>
- /// <param name="value">The value to coerce.</param>
- /// <returns>System.Object</returns>
- public delegate object CoerceValueDelegate(BindableObject bindable, object value);
-
- /// <summary>
- /// Strongly-typed delegate for BindableProperty.CoerceValue.
- /// </summary>
- /// <typeparam name="TPropertyType">The type of the bound property.</typeparam>
- /// <param name="bindable">The bindable object that contains the property.</param>
- /// <param name="value">The value to coerce.</param>
- /// <returns>TPropertyType</returns>
- public delegate TPropertyType CoerceValueDelegate<TPropertyType>(BindableObject bindable, TPropertyType value);
-
- /// <summary>
- /// Delegate for BindableProperty.DefaultValueCreator.
- /// </summary>
- /// <param name="bindable">The bindable object that contains the property.</param>
- /// <returns>System.Object</returns>
- public delegate object CreateDefaultValueDelegate(BindableObject bindable);
-
- /// <summary>
- /// Strongly-typed delegate for BindableProperty.DefaultValueCreator.
- /// </summary>
- /// <typeparam name="TDeclarer">The type of the object that delared the property.</typeparam>
- /// <typeparam name="TPropertyType">The type of the bound property.</typeparam>
- /// <param name="bindable">The bindable object that contains the property.</param>
- /// <returns>TPropertyType</returns>
- public delegate TPropertyType CreateDefaultValueDelegate<in TDeclarer, out TPropertyType>(TDeclarer bindable);
-
- /// <summary>
- /// Delegate for BindableProperty.ValidateValue.
- /// </summary>
- /// <param name="bindable">The bindable object that contains the property.</param>
- /// <param name="value">The default value.</param>
- /// <returns>System.Boolean</returns>
- public delegate bool ValidateValueDelegate(BindableObject bindable, object value);
-
- /// <summary>
- /// Strongly-typed delegate for BindableProperty.ValidateValue.
- /// </summary>
- /// <typeparam name="TPropertyType">The type of the bound property.</typeparam>
- /// <param name="bindable">The bindable object that contains the property.</param>
- /// <param name="value">The default value.</param>
- /// <returns>System.Boolean</returns>
- public delegate bool ValidateValueDelegate<in TPropertyType>(BindableObject bindable, TPropertyType value);
-
- static readonly Dictionary<Type, TypeConverter> WellKnownConvertTypes = new Dictionary<Type,TypeConverter>
- {
- { 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() },
- };
-
- //Modification for NUI XAML : user defined converter for DynamicResource can be added
- static internal Dictionary<Type, TypeConverter> UserCustomConvertTypes = new Dictionary<Type, TypeConverter>
- {
- };
-
- // more or less the encoding of this, without the need to reflect
- // http://msdn.microsoft.com/en-us/library/y5b434w4.aspx
- static readonly Dictionary<Type, Type[]> SimpleConvertTypes = new Dictionary<Type, Type[]>
- {
- { typeof(sbyte), new[] { typeof(string), typeof(short), typeof(int), typeof(long), typeof(float), typeof(double), typeof(decimal) } },
- { typeof(byte), new[] { typeof(string), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(ulong), typeof(float), typeof(double), typeof(decimal) } },
- { typeof(short), new[] { typeof(string), typeof(int), typeof(long), typeof(float), typeof(double), typeof(decimal) } },
- { typeof(ushort), new[] { typeof(string), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double), typeof(decimal) } },
- { typeof(int), new[] { typeof(string), typeof(long), typeof(float), typeof(double), typeof(decimal) } },
- { typeof(uint), new[] { typeof(string), typeof(long), typeof(ulong), typeof(float), typeof(double), typeof(decimal) } },
- { typeof(long), new[] { typeof(string), typeof(float), typeof(double), typeof(decimal) } },
- { typeof(char), new[] { typeof(string), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double), typeof(decimal) } },
- { typeof(float), new[] { typeof(string), typeof(double) } },
- { typeof(ulong), new[] { typeof(string), typeof(float), typeof(double), typeof(decimal) } }
- };
-
- BindableProperty(string propertyName, Type returnType, Type declaringType, object defaultValue, BindingMode defaultBindingMode = BindingMode.OneWay,
- ValidateValueDelegate validateValue = null, BindingPropertyChangedDelegate propertyChanged = null, BindingPropertyChangingDelegate propertyChanging = null,
- CoerceValueDelegate coerceValue = null, BindablePropertyBindingChanging bindingChanging = null, bool isReadOnly = false, CreateDefaultValueDelegate defaultValueCreator = null)
- {
- if (propertyName == null)
- throw new ArgumentNullException("propertyName");
- if (ReferenceEquals(returnType, null))
- throw new ArgumentNullException("returnType");
- if (ReferenceEquals(declaringType, null))
- throw new ArgumentNullException("declaringType");
-
- // don't use Enum.IsDefined as its redonkulously expensive for what it does
- if (defaultBindingMode != BindingMode.Default && defaultBindingMode != BindingMode.OneWay && defaultBindingMode != BindingMode.OneWayToSource && defaultBindingMode != BindingMode.TwoWay && defaultBindingMode != BindingMode.OneTime)
- throw new ArgumentException("Not a valid type of BindingMode", "defaultBindingMode");
- if (defaultValue == null && Nullable.GetUnderlyingType(returnType) == null && returnType.GetTypeInfo().IsValueType)
- throw new ArgumentException("Not a valid default value", "defaultValue");
- if (defaultValue != null && !returnType.IsInstanceOfType(defaultValue))
- throw new ArgumentException("Default value did not match return type", "defaultValue");
- if (defaultBindingMode == BindingMode.Default)
- defaultBindingMode = BindingMode.OneWay;
-
- PropertyName = propertyName;
- ReturnType = returnType;
- ReturnTypeInfo = returnType.GetTypeInfo();
- DeclaringType = declaringType;
- DefaultValue = defaultValue;
- DefaultBindingMode = defaultBindingMode;
- PropertyChanged = propertyChanged;
- PropertyChanging = propertyChanging;
- ValidateValue = validateValue;
- CoerceValue = coerceValue;
- BindingChanging = bindingChanging;
- IsReadOnly = isReadOnly;
- DefaultValueCreator = defaultValueCreator;
- }
-
- /// <summary>
- /// Gets the type declaring the BindableProperty.
- /// </summary>
- public Type DeclaringType { get; private set; }
-
- /// <summary>
- /// Gets the default BindingMode.
- /// </summary>
- public BindingMode DefaultBindingMode { get; private set; }
-
- /// <summary>
- /// Gets the default value for the BindableProperty.
- /// </summary>
- public object DefaultValue { get; }
-
- /// <summary>
- /// Gets a value indicating if the BindableProperty is created form a BindablePropertyKey.
- /// </summary>
- public bool IsReadOnly { get; private set; }
-
- /// <summary>
- /// Gets the property name.
- /// </summary>
- public string PropertyName { get; }
-
- /// <summary>
- /// Gets the type of the BindableProperty.
- /// </summary>
- public Type ReturnType { get; }
-
- internal BindablePropertyBindingChanging BindingChanging { get; private set; }
-
- internal CoerceValueDelegate CoerceValue { get; private set; }
-
- internal CreateDefaultValueDelegate DefaultValueCreator { get; }
-
- internal BindingPropertyChangedDelegate PropertyChanged { get; private set; }
-
- internal BindingPropertyChangingDelegate PropertyChanging { get; private set; }
-
- internal System.Reflection.TypeInfo ReturnTypeInfo { get; }
-
- internal ValidateValueDelegate ValidateValue { get; private set; }
-
- /// <summary>
- /// Deprecated. Do not use.
- /// </summary>
- /// <typeparam name="TDeclarer">The type of the declaring object.</typeparam>
- /// <typeparam name="TPropertyType">The type of the property.</typeparam>
- /// <param name="getter">An expression identifying the getter for the property using this BindableProperty as backing store.</param>
- /// <param name="defaultValue">The default value for the property.</param>
- /// <param name="defaultBindingMode">The BindingMode to use on SetBinding() if no BindingMode is given. This parameter is optional. Default is BindingMode.OneWay.</param>
- /// <param name="validateValue">A delegate to be run when a value is set. This parameter is optional. Default is null.</param>
- /// <param name="propertyChanged">A delegate to be run when the value has changed. This parameter is optional. Default is null.</param>
- /// <param name="propertyChanging">A delegate to be run when the value will change. This parameter is optional. Default is null.</param>
- /// <param name="coerceValue">A delegate used to coerce the range of a value. This parameter is optional. Default is null.</param>
- /// <param name="defaultValueCreator">A Func used to initialize default value for reference types.</param>
- /// <returns>A newly created BindableProperty.</returns>
- [Obsolete("Create<> (generic) is obsolete as of version 2.1.0 and is no longer supported.")]
- public static BindableProperty Create<TDeclarer, TPropertyType>(Expression<Func<TDeclarer, TPropertyType>> getter, TPropertyType defaultValue, BindingMode defaultBindingMode = BindingMode.OneWay,
- ValidateValueDelegate<TPropertyType> validateValue = null, BindingPropertyChangedDelegate<TPropertyType> propertyChanged = null,
- BindingPropertyChangingDelegate<TPropertyType> propertyChanging = null, CoerceValueDelegate<TPropertyType> coerceValue = null,
- CreateDefaultValueDelegate<TDeclarer, TPropertyType> defaultValueCreator = null) where TDeclarer : BindableObject
- {
- return Create(getter, defaultValue, defaultBindingMode, validateValue, propertyChanged, propertyChanging, coerceValue, null, defaultValueCreator: defaultValueCreator);
- }
-
- /// <summary>
- /// Creates a new instance of the BindableProperty class.
- /// </summary>
- /// <param name="propertyName">The name of the BindableProperty.</param>
- /// <param name="returnType">The type of the property.</param>
- /// <param name="declaringType">The type of the declaring object.</param>
- /// <param name="defaultValue">The default value for the property.</param>
- /// <param name="defaultBindingMode">The BindingMode to use on SetBinding() if no BindingMode is given. This parameter is optional. Default is BindingMode.OneWay.</param>
- /// <param name="validateValue">A delegate to be run when a value is set. This parameter is optional. Default is null.</param>
- /// <param name="propertyChanged">A delegate to be run when the value has changed. This parameter is optional. Default is null.</param>
- /// <param name="propertyChanging">A delegate to be run when the value will change. This parameter is optional. Default is null.</param>
- /// <param name="coerceValue">A delegate used to coerce the range of a value. This parameter is optional. Default is null.</param>
- /// <param name="defaultValueCreator">A Func used to initialize default value for reference types.</param>
- /// <returns>A newly created BindableProperty.</returns>
- public static BindableProperty Create(string propertyName, Type returnType, Type declaringType, object defaultValue = null, BindingMode defaultBindingMode = BindingMode.OneWay,
- ValidateValueDelegate validateValue = null, BindingPropertyChangedDelegate propertyChanged = null, BindingPropertyChangingDelegate propertyChanging = null,
- CoerceValueDelegate coerceValue = null, CreateDefaultValueDelegate defaultValueCreator = null)
- {
- return new BindableProperty(propertyName, returnType, declaringType, defaultValue, defaultBindingMode, validateValue, propertyChanged, propertyChanging, coerceValue,
- defaultValueCreator: defaultValueCreator);
- }
-
- /// <summary>
- /// Deprecated. Do not use.
- /// </summary>
- /// <typeparam name="TDeclarer">The type of the declaring object.</typeparam>
- /// <typeparam name="TPropertyType">The type of the property.</typeparam>
- /// <param name="staticgetter">An expression identifying a static method returning the value of the property using this BindableProperty as backing store.</param>
- /// <param name="defaultValue">The default value for the property.</param>
- /// <param name="defaultBindingMode">The BindingMode to use on SetBinding() if no BindingMode is given. This parameter is optional. Default is BindingMode.OneWay.</param>
- /// <param name="validateValue">A delegate to be run when a value is set. This parameter is optional. Default is null.</param>
- /// <param name="propertyChanged">A delegate to be run when the value has changed. This parameter is optional. Default is null.</param>
- /// <param name="propertyChanging">A delegate to be run when the value will change. This parameter is optional. Default is null.</param>
- /// <param name="coerceValue">A delegate used to coerce the range of a value. This parameter is optional. Default is null.</param>
- /// <param name="defaultValueCreator">A Func used to initialize default value for reference types.</param>
- [Obsolete("CreateAttached<> (generic) is obsolete as of version 2.1.0 and is no longer supported.")]
- public static BindableProperty CreateAttached<TDeclarer, TPropertyType>(Expression<Func<BindableObject, TPropertyType>> staticgetter, TPropertyType defaultValue,
- BindingMode defaultBindingMode = BindingMode.OneWay, ValidateValueDelegate<TPropertyType> validateValue = null, BindingPropertyChangedDelegate<TPropertyType> propertyChanged = null,
- BindingPropertyChangingDelegate<TPropertyType> propertyChanging = null, CoerceValueDelegate<TPropertyType> coerceValue = null,
- CreateDefaultValueDelegate<BindableObject, TPropertyType> defaultValueCreator = null)
- {
- return CreateAttached<TDeclarer, TPropertyType>(staticgetter, defaultValue, defaultBindingMode, validateValue, propertyChanged, propertyChanging, coerceValue, null,
- defaultValueCreator: defaultValueCreator);
- }
-
- /// <summary>
- /// Creates a new instance of the BindableProperty class for an attached property.
- /// </summary>
- /// <param name="propertyName">The name of the BindableProperty.</param>
- /// <param name="returnType">The type of the property.</param>
- /// <param name="declaringType">The type of the declaring object.</param>
- /// <param name="defaultValue">The default value for the property.</param>
- /// <param name="defaultBindingMode">The BindingMode to use on SetBinding() if no BindingMode is given. This parameter is optional. Default is BindingMode.OneWay.</param>
- /// <param name="validateValue">A delegate to be run when a value is set. This parameter is optional. Default is null.</param>
- /// <param name="propertyChanged">A delegate to be run when the value has changed. This parameter is optional. Default is null.</param>
- /// <param name="propertyChanging">A delegate to be run when the value will change. This parameter is optional. Default is null.</param>
- /// <param name="coerceValue">A delegate used to coerce the range of a value. This parameter is optional. Default is null.</param>
- /// <param name="defaultValueCreator">A Func used to initialize default value for reference types.</param>
- /// <returns>A newly created BindableProperty.</returns>
- public static BindableProperty CreateAttached(string propertyName, Type returnType, Type declaringType, object defaultValue, BindingMode defaultBindingMode = BindingMode.OneWay,
- ValidateValueDelegate validateValue = null, BindingPropertyChangedDelegate propertyChanged = null, BindingPropertyChangingDelegate propertyChanging = null,
- CoerceValueDelegate coerceValue = null, CreateDefaultValueDelegate defaultValueCreator = null)
- {
- return CreateAttached(propertyName, returnType, declaringType, defaultValue, defaultBindingMode, validateValue, propertyChanged, propertyChanging, coerceValue, null, false, defaultValueCreator);
- }
-
- /// <summary>
- /// Deprecated. Do not use.
- /// </summary>
- /// <typeparam name="TDeclarer">The type of the declaring object.</typeparam>
- /// <typeparam name="TPropertyType">The type of the property.</typeparam>
- /// <param name="staticgetter">An expression identifying a static method returning the value of the property using this BindableProperty as backing store.</param>
- /// <param name="defaultValue">The default value for the property.</param>
- /// <param name="defaultBindingMode">The BindingMode to use on SetBinding() if no BindingMode is given. This parameter is optional. Default is BindingMode.OneWay.</param>
- /// <param name="validateValue">A delegate to be run when a value is set. This parameter is optional. Default is null.</param>
- /// <param name="propertyChanged">A delegate to be run when the value has changed. This parameter is optional. Default is null.</param>
- /// <param name="propertyChanging">A delegate to be run when the value will change. This parameter is optional. Default is null.</param>
- /// <param name="coerceValue">A delegate used to coerce the range of a value. This parameter is optional. Default is null.</param>
- /// <param name="defaultValueCreator">A Func used to initialize default value for reference types.</param>
- /// <returns>A newly created attached read-only BindablePropertyKey.</returns>
- [Obsolete("CreateAttachedReadOnly<> (generic) is obsolete as of version 2.1.0 and is no longer supported.")]
- public static BindablePropertyKey CreateAttachedReadOnly<TDeclarer, TPropertyType>(Expression<Func<BindableObject, TPropertyType>> staticgetter, TPropertyType defaultValue,
- BindingMode defaultBindingMode = BindingMode.OneWayToSource, ValidateValueDelegate<TPropertyType> validateValue = null,
- BindingPropertyChangedDelegate<TPropertyType> propertyChanged = null, BindingPropertyChangingDelegate<TPropertyType> propertyChanging = null,
- CoerceValueDelegate<TPropertyType> coerceValue = null, CreateDefaultValueDelegate<BindableObject, TPropertyType> defaultValueCreator = null)
-
- {
- return
- new BindablePropertyKey(CreateAttached<TDeclarer, TPropertyType>(staticgetter, defaultValue, defaultBindingMode, validateValue, propertyChanged, propertyChanging, coerceValue, null, true,
- defaultValueCreator));
- }
-
- /// <summary>
- /// Creates a new instance of the BindableProperty class for attached read-only properties.
- /// </summary>
- /// <param name="propertyName">The name of the BindableProperty.</param>
- /// <param name="returnType">The type of the property.</param>
- /// <param name="declaringType">The type of the declaring object.</param>
- /// <param name="defaultValue">The default value for the property.</param>
- /// <param name="defaultBindingMode">The BindingMode to use on SetBinding() if no BindingMode is given. This parameter is optional. Default is BindingMode.OneWay.</param>
- /// <param name="validateValue">A delegate to be run when a value is set. This parameter is optional. Default is null.</param>
- /// <param name="propertyChanged">A delegate to be run when the value has changed. This parameter is optional. Default is null.</param>
- /// <param name="propertyChanging">A delegate to be run when the value will change. This parameter is optional. Default is null.</param>
- /// <param name="coerceValue">A delegate used to coerce the range of a value. This parameter is optional. Default is null.</param>
- /// <param name="defaultValueCreator">A Func used to initialize default value for reference types.</param>
- /// <returns>A newly created attached read-only BindablePropertyKey.</returns>
- public static BindablePropertyKey CreateAttachedReadOnly(string propertyName, Type returnType, Type declaringType, object defaultValue, BindingMode defaultBindingMode = BindingMode.OneWayToSource,
- ValidateValueDelegate validateValue = null, BindingPropertyChangedDelegate propertyChanged = null, BindingPropertyChangingDelegate propertyChanging = null,
- CoerceValueDelegate coerceValue = null, CreateDefaultValueDelegate defaultValueCreator = null)
- {
- return
- new BindablePropertyKey(CreateAttached(propertyName, returnType, declaringType, defaultValue, defaultBindingMode, validateValue, propertyChanged, propertyChanging, coerceValue, null, true,
- defaultValueCreator));
- }
-
- /// <summary>
- /// Deprecated. Do not use.
- /// </summary>
- /// <typeparam name="TDeclarer">The type of the declaring object.</typeparam>
- /// <typeparam name="TPropertyType">The type of the property.</typeparam>
- /// <param name="getter">An expression identifying the getter for the property using this BindableProperty as backing store.</param>
- /// <param name="defaultValue">The default value for the property.</param>
- /// <param name="defaultBindingMode">The BindingMode to use on SetBinding() if no BindingMode is given. This parameter is optional. Default is BindingMode.OneWay.</param>
- /// <param name="validateValue">A delegate to be run when a value is set. This parameter is optional. Default is null.</param>
- /// <param name="propertyChanged">A delegate to be run when the value has changed. This parameter is optional. Default is null.</param>
- /// <param name="propertyChanging">A delegate to be run when the value will change. This parameter is optional. Default is null.</param>
- /// <param name="coerceValue">A delegate used to coerce the range of a value. This parameter is optional. Default is null.</param>
- /// <param name="defaultValueCreator">A Func used to initialize default value for reference types.</param>
- /// <returns>A newly created BindablePropertyKey.</returns>
- [Obsolete("CreateReadOnly<> (generic) is obsolete as of version 2.1.0 and is no longer supported.")]
- public static BindablePropertyKey CreateReadOnly<TDeclarer, TPropertyType>(Expression<Func<TDeclarer, TPropertyType>> getter, TPropertyType defaultValue,
- BindingMode defaultBindingMode = BindingMode.OneWayToSource, ValidateValueDelegate<TPropertyType> validateValue = null,
- BindingPropertyChangedDelegate<TPropertyType> propertyChanged = null, BindingPropertyChangingDelegate<TPropertyType> propertyChanging = null,
- CoerceValueDelegate<TPropertyType> coerceValue = null, CreateDefaultValueDelegate<TDeclarer, TPropertyType> defaultValueCreator = null) where TDeclarer : BindableObject
- {
- return new BindablePropertyKey(Create(getter, defaultValue, defaultBindingMode, validateValue, propertyChanged, propertyChanging, coerceValue, null, true, defaultValueCreator));
- }
-
- /// <summary>
- /// Creates a new instance of the BindablePropertyKey class.
- /// </summary>
- /// <param name="propertyName">The name of the BindableProperty.</param>
- /// <param name="returnType">The type of the property.</param>
- /// <param name="declaringType">The type of the declaring object.</param>
- /// <param name="defaultValue">The default value for the property.</param>
- /// <param name="defaultBindingMode">The BindingMode to use on SetBinding() if no BindingMode is given. This parameter is optional. Default is BindingMode.OneWay.</param>
- /// <param name="validateValue">A delegate to be run when a value is set. This parameter is optional. Default is null.</param>
- /// <param name="propertyChanged">A delegate to be run when the value has changed. This parameter is optional. Default is null.</param>
- /// <param name="propertyChanging">A delegate to be run when the value will change. This parameter is optional. Default is null.</param>
- /// <param name="coerceValue">A delegate used to coerce the range of a value. This parameter is optional. Default is null.</param>
- /// <param name="defaultValueCreator">A Func used to initialize default value for reference types.</param>
- /// <returns>A newly created BindablePropertyKey.</returns>
- public static BindablePropertyKey CreateReadOnly(string propertyName, Type returnType, Type declaringType, object defaultValue, BindingMode defaultBindingMode = BindingMode.OneWayToSource,
- ValidateValueDelegate validateValue = null, BindingPropertyChangedDelegate propertyChanged = null, BindingPropertyChangingDelegate propertyChanging = null,
- CoerceValueDelegate coerceValue = null, CreateDefaultValueDelegate defaultValueCreator = null)
- {
- return
- new BindablePropertyKey(new BindableProperty(propertyName, returnType, declaringType, defaultValue, defaultBindingMode, validateValue, propertyChanged, propertyChanging, coerceValue,
- isReadOnly: true, defaultValueCreator: defaultValueCreator));
- }
-
- [Obsolete("Create<> (generic) is obsolete as of version 2.1.0 and is no longer supported.")]
- internal static BindableProperty Create<TDeclarer, TPropertyType>(Expression<Func<TDeclarer, TPropertyType>> getter, TPropertyType defaultValue, BindingMode defaultBindingMode,
- ValidateValueDelegate<TPropertyType> validateValue, BindingPropertyChangedDelegate<TPropertyType> propertyChanged, BindingPropertyChangingDelegate<TPropertyType> propertyChanging,
- CoerceValueDelegate<TPropertyType> coerceValue, BindablePropertyBindingChanging bindingChanging, bool isReadOnly = false,
- CreateDefaultValueDelegate<TDeclarer, TPropertyType> defaultValueCreator = null) where TDeclarer : BindableObject
- {
- if (getter == null)
- throw new ArgumentNullException("getter");
-
- Expression expr = getter.Body;
-
- var unary = expr as UnaryExpression;
- if (unary != null)
- expr = unary.Operand;
-
- var member = expr as MemberExpression;
- if (member == null)
- throw new ArgumentException("getter must be a MemberExpression", "getter");
-
- var property = (PropertyInfo)member.Member;
-
- ValidateValueDelegate untypedValidateValue = null;
- BindingPropertyChangedDelegate untypedBindingPropertyChanged = null;
- BindingPropertyChangingDelegate untypedBindingPropertyChanging = null;
- CoerceValueDelegate untypedCoerceValue = null;
- CreateDefaultValueDelegate untypedDefaultValueCreator = null;
- if (validateValue != null)
- untypedValidateValue = (bindable, value) => validateValue(bindable, (TPropertyType)value);
- if (propertyChanged != null)
- untypedBindingPropertyChanged = (bindable, oldValue, newValue) => propertyChanged(bindable, (TPropertyType)oldValue, (TPropertyType)newValue);
- if (propertyChanging != null)
- untypedBindingPropertyChanging = (bindable, oldValue, newValue) => propertyChanging(bindable, (TPropertyType)oldValue, (TPropertyType)newValue);
- if (coerceValue != null)
- untypedCoerceValue = (bindable, value) => coerceValue(bindable, (TPropertyType)value);
- if (defaultValueCreator != null)
- untypedDefaultValueCreator = o => defaultValueCreator((TDeclarer)o);
-
- return new BindableProperty(property.Name, property.PropertyType, typeof(TDeclarer), defaultValue, defaultBindingMode, untypedValidateValue, untypedBindingPropertyChanged,
- untypedBindingPropertyChanging, untypedCoerceValue, bindingChanging, isReadOnly, untypedDefaultValueCreator);
- }
-
- internal static BindableProperty Create(string propertyName, Type returnType, Type declaringType, object defaultValue, BindingMode defaultBindingMode, ValidateValueDelegate validateValue,
- BindingPropertyChangedDelegate propertyChanged, BindingPropertyChangingDelegate propertyChanging, CoerceValueDelegate coerceValue, BindablePropertyBindingChanging bindingChanging,
- CreateDefaultValueDelegate defaultValueCreator = null)
- {
- return new BindableProperty(propertyName, returnType, declaringType, defaultValue, defaultBindingMode, validateValue, propertyChanged, propertyChanging, coerceValue, bindingChanging,
- defaultValueCreator: defaultValueCreator);
- }
-
- [Obsolete("CreateAttached<> (generic) is obsolete as of version 2.1.0 and is no longer supported.")]
- internal static BindableProperty CreateAttached<TDeclarer, TPropertyType>(Expression<Func<BindableObject, TPropertyType>> staticgetter, TPropertyType defaultValue, BindingMode defaultBindingMode,
- ValidateValueDelegate<TPropertyType> validateValue, BindingPropertyChangedDelegate<TPropertyType> propertyChanged, BindingPropertyChangingDelegate<TPropertyType> propertyChanging,
- CoerceValueDelegate<TPropertyType> coerceValue, BindablePropertyBindingChanging bindingChanging, bool isReadOnly = false,
- CreateDefaultValueDelegate<BindableObject, TPropertyType> defaultValueCreator = null)
- {
- if (staticgetter == null)
- throw new ArgumentNullException("staticgetter");
-
- Expression expr = staticgetter.Body;
-
- var unary = expr as UnaryExpression;
- if (unary != null)
- expr = unary.Operand;
-
- var methodcall = expr as MethodCallExpression;
- if (methodcall == null)
- throw new ArgumentException("staticgetter must be a MethodCallExpression", "staticgetter");
-
- MethodInfo method = methodcall.Method;
- if (!method.Name.StartsWith("Get", StringComparison.Ordinal))
- throw new ArgumentException("staticgetter name must start with Get", "staticgetter");
-
- string propertyname = method.Name.Substring(3);
-
- ValidateValueDelegate untypedValidateValue = null;
- BindingPropertyChangedDelegate untypedBindingPropertyChanged = null;
- BindingPropertyChangingDelegate untypedBindingPropertyChanging = null;
- CoerceValueDelegate untypedCoerceValue = null;
- CreateDefaultValueDelegate untypedDefaultValueCreator = null;
- if (validateValue != null)
- untypedValidateValue = (bindable, value) => validateValue(bindable, (TPropertyType)value);
- if (propertyChanged != null)
- untypedBindingPropertyChanged = (bindable, oldValue, newValue) => propertyChanged(bindable, (TPropertyType)oldValue, (TPropertyType)newValue);
- if (propertyChanging != null)
- untypedBindingPropertyChanging = (bindable, oldValue, newValue) => propertyChanging(bindable, (TPropertyType)oldValue, (TPropertyType)newValue);
- if (coerceValue != null)
- untypedCoerceValue = (bindable, value) => coerceValue(bindable, (TPropertyType)value);
- if (defaultValueCreator != null)
- untypedDefaultValueCreator = o => defaultValueCreator(o);
-
- return new BindableProperty(propertyname, method.ReturnType, typeof(TDeclarer), defaultValue, defaultBindingMode, untypedValidateValue, untypedBindingPropertyChanged, untypedBindingPropertyChanging,
- untypedCoerceValue, bindingChanging, isReadOnly, untypedDefaultValueCreator);
- }
-
- internal static BindableProperty CreateAttached(string propertyName, Type returnType, Type declaringType, object defaultValue, BindingMode defaultBindingMode, ValidateValueDelegate validateValue,
- BindingPropertyChangedDelegate propertyChanged, BindingPropertyChangingDelegate propertyChanging, CoerceValueDelegate coerceValue, BindablePropertyBindingChanging bindingChanging,
- bool isReadOnly, CreateDefaultValueDelegate defaultValueCreator = null)
- {
- return new BindableProperty(propertyName, returnType, declaringType, defaultValue, defaultBindingMode, validateValue, propertyChanged, propertyChanging, coerceValue, bindingChanging, isReadOnly,
- defaultValueCreator);
- }
-
- internal object GetDefaultValue(BindableObject bindable)
- {
- if (DefaultValueCreator != null)
- return DefaultValueCreator(bindable);
-
- return DefaultValue;
- }
-
- internal bool TryConvert(ref object value)
- {
- if (value == null)
- {
- return !ReturnTypeInfo.IsValueType || ReturnTypeInfo.IsGenericType && ReturnTypeInfo.GetGenericTypeDefinition() == typeof(Nullable<>);
- }
-
- Type valueType = value.GetType();
- Type type = ReturnType;
-
- // Dont support arbitrary IConvertible by limiting which types can use this
- Type[] convertableTo;
- TypeConverter typeConverterTo;
- if (SimpleConvertTypes.TryGetValue(valueType, out convertableTo) && Array.IndexOf(convertableTo, type) != -1)
- {
- value = Convert.ChangeType(value, type);
- }
- else if (WellKnownConvertTypes.TryGetValue(type, out typeConverterTo) && typeConverterTo.CanConvertFrom(valueType))
- {
- value = typeConverterTo.ConvertFromInvariantString(value.ToString());
- }
- else if (UserCustomConvertTypes.TryGetValue(type, out typeConverterTo) && typeConverterTo.CanConvertFrom(valueType))
- {
- //Modification for NUI XAML : user defined converter for DynamicResource can be added
- value = typeConverterTo.ConvertFromInvariantString(value.ToString());
- }
- else if (!ReturnTypeInfo.IsAssignableFrom(valueType.GetTypeInfo()))
- {
- var cast = type.GetImplicitConversionOperator(fromType: valueType, toType: type)
- ?? valueType.GetImplicitConversionOperator(fromType: valueType, toType: type);
-
- if (cast == null)
- return false;
-
- value = cast.Invoke(null, new[] { value });
- }
-
- return true;
- }
-
- internal delegate void BindablePropertyBindingChanging(BindableObject bindable, BindingBase oldValue, BindingBase newValue);
- }
-}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Globalization;
-using System.Linq;
-using System.Reflection;
-using System.Xml;
-using Tizen.NUI.Binding.Internals;
-using Tizen.NUI.Xaml;
-
-namespace Tizen.NUI.Binding
-{
- [Xaml.ProvideCompiled("Tizen.NUI.Xaml.Core.XamlC.BindablePropertyConverter")]
- [Xaml.TypeConversion(typeof(BindableProperty))]
- internal sealed class BindablePropertyConverter : TypeConverter, IExtendedTypeConverter
- {
- object IExtendedTypeConverter.ConvertFrom(CultureInfo culture, object value, IServiceProvider serviceProvider)
- {
- return ((IExtendedTypeConverter)this).ConvertFromInvariantString(value as string, serviceProvider);
- }
-
- object IExtendedTypeConverter.ConvertFromInvariantString(string value, IServiceProvider serviceProvider)
- {
- if (string.IsNullOrWhiteSpace(value))
- return null;
- if (serviceProvider == null)
- return null;
- var parentValuesProvider = serviceProvider.GetService(typeof(IProvideValueTarget)) as IProvideParentValues;
- var typeResolver = serviceProvider.GetService(typeof(IXamlTypeResolver)) as IXamlTypeResolver;
- if (typeResolver == null)
- return null;
- IXmlLineInfo lineinfo = null;
- var xmlLineInfoProvider = serviceProvider.GetService(typeof(IXmlLineInfoProvider)) as IXmlLineInfoProvider;
- if (xmlLineInfoProvider != null)
- lineinfo = xmlLineInfoProvider.XmlLineInfo;
- string[] parts = value.Split('.');
- Type type = null;
- if (parts.Length == 1)
- {
- if (parentValuesProvider == null)
- {
- string msg = string.Format("Can't resolve {0}", parts[0]);
- throw new XamlParseException(msg, lineinfo);
- }
- object parent = parentValuesProvider.ParentObjects.Skip(1).FirstOrDefault();
- if (parentValuesProvider.TargetObject is Setter)
- {
- var style = parent as Style;
- var triggerBase = parent as TriggerBase;
- var visualState = parent as VisualState;
- if (style != null)
- type = style.TargetType;
- else if (triggerBase != null)
- type = triggerBase.TargetType;
- else if (visualState != null)
- type = FindTypeForVisualState(parentValuesProvider, lineinfo);
- }
- else if (parentValuesProvider.TargetObject is Trigger)
- type = (parentValuesProvider.TargetObject as Trigger).TargetType;
- else if (parentValuesProvider.TargetObject is XamlPropertyCondition && (parent as TriggerBase) != null)
- type = (parent as TriggerBase).TargetType;
-
- if (type == null)
- throw new XamlParseException($"Can't resolve {parts [0]}", lineinfo);
-
- return ConvertFrom(type, parts[0], lineinfo);
- }
- if (parts.Length == 2)
- {
- if (!typeResolver.TryResolve(parts[0], out type))
- {
- string msg = string.Format("Can't resolve {0}", parts[0]);
- throw new XamlParseException(msg, lineinfo);
- }
- return ConvertFrom(type, parts[1], lineinfo);
- }
- throw new XamlParseException($"Can't resolve {value}. Syntax is [[prefix:]Type.]PropertyName.", lineinfo);
- }
-
- public override object ConvertFromInvariantString(string value)
- {
- if (string.IsNullOrWhiteSpace(value))
- return null;
- if (value.Contains(":"))
- {
- Console.WriteLine(null, "Can't resolve properties with xml namespace prefix.");
- return null;
- }
- string[] parts = value.Split('.');
- if (parts.Length != 2)
- {
- Console.WriteLine(null, $"Can't resolve {value}. Accepted syntax is Type.PropertyName.");
- return null;
- }
- Type type = Type.GetType("Tizen.NUI." + parts[0]);
- return ConvertFrom(type, parts[1], null);
- }
-
- BindableProperty ConvertFrom(Type type, string propertyName, IXmlLineInfo lineinfo)
- {
- string name = propertyName + "Property";
- FieldInfo bpinfo = type.GetField(fi => fi.Name == name && fi.IsStatic && fi.IsPublic && fi.FieldType == typeof(BindableProperty));
- if (bpinfo == null)
- throw new XamlParseException($"Can't resolve {name} on {type.Name}", lineinfo);
- var bp = bpinfo.GetValue(null) as BindableProperty;
- var isObsolete = bpinfo.GetCustomAttribute<ObsoleteAttribute>() != null;
- if (bp != null && bp.PropertyName != propertyName && !isObsolete)
- throw new XamlParseException($"The PropertyName of {type.Name}.{name} is not {propertyName}", lineinfo);
- return bp;
- }
-
- Type FindTypeForVisualState(IProvideParentValues parentValueProvider, IXmlLineInfo lineInfo)
- {
- var parents = parentValueProvider.ParentObjects.ToList();
-
- // Skip 0; we would not be making this check if TargetObject were not a Setter
- // Skip 1; we would not be making this check if the immediate parent were not a VisualState
-
- // VisualStates must be in a VisualStateGroup
- if(!(parents[2] is VisualStateGroup)) {
- throw new XamlParseException($"Expected {nameof(VisualStateGroup)} but found {parents[2]}.", lineInfo);
- }
-
- var vsTarget = parents[3];
-
- // Are these Visual States directly on a VisualElement?
- if (vsTarget is /*VisualElement*/BaseHandle)
- {
- return vsTarget.GetType();
- }
-
- if (!(parents[3] is VisualStateGroupList))
- {
- throw new XamlParseException($"Expected {nameof(VisualStateGroupList)} but found {parents[3]}.", lineInfo);
- }
-
- if (!(parents[4] is Setter))
- {
- throw new XamlParseException($"Expected {nameof(Setter)} but found {parents[4]}.", lineInfo);
- }
-
- // These must be part of a Style; verify that
- if (!(parents[5] is Style style))
- {
- throw new XamlParseException($"Expected {nameof(Style)} but found {parents[5]}.", lineInfo);
- }
-
- return style.TargetType;
- }
- }
-}
+++ /dev/null
-using System;
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding
-{
- /// <summary>
- /// The secret key to a BindableProperty, used to implement a BindableProperty with restricted write access.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public sealed class BindablePropertyKey
- {
- internal BindablePropertyKey(BindableProperty property)
- {
- if (property == null)
- throw new ArgumentNullException("property");
-
- BindableProperty = property;
- }
-
- /// <summary>
- /// Gets the BindableProperty.
- /// </summary>
- public BindableProperty BindableProperty { get; private set; }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Globalization;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Reflection;
-using System.Text;
-using Tizen.NUI.Binding.Internals;
-
-namespace Tizen.NUI.Binding
-{
- internal sealed class Binding : BindingBase
- {
- internal const string SelfPath = ".";
- IValueConverter _converter;
- object _converterParameter;
-
- BindingExpression _expression;
- string _path;
- object _source;
- string _updateSourceEventName;
-
- public Binding()
- {
- }
-
- public Binding(string path, BindingMode mode = BindingMode.Default, IValueConverter converter = null, object converterParameter = null, string stringFormat = null, object source = null)
- {
- if (path == null)
- throw new ArgumentNullException("path");
- if (string.IsNullOrWhiteSpace(path))
- throw new ArgumentException("path can not be an empty string", "path");
-
- Path = path;
- Converter = converter;
- ConverterParameter = converterParameter;
- Mode = mode;
- StringFormat = stringFormat;
- Source = source;
- }
-
- public IValueConverter Converter
- {
- get { return _converter; }
- set
- {
- ThrowIfApplied();
-
- _converter = value;
- }
- }
-
- public object ConverterParameter
- {
- get { return _converterParameter; }
- set
- {
- ThrowIfApplied();
-
- _converterParameter = value;
- }
- }
-
- public string Path
- {
- get { return _path; }
- set
- {
- ThrowIfApplied();
-
- _path = value;
- _expression = new BindingExpression(this, !string.IsNullOrWhiteSpace(value) ? value : SelfPath);
- }
- }
-
- public object Source
- {
- get { return _source; }
- set
- {
- ThrowIfApplied();
- _source = value;
- }
- }
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public string UpdateSourceEventName {
- get { return _updateSourceEventName; }
- set {
- ThrowIfApplied();
- _updateSourceEventName = value;
- }
- }
-
- [Obsolete]
- public static Binding Create<TSource>(Expression<Func<TSource, object>> propertyGetter, BindingMode mode = BindingMode.Default, IValueConverter converter = null, object converterParameter = null,
- string stringFormat = null)
- {
- if (propertyGetter == null)
- throw new ArgumentNullException("propertyGetter");
-
- return new Binding(GetBindingPath(propertyGetter), mode, converter, converterParameter, stringFormat);
- }
-
- internal override void Apply(bool fromTarget)
- {
- base.Apply(fromTarget);
-
- if (_expression == null)
- _expression = new BindingExpression(this, SelfPath);
-
- _expression.Apply(fromTarget);
- }
-
- internal override void Apply(object newContext, BindableObject bindObj, BindableProperty targetProperty, bool fromBindingContextChanged = false)
- {
- object src = _source;
- var isApplied = IsApplied;
-
- base.Apply(src ?? newContext, bindObj, targetProperty, fromBindingContextChanged: fromBindingContextChanged);
-
- if (src != null && isApplied && fromBindingContextChanged)
- return;
-
- object bindingContext = src ?? Context ?? newContext;
- if (_expression == null && bindingContext != null)
- _expression = new BindingExpression(this, SelfPath);
-
- _expression?.Apply(bindingContext, bindObj, targetProperty);
- }
-
- internal override BindingBase Clone()
- {
- return new Binding(Path, Mode) { Converter = Converter, ConverterParameter = ConverterParameter, StringFormat = StringFormat, Source = Source, UpdateSourceEventName = UpdateSourceEventName };
- }
-
- internal override object GetSourceValue(object value, Type targetPropertyType)
- {
- if (Converter != null)
- value = Converter.Convert(value, targetPropertyType, ConverterParameter, CultureInfo.CurrentUICulture);
-
- return base.GetSourceValue(value, targetPropertyType);
- }
-
- internal override object GetTargetValue(object value, Type sourcePropertyType)
- {
- if (Converter != null)
- value = Converter.ConvertBack(value, sourcePropertyType, ConverterParameter, CultureInfo.CurrentUICulture);
-
- return base.GetTargetValue(value, sourcePropertyType);
- }
-
- internal override void Unapply(bool fromBindingContextChanged = false)
- {
- if (Source != null && fromBindingContextChanged && IsApplied)
- return;
-
- base.Unapply(fromBindingContextChanged: fromBindingContextChanged);
-
- if (_expression != null)
- _expression.Unapply();
- }
-
- [Obsolete]
- static string GetBindingPath<TSource>(Expression<Func<TSource, object>> propertyGetter)
- {
- Expression expr = propertyGetter.Body;
-
- var unary = expr as UnaryExpression;
- if (unary != null)
- expr = unary.Operand;
-
- var builder = new StringBuilder();
-
- var indexed = false;
-
- var member = expr as MemberExpression;
- if (member == null)
- {
- var methodCall = expr as MethodCallExpression;
- if (methodCall != null)
- {
- if (methodCall.Arguments.Count == 0)
- throw new ArgumentException("Method calls are not allowed in binding expression");
-
- var arguments = new List<string>(methodCall.Arguments.Count);
- foreach (Expression arg in methodCall.Arguments)
- {
- if (arg.NodeType != ExpressionType.Constant)
- throw new ArgumentException("Only constants can be used as indexer arguments");
-
- object value = ((ConstantExpression)arg).Value;
- arguments.Add(value != null ? value.ToString() : "null");
- }
-
- Type declarerType = methodCall.Method.DeclaringType;
- DefaultMemberAttribute defaultMember = declarerType.GetTypeInfo().GetCustomAttributes(typeof(DefaultMemberAttribute), true).OfType<DefaultMemberAttribute>().FirstOrDefault();
- string indexerName = defaultMember != null ? defaultMember.MemberName : "Item";
-
- MethodInfo getterInfo =
- declarerType.GetProperties().Where(pi => (pi.GetMethod != null) && pi.Name == indexerName && pi.CanRead && pi.GetMethod.IsPublic && !pi.GetMethod.IsStatic).Select(pi => pi.GetMethod).FirstOrDefault();
- if (getterInfo != null)
- {
- if (getterInfo == methodCall.Method)
- {
- indexed = true;
- builder.Append("[");
-
- var first = true;
- foreach (string argument in arguments)
- {
- if (!first)
- builder.Append(",");
-
- builder.Append(argument);
- first = false;
- }
-
- builder.Append("]");
-
- member = methodCall.Object as MemberExpression;
- }
- else
- throw new ArgumentException("Method calls are not allowed in binding expressions");
- }
- else
- throw new ArgumentException("Public indexer not found");
- }
- else
- throw new ArgumentException("Invalid expression type");
- }
-
- while (member != null)
- {
- var property = (PropertyInfo)member.Member;
- if (builder.Length != 0)
- {
- if (!indexed)
- builder.Insert(0, ".");
- else
- indexed = false;
- }
-
- builder.Insert(0, property.Name);
-
- // member = member.Expression as MemberExpression ?? (member.Expression as UnaryExpression)?.Operand as MemberExpression;
- member = member.Expression as MemberExpression ?? (member.Expression is UnaryExpression ? (member.Expression as UnaryExpression).Operand as MemberExpression : null);
- }
-
- return builder.ToString();
- }
- }
-}
+++ /dev/null
-using System;
-using System.Collections;
-using System.Runtime.CompilerServices;
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding
-{
- /// <summary>
- /// An abstract class that provides a BindingMode and a formatting option.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal abstract class BindingBase
- {
- static readonly ConditionalWeakTable<IEnumerable, CollectionSynchronizationContext> SynchronizedCollections = new ConditionalWeakTable<IEnumerable, CollectionSynchronizationContext>();
-
- BindingMode _mode = BindingMode.Default;
- string _stringFormat;
- object _targetNullValue;
- object _fallbackValue;
-
- internal BindingBase()
- {
- }
-
- /// <summary>
- /// Gets or sets the mode for this binding.
- /// </summary>
- public BindingMode Mode
- {
- get { return _mode; }
- set
- {
- if ( value != BindingMode.Default
- && value != BindingMode.OneWay
- && value != BindingMode.OneWayToSource
- && value != BindingMode.TwoWay
- && value != BindingMode.OneTime)
- throw new ArgumentException("mode is not a valid BindingMode", "mode");
-
- ThrowIfApplied();
-
- _mode = value;
- }
- }
-
- /// <summary>
- /// Gets or sets the string format for this binding.
- /// </summary>
- public string StringFormat
- {
- get { return _stringFormat; }
- set
- {
- ThrowIfApplied();
-
- _stringFormat = value;
- }
- }
-
- 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; }
-
- internal bool IsApplied { get; private set; }
-
- /// <summary>
- /// Stops synchronization on the collection.
- /// </summary>
- /// <param name="collection">The collection on which to stop synchronization.</param>
- public static void DisableCollectionSynchronization(IEnumerable collection)
- {
- if (collection == null)
- throw new ArgumentNullException(nameof(collection));
-
- SynchronizedCollections.Remove(collection);
- }
-
- public static void EnableCollectionSynchronization(IEnumerable collection, object context, CollectionSynchronizationCallback callback)
- {
- if (collection == null)
- throw new ArgumentNullException(nameof(collection));
- if (callback == null)
- throw new ArgumentNullException(nameof(callback));
-
- SynchronizedCollections.Add(collection, new CollectionSynchronizationContext(context, callback));
- }
-
- /// <summary>
- /// Throws an InvalidOperationException if the binding has been applied.
- /// </summary>
- protected void ThrowIfApplied()
- {
- if (IsApplied)
- throw new InvalidOperationException("Can not change a binding while it's applied");
- }
-
- internal virtual void Apply(bool fromTarget)
- {
- IsApplied = true;
- }
-
- internal virtual void Apply(object context, BindableObject bindObj, BindableProperty targetProperty, bool fromBindingContextChanged = false)
- {
- IsApplied = true;
- }
-
- internal abstract BindingBase Clone();
-
- internal virtual object GetSourceValue(object value, Type targetPropertyType)
- {
- if (value == null && TargetNullValue != null)
- return TargetNullValue;
- if (StringFormat != null)
- return string.Format(StringFormat, value);
-
- return value;
- }
-
- internal virtual object GetTargetValue(object value, Type sourcePropertyType)
- {
- return value;
- }
-
- internal static bool TryGetSynchronizedCollection(IEnumerable collection, out CollectionSynchronizationContext synchronizationContext)
- {
- if (collection == null)
- throw new ArgumentNullException(nameof(collection));
-
- return SynchronizedCollections.TryGetValue(collection, out synchronizationContext);
- }
-
- internal virtual void Unapply(bool fromBindingContextChanged = false)
- {
- IsApplied = false;
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Binding
-{
- internal static class BindingBaseExtensions
- {
- public static BindingMode GetRealizedMode(this BindingBase self, BindableProperty property)
- {
- return self.Mode != BindingMode.Default ? self.Mode : property.DefaultBindingMode;
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Diagnostics;
-using System.Globalization;
-using System.Linq;
-using System.Reflection;
-using Tizen.NUI.Binding.Internals;
-using System.Runtime.CompilerServices;
-
-namespace Tizen.NUI.Binding
-{
- internal class BindingExpression
- {
- internal const string PropertyNotFoundErrorMessage = "'{0}' property not found on '{1}', target property: '{2}.{3}'";
-
- readonly List<BindingExpressionPart> _parts = new List<BindingExpressionPart>();
-
- BindableProperty _targetProperty;
- WeakReference<object> _weakSource;
- WeakReference<BindableObject> _weakTarget;
-
- internal BindingExpression(BindingBase binding, string path)
- {
- if (binding == null)
- throw new ArgumentNullException(nameof(binding));
- if (path == null)
- throw new ArgumentNullException(nameof(path));
-
- Binding = binding;
- Path = path;
-
- ParsePath();
- }
-
- internal BindingBase Binding { get; }
-
- internal string Path { get; }
-
- /// <summary>
- /// Applies the binding expression to a previously set source and target.
- /// </summary>
- internal void Apply(bool fromTarget = false)
- {
- if (_weakSource == null || _weakTarget == null)
- return;
-
- BindableObject target;
- if (!_weakTarget.TryGetTarget(out target))
- {
- Unapply();
- return;
- }
-
- object source;
- if (_weakSource.TryGetTarget(out source) && _targetProperty != null)
- ApplyCore(source, target, _targetProperty, fromTarget);
- }
-
- /// <summary>
- /// Applies the binding expression to a new source or target.
- /// </summary>
- internal void Apply(object sourceObject, BindableObject target, BindableProperty property)
- {
- _targetProperty = property;
-
- BindableObject prevTarget;
- if (_weakTarget != null && _weakTarget.TryGetTarget(out prevTarget) && !ReferenceEquals(prevTarget, target))
- throw new InvalidOperationException("Binding instances can not be reused");
-
- object previousSource;
- if (_weakSource != null && _weakSource.TryGetTarget(out previousSource) && !ReferenceEquals(previousSource, sourceObject))
- throw new InvalidOperationException("Binding instances can not be reused");
-
- _weakSource = new WeakReference<object>(sourceObject);
- _weakTarget = new WeakReference<BindableObject>(target);
-
- ApplyCore(sourceObject, target, property);
- }
-
- internal void Unapply()
- {
- object sourceObject;
- if (_weakSource != null && _weakSource.TryGetTarget(out sourceObject))
- {
- for (var i = 0; i < _parts.Count - 1; i++)
- {
- BindingExpressionPart part = _parts[i];
-
- if (!part.IsSelf)
- {
- part.TryGetValue(sourceObject, out sourceObject);
- }
-
- part.Unsubscribe();
- }
- }
-
- _weakSource = null;
- _weakTarget = null;
- }
-
- /// <summary>
- /// Applies the binding expression to a previously set source or target.
- /// </summary>
- void ApplyCore(object sourceObject, BindableObject target, BindableProperty property, bool fromTarget = false)
- {
- BindingMode mode = Binding.GetRealizedMode(_targetProperty);
- if ((mode == BindingMode.OneWay || mode == BindingMode.OneTime) && fromTarget)
- return;
-
- bool needsGetter = (mode == BindingMode.TwoWay && !fromTarget) || mode == BindingMode.OneWay || mode == BindingMode.OneTime;
- bool needsSetter = !needsGetter && ((mode == BindingMode.TwoWay && fromTarget) || mode == BindingMode.OneWayToSource);
-
- object current = sourceObject;
- object previous = null;
- BindingExpressionPart part = null;
-
- for (var i = 0; i < _parts.Count; i++)
- {
- part = _parts[i];
- bool isLast = i + 1 == _parts.Count;
-
- if (!part.IsSelf && current != null)
- {
- // Allow the object instance itself to provide its own TypeInfo
- var reflectable = current as IReflectableType;
- System.Reflection.TypeInfo currentType = reflectable != null ? reflectable.GetTypeInfo() : current.GetType().GetTypeInfo();
- if (part.LastGetter == null || !part.LastGetter.DeclaringType.GetTypeInfo().IsAssignableFrom(currentType))
- SetupPart(currentType, part);
-
- if (!isLast)
- part.TryGetValue(current, out current);
- }
-
- if (!part.IsSelf && current != null)
- {
- if ((needsGetter && part.LastGetter == null) || (needsSetter && part.NextPart == null && part.LastSetter == null))
- {
- Console.WriteLine("Binding", PropertyNotFoundErrorMessage, part.Content, current, target.GetType(), property.PropertyName);
- break;
- }
- }
-
- if (mode == BindingMode.OneWay || mode == BindingMode.TwoWay)
- {
- var inpc = current as INotifyPropertyChanged;
- if (inpc != null && !ReferenceEquals(current, previous))
- part.Subscribe(inpc);
- }
-
- previous = current;
- }
-
- Debug.Assert(part != null, "There should always be at least the self part in the expression.");
-
- if (needsGetter)
- {
- object value = property.DefaultValue;
- if (part.TryGetValue(current, out value) || part.IsSelf)
- {
- value = Binding.GetSourceValue(value, property.ReturnType);
- }
- else
- value = property.DefaultValue;
-
- if (!TryConvert(part, ref value, property.ReturnType, true))
- {
- Console.WriteLine("Binding", "{0} can not be converted to type '{1}'", value, property.ReturnType);
- return;
- }
-
- target.SetValueCore(property, value, SetValueFlags.ClearDynamicResource, BindableObject.SetValuePrivateFlags.Default | BindableObject.SetValuePrivateFlags.Converted, false);
- }
- else if (needsSetter && part.LastSetter != null && current != null)
- {
- object value = Binding.GetTargetValue(target.GetValue(property), part.SetterType);
-
- if (!TryConvert(part, ref value, part.SetterType, false))
- {
- Console.WriteLine("Binding", "{0} can not be converted to type '{1}'", value, part.SetterType);
- return;
- }
-
- object[] args;
- if (part.IsIndexer)
- {
- args = new object[part.Arguments.Length + 1];
- part.Arguments.CopyTo(args, 0);
- args[args.Length - 1] = value;
- }
- else if (part.IsBindablePropertySetter)
- {
- args = new[] { part.BindablePropertyField, value };
- }
- else
- {
- args = new[] { value };
- }
-
- part.LastSetter.Invoke(current, args);
- }
- }
-
- IEnumerable<BindingExpressionPart> GetPart(string part)
- {
- part = part.Trim();
- if (part == string.Empty)
- throw new FormatException("Path contains an empty part");
-
- BindingExpressionPart indexer = null;
-
- int lbIndex = part.IndexOf('[');
- if (lbIndex != -1)
- {
- int rbIndex = part.LastIndexOf(']');
- if (rbIndex == -1)
- throw new FormatException("Indexer did not contain closing bracket");
-
- int argLength = rbIndex - lbIndex - 1;
- if (argLength == 0)
- throw new FormatException("Indexer did not contain arguments");
-
- string argString = part.Substring(lbIndex + 1, argLength);
- indexer = new BindingExpressionPart(this, argString, true);
-
- part = part.Substring(0, lbIndex);
- part = part.Trim();
- }
-
- if (part.Length > 0)
- yield return new BindingExpressionPart(this, part);
- if (indexer != null)
- yield return indexer;
- }
-
- void ParsePath()
- {
- string p = Path.Trim();
-
- var last = new BindingExpressionPart(this, ".");
- _parts.Add(last);
-
- if (p[0] == '.')
- {
- if (p.Length == 1)
- return;
-
- p = p.Substring(1);
- }
-
- string[] pathParts = p.Split('.');
- for (var i = 0; i < pathParts.Length; i++)
- {
- foreach (BindingExpressionPart part in GetPart(pathParts[i]))
- {
- last.NextPart = part;
- _parts.Add(part);
- last = part;
- }
- }
- }
-
- void SetupPart(System.Reflection.TypeInfo sourceType, BindingExpressionPart part)
- {
- part.Arguments = null;
- part.LastGetter = null;
- part.LastSetter = null;
-
- PropertyInfo property = null;
- if (part.IsIndexer)
- {
- if (sourceType.IsArray)
- {
- int index;
- if (!int.TryParse(part.Content, out index))
- Console.WriteLine("Binding", "{0} could not be parsed as an index for a {1}", part.Content, sourceType);
- else
- part.Arguments = new object[] { index };
-
- part.LastGetter = sourceType.GetDeclaredMethod("Get");
- part.LastSetter = sourceType.GetDeclaredMethod("Set");
- part.SetterType = sourceType.GetElementType();
- }
-
- DefaultMemberAttribute defaultMember = sourceType.GetCustomAttributes(typeof(DefaultMemberAttribute), true).OfType<DefaultMemberAttribute>().FirstOrDefault();
- string indexerName = defaultMember != null ? defaultMember.MemberName : "Item";
-
- part.IndexerName = indexerName;
-
-#if NETSTANDARD2_0
- try {
- property = sourceType.GetDeclaredProperty(indexerName);
- }
- catch (AmbiguousMatchException) {
- // Get most derived instance of property
- foreach (var p in sourceType.GetProperties().Where(prop => prop.Name == indexerName)) {
- if (property == null || property.DeclaringType.IsAssignableFrom(property.DeclaringType))
- property = p;
- }
- }
-#else
- property = sourceType.GetDeclaredProperty(indexerName);
-#endif
-
- if (property == null) //is the indexer defined on the base class?
- property = sourceType.BaseType.GetProperty(indexerName);
- if (property == null) //is the indexer defined on implemented interface ?
- {
- foreach (var implementedInterface in sourceType.ImplementedInterfaces)
- {
- property = implementedInterface.GetProperty(indexerName);
- if (property != null)
- break;
- }
- }
-
- if (property != null)
- {
- ParameterInfo parameter = property.GetIndexParameters().FirstOrDefault();
- if (parameter != null)
- {
- try
- {
- object arg = Convert.ChangeType(part.Content, parameter.ParameterType, CultureInfo.InvariantCulture);
- part.Arguments = new[] { arg };
- }
- catch (FormatException)
- {
- }
- catch (InvalidCastException)
- {
- }
- catch (OverflowException)
- {
- }
- }
- }
- }
- else
- property = sourceType.GetDeclaredProperty(part.Content) ?? sourceType.BaseType?.GetProperty(part.Content);
-
- if (property != null)
- {
- if (property.CanRead && property.GetMethod != null)
- {
- if (property.GetMethod.IsPublic && !property.GetMethod.IsStatic)
- {
- part.LastGetter = property.GetMethod;
- }
- }
- if (property.CanWrite && property.SetMethod != null)
- {
- if(property.SetMethod.IsPublic && !property.SetMethod.IsStatic)
- {
- part.LastSetter = property.SetMethod;
- part.SetterType = part.LastSetter.GetParameters().Last().ParameterType;
-
- if (Binding.AllowChaining)
- {
- FieldInfo bindablePropertyField = sourceType.GetDeclaredField(part.Content + "Property");
- if (bindablePropertyField != null && bindablePropertyField.FieldType == typeof(BindableProperty) && sourceType.ImplementedInterfaces.Contains(typeof(IElementController)))
- {
- MethodInfo setValueMethod = null;
-#if NETSTANDARD1_0
- foreach (MethodInfo m in sourceType.AsType().GetRuntimeMethods())
- {
- if (m.Name.EndsWith("IElementController.SetValueFromRenderer"))
- {
- ParameterInfo[] parameters = m.GetParameters();
- if (parameters.Length == 2 && parameters[0].ParameterType == typeof(BindableProperty))
- {
- setValueMethod = m;
- break;
- }
- }
- }
-#else
- setValueMethod = typeof(IElementController).GetMethod("SetValueFromRenderer", new[] { typeof(BindableProperty), typeof(object) });
-#endif
- if (setValueMethod != null)
- {
- part.LastSetter = setValueMethod;
- part.IsBindablePropertySetter = true;
- part.BindablePropertyField = bindablePropertyField.GetValue(null);
- }
- }
- }
- }
- }
-#if !NETSTANDARD1_0
- //TupleElementNamesAttribute tupleEltNames;
- //if (property != null
- // && part.NextPart != null
- // && property.PropertyType.IsGenericType
- // && (property.PropertyType.GetGenericTypeDefinition() == typeof(ValueTuple<>)
- // || property.PropertyType.GetGenericTypeDefinition() == typeof(ValueTuple<,>)
- // || property.PropertyType.GetGenericTypeDefinition() == typeof(ValueTuple<,,>)
- // || property.PropertyType.GetGenericTypeDefinition() == typeof(ValueTuple<,,,>)
- // || property.PropertyType.GetGenericTypeDefinition() == typeof(ValueTuple<,,,,>)
- // || property.PropertyType.GetGenericTypeDefinition() == typeof(ValueTuple<,,,,,>)
- // || property.PropertyType.GetGenericTypeDefinition() == typeof(ValueTuple<,,,,,,>)
- // || property.PropertyType.GetGenericTypeDefinition() == typeof(ValueTuple<,,,,,,,>))
- // && (tupleEltNames = property.GetCustomAttribute(typeof(TupleElementNamesAttribute)) as TupleElementNamesAttribute) != null)
- //{
- // // modify the nextPart to access the tuple item via the ITuple indexer
- // var nextPart = part.NextPart;
- // var name = nextPart.Content;
- // var index = tupleEltNames.TransformNames.IndexOf(name);
- // if (index >= 0)
- // {
- // nextPart.IsIndexer = true;
- // nextPart.Content = index.ToString();
- // }
- //}
-#endif
- }
-
- }
- static Type[] DecimalTypes = new[] { typeof(float), typeof(decimal), typeof(double) };
-
- bool TryConvert(BindingExpressionPart part, ref object value, Type convertTo, bool toTarget)
- {
- if (value == null)
- return true;
- if ((toTarget && _targetProperty.TryConvert(ref value)) || (!toTarget && convertTo.IsInstanceOfType(value)))
- return true;
-
- object original = value;
- try
- {
- var stringValue = value as string ?? string.Empty;
- // see: https://bugzilla.xamarin.com/show_bug.cgi?id=32871
- // do not canonicalize "*.[.]"; "1." should not update bound BindableProperty
- if (stringValue.EndsWith(".") && DecimalTypes.Contains(convertTo))
- throw new FormatException();
-
- // do not canonicalize "-0"; user will likely enter a period after "-0"
- if (stringValue == "-0" && DecimalTypes.Contains(convertTo))
- throw new FormatException();
-
- value = Convert.ChangeType(value, convertTo, CultureInfo.InvariantCulture);
- return true;
- }
- catch (InvalidCastException)
- {
- value = original;
- return false;
- }
- catch (FormatException)
- {
- value = original;
- return false;
- }
- catch (OverflowException)
- {
- value = original;
- return false;
- }
- }
-
- class BindingPair
- {
- public BindingPair(BindingExpressionPart part, object source, bool isLast)
- {
- Part = part;
- Source = source;
- IsLast = isLast;
- }
-
- public bool IsLast { get; set; }
-
- public BindingExpressionPart Part { get; private set; }
-
- public object Source { get; private set; }
- }
-
- internal class WeakPropertyChangedProxy
- {
- readonly WeakReference<INotifyPropertyChanged> _source = new WeakReference<INotifyPropertyChanged>(null);
- readonly WeakReference<PropertyChangedEventHandler> _listener = new WeakReference<PropertyChangedEventHandler>(null);
- readonly PropertyChangedEventHandler _handler;
- readonly EventHandler _bchandler;
- internal WeakReference<INotifyPropertyChanged> Source => _source;
-
- public WeakPropertyChangedProxy()
- {
- _handler = new PropertyChangedEventHandler(OnPropertyChanged);
- _bchandler = new EventHandler(OnBCChanged);
- }
-
- public WeakPropertyChangedProxy(INotifyPropertyChanged source, PropertyChangedEventHandler listener) : this()
- {
- SubscribeTo(source, listener);
- }
-
- public void SubscribeTo(INotifyPropertyChanged source, PropertyChangedEventHandler listener)
- {
- source.PropertyChanged += _handler;
- var bo = source as BindableObject;
- if (bo != null)
- bo.BindingContextChanged += _bchandler;
- _source.SetTarget(source);
- _listener.SetTarget(listener);
- }
-
- public void Unsubscribe()
- {
- INotifyPropertyChanged source;
- if (_source.TryGetTarget(out source) && source != null)
- source.PropertyChanged -= _handler;
- var bo = source as BindableObject;
- if (bo != null)
- bo.BindingContextChanged -= _bchandler;
-
- _source.SetTarget(null);
- _listener.SetTarget(null);
- }
-
- void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
- {
- PropertyChangedEventHandler handler;
- if (_listener.TryGetTarget(out handler) && handler != null)
- handler(sender, e);
- else
- Unsubscribe();
- }
-
- void OnBCChanged(object sender, EventArgs e)
- {
- OnPropertyChanged(sender, new PropertyChangedEventArgs("BindingContext"));
- }
- }
-
- class BindingExpressionPart
- {
- readonly BindingExpression _expression;
- readonly PropertyChangedEventHandler _changeHandler;
- WeakPropertyChangedProxy _listener;
-
- public BindingExpressionPart(BindingExpression expression, string content, bool isIndexer = false)
- {
- _expression = expression;
- IsSelf = content == Tizen.NUI.Binding.Binding.SelfPath;
- Content = content;
- IsIndexer = isIndexer;
-
- _changeHandler = PropertyChanged;
- }
-
- public void Subscribe(INotifyPropertyChanged handler)
- {
- INotifyPropertyChanged source;
- if (_listener != null && _listener.Source.TryGetTarget(out source) && ReferenceEquals(handler, source))
- // Already subscribed
- return;
-
- // Clear out the old subscription if necessary
- Unsubscribe();
-
- _listener = new WeakPropertyChangedProxy(handler, _changeHandler);
- }
-
- public void Unsubscribe()
- {
- var listener = _listener;
- if (listener != null)
- {
- listener.Unsubscribe();
- _listener = null;
- }
- }
-
- public object[] Arguments { get; set; }
-
- public object BindablePropertyField { get; set; }
-
- public string Content { get; internal set; }
-
- public string IndexerName { get; set; }
-
- public bool IsBindablePropertySetter { get; set; }
-
- public bool IsIndexer { get; internal set; }
-
- public bool IsSelf { get; }
-
- public MethodInfo LastGetter { get; set; }
-
- public MethodInfo LastSetter { get; set; }
-
- public BindingExpressionPart NextPart { get; set; }
-
- public Type SetterType { get; set; }
-
- public void PropertyChanged(object sender, PropertyChangedEventArgs args)
- {
- BindingExpressionPart part = NextPart ?? this;
-
- string name = args.PropertyName;
-
- if (!string.IsNullOrEmpty(name))
- {
- if (part.IsIndexer)
- {
- if (name.Contains("["))
- {
- if (name != string.Format("{0}[{1}]", part.IndexerName, part.Content))
- return;
- }
- else if (name != part.IndexerName)
- return;
- }
- else if (name != part.Content)
- {
- return;
- }
- }
-
- _expression.Apply();
- // Device.BeginInvokeOnMainThread(() => _expression.Apply());
- }
-
- public bool TryGetValue(object source, out object value)
- {
- value = source;
-
- if (LastGetter != null && value != null)
- {
- if (IsIndexer)
- {
- try
- {
- value = LastGetter.Invoke(value, Arguments);
- }
- catch (TargetInvocationException ex)
- {
- if (!(ex.InnerException is KeyNotFoundException))
- throw;
- value = null;
- }
- return true;
- }
- value = LastGetter.Invoke(value, Arguments);
- return true;
- }
-
- return false;
- }
- }
- }
-}
+++ /dev/null
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding
-{
- /// <summary>
- /// The direction of changes propagation for bindings.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public enum BindingMode
- {
- /// <summary>
- /// When used in Bindings, indicates that the Binding should use the DefaultBindingMode. When used in BindableProperty declaration, defaults to BindingMode.OneWay.
- /// </summary>
- Default,
-
- /// <summary>
- /// Indicates that the binding should propagates changes from source (usually the View Model) to target (the BindableObject) in both directions.
- /// </summary>
- TwoWay,
-
- /// <summary>
- /// Indicates that the binding should only propagate changes from source (usually the View Model) to target (the BindableObject). This is the default mode for most BindableProperty values.
- /// </summary>
- OneWay,
-
- /// <summary>
- /// Indicates that the binding should only propagate changes from target (the BindableObject) to source (usually the View Model). This is mainly used for read-only BindableProperty values.
- /// </summary>
- OneWayToSource,
-
- /// <summary>
- /// Indicates that the binding will be applied only when the binding context changes and the value will not be monitored for changes with INotifyPropertyChanged.
- /// </summary>
- OneTime,
- }
-}
\ No newline at end of file
+++ /dev/null
-namespace Tizen.NUI.Binding
-{
- [Xaml.ProvideCompiled("Tizen.NUI.Xaml.Core.XamlC.BindingTypeConverter")]
- [Xaml.TypeConversion(typeof(Binding))]
- internal sealed class BindingTypeConverter : TypeConverter
- {
- public override object ConvertFromInvariantString(string value)
- {
- return new Binding(value);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections;
-
-namespace Tizen.NUI.Binding
-{
- internal delegate void CollectionSynchronizationCallback(IEnumerable collection, object context, Action accessMethod, bool writeAccess);
-}
\ No newline at end of file
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Binding
-{
- internal sealed class CollectionSynchronizationContext
- {
- internal CollectionSynchronizationContext(object context, CollectionSynchronizationCallback callback)
- {
- ContextReference = new WeakReference(context);
- Callback = callback;
- }
-
- internal CollectionSynchronizationCallback Callback { get; private set; }
-
- internal object Context
- {
- get { return ContextReference != null ? ContextReference.Target : null; }
- }
-
- internal WeakReference ContextReference { get; }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Globalization;
-
-namespace Tizen.NUI.Binding
-{
- [Xaml.ProvideCompiled("Tizen.NUI.Xaml.Core.XamlC.ColorTypeConverter")]
- [Xaml.TypeConversion(typeof(Color))]
- internal class ColorTypeConverter : TypeConverter
- {
- // Supported inputs
- // HEX #rgb, #argb, #rrggbb, #aarrggbb
- // float array 0.5,0.5,0.5,0.5
- // Predefined color case insensitive
- public override object ConvertFromInvariantString(string value)
- {
- if (value != null)
- {
- value = value.Trim();
- if (value.StartsWith("#", StringComparison.Ordinal))
- {
- return FromHex(value);
- }
-
- string[] parts = value.Split(',');
- if (parts.Length == 1) //like Red or Color.Red
- {
- parts = value.Split('.');
- if (parts.Length == 1 || (parts.Length == 2 && parts[0] == "Color"))
- {
- string color = parts[parts.Length - 1];
- switch (color)
- {
- case "Black": return Color.Black;
- case "White": return Color.White;
- case "Red": return Color.Red;
- case "Green": return Color.Green;
- case "Blue": return Color.Blue;
- case "Yellow": return Color.Yellow;
- case "Magenta": return Color.Magenta;
- case "Cyan": return Color.Cyan;
- case "Transparent": return Color.Transparent;
- }
- }
- }
- else if (parts.Length == 4) //like 0.5,0.5,0.5,0.5
- {
- 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));
- }
- }
-
- throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(Color)}");
- }
-
- static uint ToHex(char c)
- {
- ushort x = (ushort)c;
- if (x >= '0' && x <= '9')
- return (uint)(x - '0');
-
- x |= 0x20;
- if (x >= 'a' && x <= 'f')
- return (uint)(x - 'a' + 10);
- return 0;
- }
-
- static uint ToHexD(char c)
- {
- var j = ToHex(c);
- return (j << 4) | j;
- }
-
- public static Color FromRgba(int r, int g, int b, int a)
- {
- float red = (float)r / 255;
- float green = (float)g / 255;
- float blue = (float)b / 255;
- float alpha = (float)a / 255;
- return new Color(red, green, blue, alpha);
- }
-
- public static Color FromRgb(int r, int g, int b)
- {
- return FromRgba(r, g, b, 255);
- }
-
- static Color FromHex(string hex)
- {
- // Undefined
- if (hex.Length < 3)
- return Color.Black;
- int idx = (hex[0] == '#') ? 1 : 0;
-
- switch (hex.Length - idx)
- {
- case 3: //#rgb => ffrrggbb
- var t1 = ToHexD(hex[idx++]);
- var t2 = ToHexD(hex[idx++]);
- var t3 = ToHexD(hex[idx]);
-
- return FromRgb((int)t1, (int)t2, (int)t3);
-
- case 4: //#argb => aarrggbb
- var f1 = ToHexD(hex[idx++]);
- var f2 = ToHexD(hex[idx++]);
- var f3 = ToHexD(hex[idx++]);
- var f4 = ToHexD(hex[idx]);
- return FromRgba((int)f2, (int)f3, (int)f4, (int)f1);
-
- case 6: //#rrggbb => ffrrggbb
- return FromRgb((int)(ToHex(hex[idx++]) << 4 | ToHex(hex[idx++])),
- (int)(ToHex(hex[idx++]) << 4 | ToHex(hex[idx++])),
- (int)(ToHex(hex[idx++]) << 4 | ToHex(hex[idx])));
-
- case 8: //#aarrggbb
- var a1 = ToHex(hex[idx++]) << 4 | ToHex(hex[idx++]);
- return FromRgba((int)(ToHex(hex[idx++]) << 4 | ToHex(hex[idx++])),
- (int)(ToHex(hex[idx++]) << 4 | ToHex(hex[idx++])),
- (int)(ToHex(hex[idx++]) << 4 | ToHex(hex[idx])),
- (int)a1);
-
- default: //everything else will result in unexpected results
- return Color.Black;
- }
- }
- }
-}
+++ /dev/null
-
-namespace Tizen.NUI.Binding
-{
- internal class Configuration<TPlatform, TElement> : IPlatformElementConfiguration<TPlatform, TElement>
- where TPlatform : IConfigPlatform
- where TElement : Element
-
- {
- public Configuration(TElement element)
- {
- Element = element;
- }
-
- public TElement Element { get; }
-
- public static Configuration<TPlatform, TElement> Create(TElement element)
- {
- return new Configuration<TPlatform, TElement>(element);
- }
- }
-}
+++ /dev/null
-//
-// ContentPropertyAttribute.cs
-//
-// Author:
-// Stephane Delcroix <stephane@delcroix.org>
-//
-// Copyright (c) 2013 S. Delcroix
-//
-
-using System;
-
-namespace Tizen.NUI.Binding
-{
- [AttributeUsage(AttributeTargets.Class)]
- internal sealed class ContentPropertyAttribute : Attribute
- {
- internal static string[] ContentPropertyTypes = { "Tizen.NUI.Binding.ContentPropertyAttribute", "System.Windows.Markup.ContentPropertyAttribute" };
-
- public ContentPropertyAttribute(string name)
- {
- Name = name;
- }
-
- public string Name { get; private set; }
- }
-}
+++ /dev/null
-using System;
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding
-{
- /// <summary>
- /// Template that specifies a group of styles and effects for controls.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal class ControlTemplate : ElementTemplate
- {
- /// <summary>
- /// For internal use only.
- /// </summary>
- public ControlTemplate()
- {
- }
-
- /// <summary>
- /// Creates a new control template for the specified control type.
- /// </summary>
- /// <param name="type">The type of control for which to create a template.</param>
- public ControlTemplate(Type type) : base(type)
- {
- }
- }
-}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-
-namespace Tizen.NUI.Binding
-{
- internal class DataTemplate : ElementTemplate
- {
- public DataTemplate()
- {
- }
-
- public DataTemplate(Type type) : base(type)
- {
- }
-
- public DataTemplate(Func<object> loadTemplate) : base(loadTemplate)
- {
- }
-
- public IDictionary<BindableProperty, BindingBase> Bindings { get; } = new Dictionary<BindableProperty, BindingBase>();
-
- public IDictionary<BindableProperty, object> Values { get; } = new Dictionary<BindableProperty, object>();
-
- public void SetBinding(BindableProperty property, BindingBase binding)
- {
- if (property == null)
- throw new ArgumentNullException("property");
- if (binding == null)
- throw new ArgumentNullException("binding");
-
- Values.Remove(property);
- Bindings[property] = binding;
- }
-
- public void SetValue(BindableProperty property, object value)
- {
- if (property == null)
- throw new ArgumentNullException("property");
-
- Bindings.Remove(property);
- Values[property] = value;
- }
-
- internal override void SetupContent(object item)
- {
- ApplyBindings(item);
- ApplyValues(item);
- }
-
- void ApplyBindings(object item)
- {
- if (Bindings == null)
- return;
-
- var bindable = item as BindableObject;
- if (bindable == null)
- return;
-
- foreach (KeyValuePair<BindableProperty, BindingBase> kvp in Bindings)
- {
- if (Values.ContainsKey(kvp.Key))
- throw new InvalidOperationException("Binding and Value found for " + kvp.Key.PropertyName);
-
- bindable.SetBinding(kvp.Key, kvp.Value.Clone());
- }
- }
-
- void ApplyValues(object item)
- {
- if (Values == null)
- return;
-
- var bindable = item as BindableObject;
- if (bindable == null)
- return;
- foreach (KeyValuePair<BindableProperty, object> kvp in Values)
- bindable.SetValue(kvp.Key, kvp.Value);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding
-{
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal static class DataTemplateExtensions
- {
- public static DataTemplate SelectDataTemplate(this DataTemplate self, object item, BindableObject container)
- {
- var selector = self as DataTemplateSelector;
- if (selector == null)
- return self;
-
- return selector.SelectTemplate(item, container);
- }
-
- public static object CreateContent(this DataTemplate self, object item, BindableObject container)
- {
- return self.SelectDataTemplate(item, container).CreateContent();
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-
-namespace Tizen.NUI.Binding
-{
- internal abstract class DataTemplateSelector : DataTemplate
- {
- Dictionary<Type, DataTemplate> _dataTemplates = new Dictionary<Type, DataTemplate>();
-
- public DataTemplate SelectTemplate(object item, BindableObject container)
- {
- DataTemplate dataTemplate = null;
- if (_dataTemplates.TryGetValue(item.GetType(), out dataTemplate))
- {
- return dataTemplate;
- }
-
- dataTemplate = OnSelectTemplate(item, container);
- if (dataTemplate is DataTemplateSelector)
- throw new NotSupportedException(
- "DataTemplateSelector.OnSelectTemplate must not return another DataTemplateSelector");
-
- return dataTemplate;
- }
-
- protected abstract DataTemplate OnSelectTemplate(object item, BindableObject container);
- }
-}
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Binding
-{
- [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
- internal class DependencyAttribute : Attribute
- {
- public DependencyAttribute(Type implementorType)
- {
- Implementor = implementorType;
- }
-
- internal Type Implementor { get; private set; }
- }
-}
\ No newline at end of file
+++ /dev/null
-namespace Tizen.NUI.Binding
-{
- internal enum DependencyFetchTarget
- {
- GlobalInstance,
- NewInstance
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Linq;
-using System.Reflection;
-using Tizen.NUI.Binding;
-
-namespace Tizen.NUI.Binding
-{
- internal static class DependencyResolver
- {
- static Func<Type, object[], object> Resolver { get; set; }
-
- public static void ResolveUsing(Func<Type, object[], object> resolver)
- {
- Resolver = resolver;
- }
-
- public static void ResolveUsing(Func<Type, object> resolver)
- {
- Resolver = (type, objects) => resolver.Invoke(type);
- }
-
- internal static object Resolve(Type type, params object[] args)
- {
- var result = Resolver?.Invoke(type, args);
-
- if (result != null)
- {
- if (!type.IsInstanceOfType(result))
- {
- throw new InvalidCastException("Resolved instance is not of the correct type.");
- }
- }
-
- return result;
- }
-
- internal static object ResolveOrCreate(Type type, params object[] args)
- {
- var result = Resolve(type, args);
-
- if (result != null) return result;
-
- if (args.Length > 0)
- {
- // This is by no means a general solution to matching with the correct constructor, but it'll
- // do for finding Android renderers which need Context (vs older custom renderers which may still use
- // parameterless constructors)
- if (type.GetTypeInfo().DeclaredConstructors.Any(info => info.GetParameters().Length == args.Length))
- {
- return Activator.CreateInstance(type, args);
- }
- }
-
- return Activator.CreateInstance(type);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using Tizen.NUI.Binding.Internals;
-using Tizen.NUI.Xaml;
-
-namespace Tizen.NUI.Binding
-{
- internal static class DependencyService
- {
- static bool s_initialized;
-
- static readonly List<Type> DependencyTypes = new List<Type>();
- static readonly Dictionary<Type, DependencyData> DependencyImplementations = new Dictionary<Type, DependencyData>();
-
- public static T Resolve<T>(DependencyFetchTarget fallbackFetchTarget = DependencyFetchTarget.GlobalInstance) where T : class
- {
- var result = DependencyResolver.Resolve(typeof(T)) as T;
-
- return result ?? Get<T>(fallbackFetchTarget);
- }
-
- public static T Get<T>(DependencyFetchTarget fetchTarget = DependencyFetchTarget.GlobalInstance) where T : class
- {
- Initialize();
-
- Type targetType = typeof(T);
-
- if (!DependencyImplementations.ContainsKey(targetType))
- {
- Type implementor = FindImplementor(targetType);
- DependencyImplementations[targetType] = implementor != null ? new DependencyData { ImplementorType = implementor } : null;
- }
-
- DependencyData dependencyImplementation = DependencyImplementations[targetType];
- if (dependencyImplementation == null)
- return null;
-
- if (fetchTarget == DependencyFetchTarget.GlobalInstance)
- {
- if (dependencyImplementation.GlobalInstance == null)
- {
- dependencyImplementation.GlobalInstance = Activator.CreateInstance(dependencyImplementation.ImplementorType);
- }
- return (T)dependencyImplementation.GlobalInstance;
- }
- return (T)Activator.CreateInstance(dependencyImplementation.ImplementorType);
- }
-
- public static void Register<T>() where T : class
- {
- Type type = typeof(T);
- if (!DependencyTypes.Contains(type))
- DependencyTypes.Add(type);
- }
-
- public static void Register<T, TImpl>() where T : class where TImpl : class, T
- {
- Type targetType = typeof(T);
- Type implementorType = typeof(TImpl);
- if (!DependencyTypes.Contains(targetType))
- DependencyTypes.Add(targetType);
-
- DependencyImplementations[targetType] = new DependencyData { ImplementorType = implementorType };
- }
-
- static Type FindImplementor(Type target)
- {
- return DependencyTypes.FirstOrDefault(t => target.IsAssignableFrom(t));
- }
-
- static void Initialize()
- {
- if (s_initialized)
- {
- return;
- }
-
- Assembly[] assemblies = Device.GetAssemblies();
- if (Tizen.NUI.Binding.Internals.Registrar.ExtraAssemblies != null)
- {
- assemblies = assemblies.Union(Tizen.NUI.Binding.Internals.Registrar.ExtraAssemblies).ToArray();
- }
-
- Initialize(assemblies);
- }
-
- internal static void Initialize(Assembly[] assemblies)
- {
- if (s_initialized || assemblies == null)
- {
- return;
- }
- DependencyService.Register<IValueConverterProvider, ValueConverterProvider>();
-
- Type targetAttrType = typeof(DependencyAttribute);
-
- // Don't use LINQ for performance reasons
- // Naive implementation can easily take over a second to run
- foreach (Assembly assembly in assemblies)
- {
- Attribute[] attributes;
- try
- {
- attributes = assembly.GetCustomAttributes(targetAttrType).ToArray();
- }
- catch (System.IO.FileNotFoundException)
- {
- // Sometimes the previewer doesn't actually have everything required for these loads to work
- Console.WriteLine(nameof(Registrar), "Could not load assembly: {0} for Attibute {1} | Some renderers may not be loaded", assembly.FullName, targetAttrType.FullName);
- continue;
- }
-
- if (attributes.Length == 0)
- continue;
-
- foreach (DependencyAttribute attribute in attributes)
- {
- if (!DependencyTypes.Contains(attribute.Implementor))
- {
- DependencyTypes.Add(attribute.Implementor);
- }
- }
- }
-
- s_initialized = true;
- }
-
- class DependencyData
- {
- public object GlobalInstance { get; set; }
-
- public Type ImplementorType { get; set; }
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.IO;
-using System.Reflection;
-using System.Threading;
-using System.Threading.Tasks;
-using Tizen.NUI.Binding.Internals;
-
-namespace Tizen.NUI.Binding
-{
- internal static class Device
- {
- public const string iOS = "iOS";
- public const string Android = "Android";
- public const string UWP = "UWP";
- public const string macOS = "macOS";
- public const string GTK = "GTK";
- public const string Tizen = "Tizen";
- public const string WPF = "WPF";
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static DeviceInfo info;
-
- static IPlatformServices s_platformServices;
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static void SetIdiom(TargetIdiom value) => Idiom = value;
- public static TargetIdiom Idiom { get; internal set; }
-
- //TODO: Why are there two of these? This is never used...?
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static void SetTargetIdiom(TargetIdiom value) => Idiom = value;
-
- [Obsolete("TargetPlatform is obsolete as of version 2.3.4. Please use RuntimePlatform instead.")]
-#pragma warning disable 0618
- public static TargetPlatform OS
- {
- get
- {
- TargetPlatform platform;
- if (Enum.TryParse(RuntimePlatform, out platform))
- return platform;
-
- // In the old TargetPlatform, there was no distinction between WinRT/UWP
- if (RuntimePlatform == UWP)
- {
- return TargetPlatform.Windows;
- }
-
- return TargetPlatform.Other;
- }
- }
-#pragma warning restore 0618
-
- public static string RuntimePlatform => PlatformServices?.RuntimePlatform;
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static DeviceInfo Info
- {
- get
- {
- // if (info == null)
- // throw new InvalidOperationException("You MUST call Tizen.NUI.Xaml.Init(); prior to using it.");
- return info;
- }
- set { info = value; }
- }
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static void SetFlowDirection(FlowDirection value) => FlowDirection = value;
- public static FlowDirection FlowDirection { get; internal set; }
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static bool IsInvokeRequired
- {
- get { return PlatformServices.IsInvokeRequired; }
- }
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static IPlatformServices PlatformServices
- {
- get
- {
- if (s_platformServices == null)
- throw new InvalidOperationException("You MUST call Tizen.NUI.Init(); prior to using it.");
- return s_platformServices;
- }
- set
- {
- s_platformServices = value;
- Console.WriteLine("Device s_platformServices : " + s_platformServices );
- }
- }
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static IReadOnlyList<string> Flags { get; private set; }
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static void SetFlags(IReadOnlyList<string> flags)
- {
- Flags = flags;
- }
-
- public static void BeginInvokeOnMainThread(Action action)
- {
- PlatformServices?.BeginInvokeOnMainThread(action);
- action();
- Console.WriteLine("Device BeginInvokeOnMainThread action called");
- }
-
- // public static double GetNamedSize(NamedSize size, Element targetElement)
- // {
- // return GetNamedSize(size, targetElement.GetType());
- // }
-
- // public static double GetNamedSize(NamedSize size, Type targetElementType)
- // {
- // return GetNamedSize(size, targetElementType, false);
- // }
-
- [Obsolete("OnPlatform is obsolete as of version 2.3.4. Please use switch(RuntimePlatform) instead.")]
- public static void OnPlatform(Action iOS = null, Action Android = null, Action WinPhone = null, Action Default = null)
- {
- switch (OS)
- {
- case TargetPlatform.iOS:
- if (iOS != null)
- iOS();
- else if (Default != null)
- Default();
- break;
- case TargetPlatform.Android:
- if (Android != null)
- Android();
- else if (Default != null)
- Default();
- break;
- case TargetPlatform.Windows:
- case TargetPlatform.WinPhone:
- if (WinPhone != null)
- WinPhone();
- else if (Default != null)
- Default();
- break;
- case TargetPlatform.Other:
- if (Default != null)
- Default();
- break;
- }
- }
-
- [Obsolete("OnPlatform<> (generic) is obsolete as of version 2.3.4. Please use switch(RuntimePlatform) instead.")]
- public static T OnPlatform<T>(T iOS, T Android, T WinPhone)
- {
- switch (OS)
- {
- case TargetPlatform.iOS:
- return iOS;
- case TargetPlatform.Android:
- return Android;
- case TargetPlatform.Windows:
- case TargetPlatform.WinPhone:
- return WinPhone;
- }
-
- return iOS;
- }
-
- public static void OpenUri(Uri uri)
- {
- // PlatformServices?.OpenUriAction(uri);
- }
-
- public static void StartTimer(TimeSpan interval, Func<bool> callback)
- {
- PlatformServices.StartTimer(interval, callback);
- }
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static Assembly[] GetAssemblies()
- {
- return PlatformServices?.GetAssemblies();
- }
-
- // [EditorBrowsable(EditorBrowsableState.Never)]
- // public static double GetNamedSize(NamedSize size, Type targetElementType, bool useOldSizes)
- // {
- // return PlatformServices.GetNamedSize(size, targetElementType, useOldSizes);
- // }
-
- internal static Task<Stream> GetStreamAsync(Uri uri, CancellationToken cancellationToken)
- {
- return PlatformServices?.GetStreamAsync(uri, cancellationToken);
- }
-
- public static class Styles
- {
- public static readonly string TitleStyleKey = "TitleStyle";
-
- public static readonly string SubtitleStyleKey = "SubtitleStyle";
-
- public static readonly string BodyStyleKey = "BodyStyle";
-
- public static readonly string ListItemTextStyleKey = "ListItemTextStyle";
-
- public static readonly string ListItemDetailTextStyleKey = "ListItemDetailTextStyle";
-
- public static readonly string CaptionStyleKey = "CaptionStyle";
-
- public static readonly Style TitleStyle = new Style(typeof(Tizen.NUI.BaseComponents.TextLabel)) { BaseResourceKey = TitleStyleKey };
-
- public static readonly Style SubtitleStyle = new Style(typeof(Tizen.NUI.BaseComponents.TextLabel)) { BaseResourceKey = SubtitleStyleKey };
-
- public static readonly Style BodyStyle = new Style(typeof(Tizen.NUI.BaseComponents.TextLabel)) { BaseResourceKey = BodyStyleKey };
-
- public static readonly Style ListItemTextStyle = new Style(typeof(Tizen.NUI.BaseComponents.TextLabel)) { BaseResourceKey = ListItemTextStyleKey };
-
- public static readonly Style ListItemDetailTextStyle = new Style(typeof(Tizen.NUI.BaseComponents.TextLabel)) { BaseResourceKey = ListItemDetailTextStyleKey };
-
- public static readonly Style CaptionStyle = new Style(typeof(Tizen.NUI.BaseComponents.TextLabel)) { BaseResourceKey = CaptionStyleKey };
- }
- }
-}
+++ /dev/null
-using System;
-using System.ComponentModel;
-using System.Runtime.CompilerServices;
-
-namespace Tizen.NUI.Binding
-{
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal abstract class DeviceInfo : INotifyPropertyChanged, IDisposable
- {
- DeviceOrientation _currentOrientation;
- bool _disposed;
-
- public DeviceOrientation CurrentOrientation
- {
- get { return _currentOrientation; }
- set
- {
- if (Equals(_currentOrientation, value))
- return;
- _currentOrientation = value;
- OnPropertyChanged();
- }
- }
-
- public virtual double DisplayRound(double value) =>
- Math.Round(value);
-
- public abstract Size PixelScreenSize { get; }
-
- public abstract Size ScaledScreenSize { get; }
-
- public abstract double ScalingFactor { get; }
-
- public void Dispose()
- {
- Dispose(true);
- }
-
- public event PropertyChangedEventHandler PropertyChanged;
-
- protected virtual void Dispose(bool disposing)
- {
- if (_disposed)
- return;
- _disposed = true;
- }
-
- protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
- => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
- }
-}
+++ /dev/null
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding
-{
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal enum DeviceOrientation
- {
- Portrait,
- Landscape,
- PortraitUp,
- PortraitDown,
- LandscapeLeft,
- LandscapeRight,
- Other
- }
-}
+++ /dev/null
-using System;
-using System.ComponentModel;
-using Tizen.NUI.Binding.Internals;
-
-namespace Tizen.NUI.Binding
-{
- /// <summary>
- /// A collection of styles and properties that can be added to an element at run time.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal abstract class Effect
- {
- internal Effect()
- {
- }
-
- /// <summary>
- /// Gets the element to which the style is attached.
- /// </summary>
- public Element Element { get; internal set; }
-
- /// <summary>
- /// Gets a value that tells whether the effect is attached to an element.
- /// </summary>
- public bool IsAttached { get; private set; }
-
- /// <summary>
- /// Gets the ID that is used to resolve this effect at runtime.
- /// </summary>
- public string ResolveId { get; internal set; }
-
- #region Statics
- /// <summary>
- /// Returns an Effect for the specified name, which is of the form ResolutionGroupName.ExportEffect.
- /// </summary>
- /// <param name="name">The name of the effect to get.</param>
- /// <returns>The uniquely identified effect.</returns>
- public static Effect Resolve(string name)
- {
- Effect result = null;
- if (Tizen.NUI.Binding.Internals.Registrar.Effects.TryGetValue(name, out Type effectType))
- {
- result = (Effect)DependencyResolver.ResolveOrCreate(effectType);
- }
-
- if (result == null)
- result = new NullEffect();
- result.ResolveId = name;
- return result;
- }
-
- #endregion
-
- /// <summary>
- /// Method that is called after the effect is attached and made valid.
- /// </summary>
- protected abstract void OnAttached();
-
- /// <summary>
- /// Method that is called after the effect is detached and invalidated.
- /// </summary>
- protected abstract void OnDetached();
-
- internal virtual void ClearEffect()
- {
- if (IsAttached)
- SendDetached();
- Element = null;
- }
-
- internal virtual void SendAttached()
- {
- if (IsAttached)
- return;
- OnAttached();
- IsAttached = true;
- }
-
- internal virtual void SendDetached()
- {
- if (!IsAttached)
- return;
- OnDetached();
- IsAttached = false;
- }
-
- internal virtual void SendOnElementPropertyChanged(PropertyChangedEventArgs args)
- {
- }
- }
-}
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Binding
-{
- [Flags]
- internal enum EffectiveFlowDirection
- {
- RightToLeft = 1 << 0,
- Explicit = 1 << 1,
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.ComponentModel;
-using Tizen.NUI.Binding;
-
-namespace Tizen.NUI.Binding
-{
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal static class EffectiveFlowDirectionExtensions
- {
- internal static EffectiveFlowDirection ToEffectiveFlowDirection(this FlowDirection self, bool isExplicit = false)
- {
- switch (self)
- {
- case FlowDirection.MatchParent:
- return default(EffectiveFlowDirection);
-
-
- case FlowDirection.LeftToRight:
- if (isExplicit)
- {
- return EffectiveFlowDirection.Explicit;
- }
- else
- {
- return default(EffectiveFlowDirection);
- }
-
- case FlowDirection.RightToLeft:
- if (isExplicit)
- {
- return EffectiveFlowDirection.RightToLeft | EffectiveFlowDirection.Explicit;
- }
- else
- {
- return EffectiveFlowDirection.RightToLeft;
- }
-
- default:
- throw new InvalidOperationException($"Cannot convert {self} to {nameof(EffectiveFlowDirection)}.");
- }
- }
-
- internal static FlowDirection ToFlowDirection(this EffectiveFlowDirection self)
- {
- if (self.IsLeftToRight())
- return FlowDirection.LeftToRight;
- else
- return FlowDirection.RightToLeft;
-
- throw new InvalidOperationException($"Cannot convert {self} to {nameof(FlowDirection)}.");
- }
-
- public static bool IsRightToLeft(this EffectiveFlowDirection self)
- {
- return (self & EffectiveFlowDirection.RightToLeft) == EffectiveFlowDirection.RightToLeft;
- }
-
- public static bool IsLeftToRight(this EffectiveFlowDirection self)
- {
- return (self & EffectiveFlowDirection.RightToLeft) != EffectiveFlowDirection.RightToLeft;
- }
-
- public static bool IsImplicit(this EffectiveFlowDirection self)
- {
- return (self & EffectiveFlowDirection.Explicit) != EffectiveFlowDirection.Explicit;
- }
-
- public static bool IsExplicit(this EffectiveFlowDirection self)
- {
- return (self & EffectiveFlowDirection.Explicit) == EffectiveFlowDirection.Explicit;
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System.Collections.ObjectModel;
-
-namespace Tizen.NUI.Binding
-{
- internal class ElementCollection<T> : ObservableWrapper<Element, T> where T : Element
- {
- public ElementCollection(ObservableCollection<Element> list) : base(list)
- {
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Binding
-{
- internal class ElementEventArgs : EventArgs
- {
- public ElementEventArgs(Element element)
- {
- if (element == null)
- throw new ArgumentNullException("element");
-
- Element = element;
- }
-
- public Element Element { get; private set; }
- }
-}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using Tizen.NUI.Binding.Internals;
-
-namespace Tizen.NUI.Binding
-{
- /// <summary>
- /// Base class for DataTemplate and ControlTemplate classes.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal class ElementTemplate : IElement, IDataTemplate
- {
- List<Action<object, ResourcesChangedEventArgs>> _changeHandlers;
- Element _parent;
- bool _canRecycle; // aka IsDeclarative
-
- internal ElementTemplate()
- {
- }
-
- internal ElementTemplate(Type type) : this()
- {
- if (type == null)
- throw new ArgumentNullException("type");
-
- _canRecycle = true;
-
- LoadTemplate = () => Activator.CreateInstance(type);
- }
-
- internal ElementTemplate(Func<object> loadTemplate) : this()
- {
- if (loadTemplate == null)
- throw new ArgumentNullException("loadTemplate");
-
- LoadTemplate = loadTemplate;
- }
-
- Func<object> LoadTemplate { get; set; }
-
-#pragma warning disable 0612
- Func<object> IDataTemplate.LoadTemplate
- {
- get { return LoadTemplate; }
- set { LoadTemplate = value; }
- }
-#pragma warning restore 0612
-
- void IElement.AddResourcesChangedListener(Action<object, ResourcesChangedEventArgs> onchanged)
- {
- _changeHandlers = _changeHandlers ?? new List<Action<object, ResourcesChangedEventArgs>>(1);
- _changeHandlers.Add(onchanged);
- }
-
- internal bool CanRecycle => _canRecycle;
- Element IElement.Parent
- {
- get { return _parent; }
- set
- {
- if (_parent == value)
- return;
- if (_parent != null)
- ((IElement)_parent).RemoveResourcesChangedListener(OnResourcesChanged);
- _parent = value;
- if (_parent != null)
- ((IElement)_parent).AddResourcesChangedListener(OnResourcesChanged);
- }
- }
-
- void IElement.RemoveResourcesChangedListener(Action<object, ResourcesChangedEventArgs> onchanged)
- {
- if (_changeHandlers == null)
- return;
- _changeHandlers.Remove(onchanged);
- }
-
- /// <summary>
- /// Used by the XAML infrastructure to load data templates and set up the content of the resulting UI.
- /// </summary>
- /// <returns></returns>
- public object CreateContent()
- {
- if (LoadTemplate == null)
- throw new InvalidOperationException("LoadTemplate should not be null");
- if (this is DataTemplateSelector)
- throw new InvalidOperationException("Cannot call CreateContent directly on a DataTemplateSelector");
-
- object item = LoadTemplate();
- SetupContent(item);
-
- return item;
- }
-
- internal virtual void SetupContent(object item)
- {
- }
-
- void OnResourcesChanged(object sender, ResourcesChangedEventArgs e)
- {
- if (_changeHandlers == null)
- return;
- foreach (Action<object, ResourcesChangedEventArgs> handler in _changeHandlers)
- handler(this, e);
- }
- }
-}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding
-{
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal static class EnumerableExtensions
- {
- public static IEnumerable<T> GetGesturesFor<T>(this IEnumerable<IGestureRecognizer> gestures, Func<T, bool> predicate = null) where T : GestureRecognizer
- {
- if (gestures == null)
- yield break;
-
- if (predicate == null)
- predicate = x => true;
-
- foreach (IGestureRecognizer item in gestures)
- {
- var gesture = item as T;
- if (gesture != null && predicate(gesture))
- {
- yield return gesture;
- }
- }
- }
-
- internal static IEnumerable<T> Append<T>(this IEnumerable<T> enumerable, T item)
- {
- foreach (T x in enumerable)
- yield return x;
-
- yield return item;
- }
-
- public static void ForEach<T>(this IEnumerable<T> enumeration, Action<T> action)
- {
- foreach (T item in enumeration)
- {
- action(item);
- }
- }
-
- public static int IndexOf<T>(this IEnumerable<T> enumerable, T item)
- {
- if (enumerable == null)
- throw new ArgumentNullException("enumerable");
-
- var i = 0;
- foreach (T element in enumerable)
- {
- if (Equals(element, item))
- return i;
-
- i++;
- }
-
- return -1;
- }
-
- public static int IndexOf<T>(this IEnumerable<T> enumerable, Func<T, bool> predicate)
- {
- var i = 0;
- foreach (T element in enumerable)
- {
- if (predicate(element))
- return i;
-
- i++;
- }
-
- return -1;
- }
-
- public static IEnumerable<T> Prepend<T>(this IEnumerable<T> enumerable, T item)
- {
- yield return item;
-
- foreach (T x in enumerable)
- yield return x;
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding
-{
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal class EventArg<T> : EventArgs
- {
- // Property variable
-
- // Constructor
- public EventArg(T data)
- {
- Data = data;
- }
-
- // Property for EventArgs argument
- public T Data { get; }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Binding
-{
- [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
- internal class ExportEffectAttribute : Attribute
- {
- public ExportEffectAttribute(Type effectType, string uniqueName)
- {
- if (uniqueName.Contains("."))
- throw new ArgumentException("uniqueName must not contain a .");
- Type = effectType;
- Id = uniqueName;
- }
-
- internal string Id { get; private set; }
-
- internal Type Type { get; private set; }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Globalization;
-using System.Linq;
-using System.Reflection;
-
-using Tizen.NUI;
-
-namespace Tizen.NUI.Binding
-{
- internal class ExtentsTypeConverter : TypeConverter
- {
- public override object ConvertFromInvariantString(string value)
- {
- if (value != null)
- {
- string[] parts = value.Split(',');
- if (parts.Length == 4)
- {
- 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));
- }
- }
-
- throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(Extents)}");
- }
- }
-}
+++ /dev/null
-using System.Threading.Tasks;
-
-namespace Tizen.NUI.Binding
-{
- [TypeConverter(typeof(FileImageSourceConverter))]
- internal sealed class FileImageSource : ImageSource
- {
- public static readonly BindableProperty FileProperty = BindableProperty.Create("File", typeof(string), typeof(FileImageSource), default(string));
-
- public string File
- {
- get { return (string)GetValue(FileProperty); }
- set { SetValue(FileProperty, value); }
- }
-
- public override Task<bool> Cancel()
- {
- return Task.FromResult(false);
- }
-
- public override string ToString()
- {
- return $"File: {File}";
- }
-
- public static implicit operator FileImageSource(string file)
- {
- return (FileImageSource)FromFile(file);
- }
-
- public static implicit operator string(FileImageSource file)
- {
- return file != null ? file.File : null;
- }
-
- protected override void OnPropertyChanged(string propertyName = null)
- {
- if (propertyName == FileProperty.PropertyName)
- OnSourceChanged();
- base.OnPropertyChanged(propertyName);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Binding
-{
- [Xaml.TypeConversion(typeof(FileImageSource))]
- internal sealed class FileImageSourceConverter : TypeConverter
- {
- public override object ConvertFromInvariantString(string value)
- {
- if (value != null)
- return (FileImageSource)ImageSource.FromFile(value);
-
- throw new InvalidOperationException(string.Format("Cannot convert \"{0}\" into {1}", value, typeof(FileImageSource)));
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Binding
-{
- [TypeConverter(typeof(FlowDirectionConverter))]
- internal enum FlowDirection
- {
- MatchParent = 0,
- LeftToRight = 1,
- RightToLeft = 2,
- }
-
- [Xaml.TypeConversion(typeof(FlowDirection))]
- internal class FlowDirectionConverter : TypeConverter
- {
- public override object ConvertFromInvariantString(string value)
- {
- if (value != null) {
- if (Enum.TryParse(value, out FlowDirection direction))
- return direction;
-
- if (value.Equals("ltr", StringComparison.OrdinalIgnoreCase))
- return FlowDirection.LeftToRight;
- if (value.Equals("rtl", StringComparison.OrdinalIgnoreCase))
- return FlowDirection.RightToLeft;
- if (value.Equals("inherit", StringComparison.OrdinalIgnoreCase))
- return FlowDirection.MatchParent;
- }
- throw new InvalidOperationException(string.Format("Cannot convert \"{0}\" into {1}", value, typeof(FlowDirection)));
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-namespace Tizen.NUI.Binding
-{
- internal class GestureRecognizer : Element, IGestureRecognizer
- {
- internal GestureRecognizer()
- {
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Binding
-{
- [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
- internal abstract class HandlerAttribute : Attribute
- {
- protected HandlerAttribute(Type handler, Type target)
- {
- TargetType = target;
- HandlerType = handler;
- }
-
- internal Type HandlerType { get; private set; }
-
- internal Type TargetType { get; private set; }
-
- public virtual bool ShouldRegister()
- {
- return true;
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-namespace Tizen.NUI.Binding
-{
- internal interface IAppIndexingProvider
- {
- IAppLinks AppLinks { get; }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-
-namespace Tizen.NUI.Binding
-{
- internal interface IAppLinkEntry
- {
- Uri AppLinkUri { get; set; }
-
- string Description { get; set; }
-
- bool IsLinkActive { get; set; }
-
- IDictionary<string, string> KeyValues { get; }
-
- ImageSource Thumbnail { get; set; }
-
- string Title { get; set; }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Binding
-{
- internal interface IAppLinks
- {
- void DeregisterLink(IAppLinkEntry appLink);
- void DeregisterLink(Uri appLinkUri);
- void RegisterLink(IAppLinkEntry appLink);
- }
-}
\ No newline at end of file
+++ /dev/null
-namespace Tizen.NUI.Binding
-{
- internal interface IApplicationController
- {
- void SetAppIndexingProvider(IAppIndexingProvider appIndexing);
- }
-}
\ No newline at end of file
+++ /dev/null
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding
-{
- /// <summary>
- /// This interface is for internal use by platform renderers.
- /// </summary>
- /// <typeparam name="T"></typeparam>
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal interface IConfigElement<out T> where T : Element
- {
- /// <summary>
- /// For internal use
- /// </summary>
- T Element { get; }
- }
-}
+++ /dev/null
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding
-{
- /// <summary>
- /// Base interface for marker classes that identify target platforms for platform specific effects.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal interface IConfigPlatform { }
-}
+++ /dev/null
-using System.Collections.Generic;
-
-namespace Tizen.NUI.Binding
-{
- internal interface IControlTemplated
- {
- // ControlTemplate ControlTemplate { get; set; }
-
- IList<Element> InternalChildren { get; }
-
- void OnControlTemplateChanged(ControlTemplate oldValue, ControlTemplate newValue);
- }
-}
+++ /dev/null
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding
-{
- /// <summary>
- /// When implemented in a renderer, registers a platform-specific effect on an element.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal interface IEffectControlProvider
- {
- /// <summary>
- /// Registers the effect with the element by establishing the parent-child relations needed for rendering on the specific platform.
- /// </summary>
- /// <param name="effect">The effect to register.</param>
- void RegisterEffect(Effect effect);
- }
-}
+++ /dev/null
-using System;
-using Tizen.NUI.Binding.Internals;
-
-namespace Tizen.NUI.Binding
-{
- internal interface IElement
- {
- Element Parent { get; set; }
-
- //Use these 2 instead of an event to avoid cloning way too much multicastdelegates on mono
- void AddResourcesChangedListener(Action<object, ResourcesChangedEventArgs> onchanged);
- void RemoveResourcesChangedListener(Action<object, ResourcesChangedEventArgs> onchanged);
- }
-}
\ No newline at end of file
+++ /dev/null
-
-namespace Tizen.NUI.Binding
-{
- internal interface IElementConfiguration<out TElement> where TElement : Element
- {
- // IPlatformElementConfiguration<T, TElement> On<T>() where T : IConfigPlatform;
- }
-}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using Tizen.NUI.Binding.Internals;
-
-namespace Tizen.NUI.Binding
-{
- internal interface IElementController
- {
- // IEffectControlProvider EffectControlProvider { get; set; }
-
- // bool EffectIsAttached(string name);
-
- // void SetValueFromRenderer(BindableProperty property, object value);
- // void SetValueFromRenderer(BindablePropertyKey propertyKey, object value);
- // ReadOnlyCollection<Element> LogicalChildren { get; }
- // IPlatform Platform { get; set; }
- // Element RealParent { get; }
- // IEnumerable<Element> Descendants();
- // event EventHandler PlatformSet;
- }
-}
+++ /dev/null
-using System;
-using System.Globalization;
-
-namespace Tizen.NUI.Binding
-{
- internal interface IExtendedTypeConverter
- {
- [Obsolete("IExtendedTypeConverter.ConvertFrom is obsolete as of version 2.2.0. Please use ConvertFromInvariantString (string, IServiceProvider) instead.")]
- object ConvertFrom(CultureInfo culture, object value, IServiceProvider serviceProvider);
-
- object ConvertFromInvariantString(string value, IServiceProvider serviceProvider);
- }
-}
\ No newline at end of file
+++ /dev/null
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding
-{
- internal interface IGestureRecognizer : INotifyPropertyChanged
- {
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.ComponentModel;
-using System.IO;
-using System.Threading.Tasks;
-
-namespace Tizen.NUI.Binding
-{
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal interface IIsolatedStorageFile
- {
- Task CreateDirectoryAsync(string path);
- Task<bool> GetDirectoryExistsAsync(string path);
- Task<bool> GetFileExistsAsync(string path);
-
- Task<DateTimeOffset> GetLastWriteTimeAsync(string path);
-
- Task<Stream> OpenFileAsync(string path, FileMode mode, FileAccess access);
- Task<Stream> OpenFileAsync(string path, FileMode mode, FileAccess access, FileShare share);
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Binding
-{
- internal interface ILayout
- {
- event EventHandler LayoutChanged;
- }
-}
\ No newline at end of file
+++ /dev/null
-using System.Collections.Generic;
-
-namespace Tizen.NUI.Binding
-{
- internal interface ILayoutController
- {
- IReadOnlyList<Element> Children { get; }
- }
-}
\ No newline at end of file
+++ /dev/null
-namespace Tizen.NUI.Binding
-{
- internal interface IMenuItemController
- {
- bool IsEnabled { get; set; }
- string IsEnabledPropertyName { get; }
-
- void Activate();
- }
-}
+++ /dev/null
-namespace Tizen.NUI.Binding
-{
-
- internal interface INativeBindingService
- {
- bool TrySetBinding(object target, string propertyName, BindingBase binding);
- bool TrySetBinding(object target, BindableProperty property, BindingBase binding);
- bool TrySetValue(object target, BindableProperty property, object value);
- }
-}
\ No newline at end of file
+++ /dev/null
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding
-{
- /// <summary>
- /// Interface abstracting platform-specific navigation.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal interface INavigation
- {
- /// <summary>
- /// Gets the modal navigation stack.
- /// </summary>
- IReadOnlyList<Page> ModalStack { get; }
-
- /// <summary>
- /// Gets the stack of pages in the navigation.
- /// </summary>
- IReadOnlyList<Page> NavigationStack { get; }
-
- /// <summary>
- /// Inserts a page in the navigation stack before an existing page in the stack.
- /// </summary>
- /// <param name="page">The page to add.</param>
- /// <param name="before">The existing page, before which page will be inserted.</param>
- void InsertPageBefore(Page page, Page before);
-
- /// <summary>
- /// Asynchronously removes the most recent Page from the navigation stack.
- /// </summary>
- /// <returns>The Page that had been at the top of the navigation stack.</returns>
- Task<Page> PopAsync();
-
- /// <summary>
- /// Asynchronously removes the most recent Page from the navigation stack, with optional animation.
- /// </summary>
- /// <param name="animated">Whether to animate the pop.</param>
- /// <returns>The Page that had been at the top of the navigation stack.</returns>
- Task<Page> PopAsync(bool animated);
-
- /// <summary>
- /// Asynchronously dismisses the most recent modally presented Page.
- /// </summary>
- /// <returns>An awaitable instance, indicating the PopModalAsync completion. The Task.Result is the Page that has been popped.</returns>
- Task<Page> PopModalAsync();
-
- /// <summary>
- /// Asynchronously dismisses the most recent modally presented Page, with optional animation.
- /// </summary>
- /// <param name="animated">Whether to animate the pop.</param>
- /// <returns>An awaitable, indicating the PopModalAsync completion. The Task.Result is the Page that has been popped.</returns>
- Task<Page> PopModalAsync(bool animated);
-
- /// <summary>
- /// Pops all but the root Page off the navigation stack.
- /// </summary>
- /// <returns>A task representing the asynchronous dismiss operation.</returns>
- Task PopToRootAsync();
-
- /// <summary>
- /// Pops all but the root Page off the navigation stack, with optional animation.
- /// </summary>
- /// <param name="animated">Whether to animate the pop.</param>
- /// <returns>A task representing the asynchronous dismiss operation.</returns>
- Task PopToRootAsync(bool animated);
-
- /// <summary>
- /// Asynchronously adds a Page to the top of the navigation stack.
- /// </summary>
- /// <param name="page">The Page to be pushed on top of the navigation stack.</param>
- /// <returns>A task that represents the asynchronous push operation.</returns>
- Task PushAsync(Page page);
-
- /// <summary>
- /// Asynchronously adds a Page to the top of the navigation stack, with optional animation.
- /// </summary>
- /// <param name="page">The page to push.</param>
- /// <param name="animated">Whether to animate the push.</param>
- /// <returns>A task that represents the asynchronous push operation.</returns>
- Task PushAsync(Page page, bool animated);
-
- /// <summary>
- /// Presents a Page modally.
- /// </summary>
- /// <param name="page">The Page to present modally.</param>
- /// <returns>An awaitable Task, indicating the PushModal completion.</returns>
- Task PushModalAsync(Page page);
-
- /// <summary>
- /// Presents a Page modally, with optional animation.
- /// </summary>
- /// <param name="page">The page to push.</param>
- /// <param name="animated">Whether to animate the push.</param>
- /// <returns>An awaitable Task, indicating the PushModal completion.</returns>
- Task PushModalAsync(Page page, bool animated);
-
- /// <summary>
- /// Removes the specified page from the navigation stack.
- /// </summary>
- /// <param name="page">The page to remove.</param>
- void RemovePage(Page page);
- }
-}
\ No newline at end of file
+++ /dev/null
-namespace Tizen.NUI.Binding
-{
- internal interface INavigationMenuController : IViewController
- {
- void SendTargetSelected(Page target);
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using Tizen.NUI.Binding.Internals;
-
-namespace Tizen.NUI.Binding
-{
- internal interface INavigationPageController
- {
- Task<Page> RemoveAsyncInner(Page page, bool animated, bool fast);
-
- Page Peek(int depth = 0);
-
- IEnumerable<Page> Pages { get; }
-
- int StackDepth { get; }
-
- Task<Page> PopAsyncInner(bool animated, bool fast = false);
-
- event EventHandler<NavigationRequestedEventArgs> InsertPageBeforeRequested;
-
- event EventHandler<NavigationRequestedEventArgs> PopRequested;
-
- event EventHandler<NavigationRequestedEventArgs> PopToRootRequested;
-
- event EventHandler<NavigationRequestedEventArgs> PushRequested;
-
- event EventHandler<NavigationRequestedEventArgs> RemovePageRequested;
- }
-}
\ No newline at end of file
+++ /dev/null
-namespace Tizen.NUI.Binding
-{
- interface IPaddingElement
- {
- //note to implementor: implement this property publicly
- // Thickness Padding { get; }
-
- //note to implementor: but implement this method explicitly
- void OnPaddingPropertyChanged(Thickness oldValue, Thickness newValue);
- Thickness PaddingDefaultValueCreator();
- }
-}
\ No newline at end of file
+++ /dev/null
-namespace Tizen.NUI.Binding
-{
- internal interface IPageContainer<out T> where T : Page
- {
- T CurrentPage { get; }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System.Collections.ObjectModel;
-
-namespace Tizen.NUI.Binding
-{
- internal interface IPageController
- {
- Rectangle ContainerArea { get; set; }
-
- bool IgnoresContainerArea { get; set; }
-
- ObservableCollection<Element> InternalChildren { get; }
-
- void SendAppearing();
-
- void SendDisappearing();
- }
-}
\ No newline at end of file
+++ /dev/null
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding
-{
- /// <summary>
- /// For internal use.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal interface IPlatform
- {
- /// <summary>
- /// Returns the native size.
- /// </summary>
- /// <param name="view">The view</param>
- /// <param name="widthConstraint">The width constraint.</param>
- /// <param name="heightConstraint">The height constraint.</param>
- /// <returns>The native size.</returns>
- SizeRequest GetNativeSize(BaseHandle view, double widthConstraint, double heightConstraint);
- }
-}
+++ /dev/null
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding
-{
- /// <summary>
- /// Marker interface for returning platform-specific configuration elements.
- /// </summary>
- /// <typeparam name="TPlatform">The platform type.</typeparam>
- /// <typeparam name="TElement">The element type.</typeparam>
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal interface IPlatformElementConfiguration<out TPlatform, out TElement> : IConfigElement<TElement>
- where TPlatform : IConfigPlatform
- where TElement : Element
- {
- }
-}
+++ /dev/null
-using System;
-using System.ComponentModel;
-using System.IO;
-using System.Reflection;
-using System.Threading;
-using System.Threading.Tasks;
-using Tizen.NUI.Binding.Internals;
-
-namespace Tizen.NUI.Binding
-{
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal interface IPlatformServices
- {
- bool IsInvokeRequired { get; }
-
- void BeginInvokeOnMainThread(Action action);
-
- Ticker CreateTicker();
-
- Assembly[] GetAssemblies();
-
- string GetMD5Hash(string input);
-
- // double GetNamedSize(NamedSize size, Type targetElementType, bool useOldSizes);
-
- Task<Stream> GetStreamAsync(Uri uri, CancellationToken cancellationToken);
-
- // IIsolatedStorageFile GetUserStoreForApplication();
-
- // void OpenUriAction(Uri uri);
-
- void StartTimer(TimeSpan interval, Func<bool> callback);
-
- string RuntimePlatform { get; }
-
- void QuitApplication();
- }
-}
+++ /dev/null
-namespace Tizen.NUI.Binding
-{
- internal interface IRegisterable
- {
- }
-}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding
-{
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal interface IResourceDictionary : IEnumerable<KeyValuePair<string, object>>
- {
- bool TryGetValue(string key, out object value);
-
- event EventHandler<ResourcesChangedEventArgs> ValuesChanged;
- }
-}
\ No newline at end of file
+++ /dev/null
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding
-{
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal interface ISystemResourcesProvider
- {
- IResourceDictionary GetSystemResources();
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Binding
-{
- //this will go once Timer is included in Pcl profiles
- internal interface ITimer
- {
- void Change(int dueTime, int period);
- void Change(long dueTime, long period);
- void Change(TimeSpan dueTime, TimeSpan period);
- void Change(uint dueTime, uint period);
- }
-}
\ No newline at end of file
+++ /dev/null
-using System.Collections.Generic;
-
-namespace Tizen.NUI.Binding
-{
- internal interface IViewContainer<T> where T : /*VisualElement*/BaseHandle
- {
- IList<T> Children { get; }
- }
-}
\ No newline at end of file
+++ /dev/null
-namespace Tizen.NUI.Binding
-{
- internal interface IViewController : IVisualElementController
- {
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using Tizen.NUI.Binding.Internals;
-
-namespace Tizen.NUI.Binding
-{
- internal interface IVisualElementController : IElementController
- {
- void NativeSizeChanged();
- void InvalidateMeasure(InvalidationTrigger trigger);
- bool Batched { get; }
- bool DisableLayout { get; set; }
- EffectiveFlowDirection EffectiveFlowDirection { get; }
- bool IsInNativeLayout { get; set; }
- bool IsNativeStateConsistent { get; set; }
- bool IsPlatformEnabled { get; set; }
- NavigationProxy NavigationProxy { get; }
- event EventHandler<EventArg</*VisualElement*/BaseHandle>> BatchCommitted;
- event EventHandler<BaseHandle.FocusRequestArgs> FocusChangeRequested;
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.IO;
-using System.Reflection;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace Tizen.NUI.Binding
-{
- [TypeConverter(typeof(ImageSourceConverter))]
- internal abstract class ImageSource : Element
- {
- readonly object _synchandle = new object();
- CancellationTokenSource _cancellationTokenSource;
-
- TaskCompletionSource<bool> _completionSource;
-
- readonly WeakEventManager _weakEventManager = new WeakEventManager();
-
- protected ImageSource()
- {
- }
-
- protected CancellationTokenSource CancellationTokenSource
- {
- get { return _cancellationTokenSource; }
- private set
- {
- if (_cancellationTokenSource == value)
- return;
- if (_cancellationTokenSource != null)
- _cancellationTokenSource.Cancel();
- _cancellationTokenSource = value;
- }
- }
-
- bool IsLoading
- {
- get { return _cancellationTokenSource != null; }
- }
-
- public virtual Task<bool> Cancel()
- {
- if (!IsLoading)
- return Task.FromResult(false);
-
- var tcs = new TaskCompletionSource<bool>();
- TaskCompletionSource<bool> original = Interlocked.CompareExchange(ref _completionSource, tcs, null);
- if (original == null)
- {
- _cancellationTokenSource.Cancel();
- }
- else
- tcs = original;
-
- return tcs.Task;
- }
-
- public static ImageSource FromFile(string file)
- {
- return new FileImageSource { File = file };
- }
-
- public static ImageSource FromResource(string resource, Type resolvingType)
- {
- return FromResource(resource, resolvingType.GetTypeInfo().Assembly);
- }
-
- public static ImageSource FromResource(string resource, Assembly sourceAssembly = null)
- {
-#if NETSTANDARD2_0
- sourceAssembly = sourceAssembly ?? Assembly.GetCallingAssembly();
-#else
- if (sourceAssembly == null)
- {
- MethodInfo callingAssemblyMethod = typeof(Assembly).GetTypeInfo().GetDeclaredMethod("GetCallingAssembly");
- if (callingAssemblyMethod != null)
- {
- sourceAssembly = (Assembly)callingAssemblyMethod.Invoke(null, new object[0]);
- }
- else
- {
- Internals.Log.Warning("Warning", "Can not find CallingAssembly, pass resolvingType to FromResource to ensure proper resolution");
- return null;
- }
- }
-#endif
- return FromStream(() => sourceAssembly.GetManifestResourceStream(resource));
- }
-
- public static ImageSource FromStream(Func<Stream> stream)
- {
- // return new StreamImageSource { Stream = token => Task.Run(stream, token) };
- return null;
- }
-
- public static ImageSource FromUri(Uri uri)
- {
- if (!uri.IsAbsoluteUri)
- throw new ArgumentException("uri is relative");
- // return new UriImageSource { Uri = uri };
- return null;
- }
-
- public static implicit operator ImageSource(string source)
- {
- Uri uri;
- return Uri.TryCreate(source, UriKind.Absolute, out uri) && uri.Scheme != "file" ? FromUri(uri) : FromFile(source);
- }
-
- public static implicit operator ImageSource(Uri uri)
- {
- if (!uri.IsAbsoluteUri)
- throw new ArgumentException("uri is relative");
- return FromUri(uri);
- }
-
- protected void OnLoadingCompleted(bool cancelled)
- {
- if (!IsLoading || _completionSource == null)
- return;
-
- TaskCompletionSource<bool> tcs = Interlocked.Exchange(ref _completionSource, null);
- if (tcs != null)
- tcs.SetResult(cancelled);
-
- lock (_synchandle)
- {
- CancellationTokenSource = null;
- }
- }
-
- protected void OnLoadingStarted()
- {
- lock (_synchandle)
- {
- CancellationTokenSource = new CancellationTokenSource();
- }
- }
-
- protected void OnSourceChanged()
- {
- _weakEventManager.HandleEvent(this, EventArgs.Empty, nameof(SourceChanged));
- }
-
- internal event EventHandler SourceChanged
- {
- add { _weakEventManager.AddEventHandler(nameof(SourceChanged), value); }
- remove { _weakEventManager.RemoveEventHandler(nameof(SourceChanged), value); }
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Binding
-{
- [Xaml.TypeConversion(typeof(ImageSource))]
- internal sealed class ImageSourceConverter : TypeConverter
- {
- public override object ConvertFromInvariantString(string value)
- {
- if (value != null)
- {
- Uri uri;
- return Uri.TryCreate(value, UriKind.Absolute, out uri) && uri.Scheme != "file" ? ImageSource.FromUri(uri) : ImageSource.FromFile(value);
- }
-
- throw new InvalidOperationException(string.Format("Cannot convert \"{0}\" into {1}", value, typeof(ImageSource)));
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-
-namespace Tizen.NUI.Binding
-{
- internal class AttachedCollection<T> : ObservableCollection<T>, ICollection<T>, IAttachedObject where T : BindableObject, IAttachedObject
- {
- readonly List<WeakReference> _associatedObjects = new List<WeakReference>();
-
- public AttachedCollection()
- {
- }
-
- public AttachedCollection(IEnumerable<T> collection) : base(collection)
- {
- }
-
- public AttachedCollection(IList<T> list) : base(list)
- {
- }
-
- public void AttachTo(BindableObject bindable)
- {
- if (bindable == null)
- throw new ArgumentNullException("bindable");
- OnAttachedTo(bindable);
- }
-
- public void DetachFrom(BindableObject bindable)
- {
- OnDetachingFrom(bindable);
- }
-
- protected override void ClearItems()
- {
- foreach (WeakReference weakbindable in _associatedObjects)
- {
- foreach (T item in this)
- {
- var bindable = weakbindable.Target as BindableObject;
- if (bindable == null)
- continue;
- item?.DetachFrom(bindable);
- }
- }
- base.ClearItems();
- }
-
- protected override void InsertItem(int index, T item)
- {
- base.InsertItem(index, item);
- foreach (WeakReference weakbindable in _associatedObjects)
- {
- var bindable = weakbindable.Target as BindableObject;
- if (bindable == null)
- continue;
- item?.AttachTo(bindable);
- }
- }
-
- protected virtual void OnAttachedTo(BindableObject bindable)
- {
- lock (_associatedObjects)
- {
- _associatedObjects.Add(new WeakReference(bindable));
- }
- foreach (T item in this)
- item?.AttachTo(bindable);
- }
-
- protected virtual void OnDetachingFrom(BindableObject bindable)
- {
- foreach (T item in this)
- item?.DetachFrom(bindable);
- lock (_associatedObjects)
- {
- for (var i = 0; i < _associatedObjects.Count; i++)
- {
- object target = _associatedObjects[i].Target;
-
- if (target == null || target == bindable)
- {
- _associatedObjects.RemoveAt(i);
- i--;
- }
- }
- }
- }
-
- protected override void RemoveItem(int index)
- {
- T item = this[index];
- foreach (WeakReference weakbindable in _associatedObjects)
- {
- var bindable = weakbindable.Target as BindableObject;
- if (bindable == null)
- continue;
- item?.DetachFrom(bindable);
- }
-
- base.RemoveItem(index);
- }
-
- protected override void SetItem(int index, T item)
- {
- T old = this[index];
- foreach (WeakReference weakbindable in _associatedObjects)
- {
- var bindable = weakbindable.Target as BindableObject;
- if (bindable == null)
- continue;
- old?.DetachFrom(bindable);
- }
-
- base.SetItem(index, item);
-
- foreach (WeakReference weakbindable in _associatedObjects)
- {
- var bindable = weakbindable.Target as BindableObject;
- if (bindable == null)
- continue;
- item?.AttachTo(bindable);
- }
- }
- }
-}
+++ /dev/null
-using System;
-using System.Reflection;
-
-namespace Tizen.NUI.Binding
-{
- internal abstract class Behavior : BindableObject, IAttachedObject
- {
- internal Behavior(Type associatedType)
- {
- if (associatedType == null)
- throw new ArgumentNullException("associatedType");
- AssociatedType = associatedType;
- }
-
- protected Type AssociatedType { get; }
-
- void IAttachedObject.AttachTo(BindableObject bindable)
- {
- if (bindable == null)
- throw new ArgumentNullException("bindable");
- if (!AssociatedType.IsInstanceOfType(bindable))
- throw new InvalidOperationException("bindable not an instance of AssociatedType");
- OnAttachedTo(bindable);
- }
-
- void IAttachedObject.DetachFrom(BindableObject bindable)
- {
- OnDetachingFrom(bindable);
- }
-
- protected virtual void OnAttachedTo(BindableObject bindable)
- {
- }
-
- protected virtual void OnDetachingFrom(BindableObject bindable)
- {
- }
- }
-
- internal abstract class Behavior<T> : Behavior where T : BindableObject
- {
- protected Behavior() : base(typeof(T))
- {
- }
-
- protected override void OnAttachedTo(BindableObject bindable)
- {
- base.OnAttachedTo(bindable);
- OnAttachedTo((T)bindable);
- }
-
- protected virtual void OnAttachedTo(T bindable)
- {
- }
-
- protected override void OnDetachingFrom(BindableObject bindable)
- {
- OnDetachingFrom((T)bindable);
- base.OnDetachingFrom(bindable);
- }
-
- protected virtual void OnDetachingFrom(T bindable)
- {
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using Tizen.NUI.Xaml;
-
-namespace Tizen.NUI.Binding
-{
- [ProvideCompiled("Tizen.NUI.Xaml.Core.XamlC.PassthroughValueProvider")]
- [AcceptEmptyServiceProvider]
- internal sealed class BindingCondition : Condition, IValueProvider
- {
- readonly BindableProperty _boundProperty;
-
- BindingBase _binding;
- object _triggerValue;
-
- public BindingCondition()
- {
- _boundProperty = BindableProperty.CreateAttached("Bound", typeof(object), typeof(BindingCondition), null, propertyChanged: OnBoundPropertyChanged);
- }
-
- public BindingBase Binding
- {
- get { return _binding; }
- set
- {
- if (_binding == value)
- return;
- if (IsSealed)
- throw new InvalidOperationException("Can not change Binding once the Condition has been applied.");
- _binding = value;
- }
- }
-
- public object Value
- {
- get { return _triggerValue; }
- set
- {
- if (_triggerValue == value)
- return;
- if (IsSealed)
- throw new InvalidOperationException("Can not change Value once the Condition has been applied.");
- _triggerValue = value;
- }
- }
-
- object IValueProvider.ProvideValue(IServiceProvider serviceProvider)
- {
- //This is no longer required
- return this;
- }
-
- internal override bool GetState(BindableObject bindable)
- {
- object newValue = bindable.GetValue(_boundProperty);
- return EqualsToValue(newValue);
- }
-
- internal override void SetUp(BindableObject bindable)
- {
- if (Binding != null)
- bindable.SetBinding(_boundProperty, Binding.Clone());
- }
-
- internal override void TearDown(BindableObject bindable)
- {
- bindable.RemoveBinding(_boundProperty);
- bindable.ClearValue(_boundProperty);
- }
-
- static IValueConverterProvider s_valueConverter = DependencyService.Get<IValueConverterProvider>();
-
- bool EqualsToValue(object other)
- {
- if ((other == Value) || (other != null && other.Equals(Value)))
- return true;
-
- object converted = null;
- if (s_valueConverter != null)
- converted = s_valueConverter.Convert(Value, other != null ? other.GetType() : typeof(object), null, null);
- else
- return false;
-
- return (other == converted) || (other != null && other.Equals(converted));
- }
-
- void OnBoundPropertyChanged(BindableObject bindable, object oldValue, object newValue)
- {
- bool oldState = EqualsToValue(oldValue);
- bool newState = EqualsToValue(newValue);
-
- if (newState == oldState)
- return;
-
- if (ConditionChanged != null)
- ConditionChanged(bindable, oldState, newState);
- }
- }
-}
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Binding
-{
- internal abstract class Condition
- {
- Action<BindableObject, bool, bool> _conditionChanged;
-
- bool _isSealed;
-
- internal Condition()
- {
- }
-
- internal Action<BindableObject, bool, bool> ConditionChanged
- {
- get { return _conditionChanged; }
- set
- {
- if (_conditionChanged == value)
- return;
- if (_conditionChanged != null)
- throw new InvalidOperationException("The same condition instance can not be reused");
- _conditionChanged = value;
- }
- }
-
- internal bool IsSealed
- {
- get { return _isSealed; }
- set
- {
- if (_isSealed == value)
- return;
- if (!value)
- throw new InvalidOperationException("What is sealed can not be unsealed.");
- _isSealed = value;
- OnSealed();
- }
- }
-
- internal abstract bool GetState(BindableObject bindable);
-
- internal virtual void OnSealed()
- {
- }
-
- internal abstract void SetUp(BindableObject bindable);
- internal abstract void TearDown(BindableObject bindable);
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using Tizen.NUI.Xaml;
-
-namespace Tizen.NUI.Binding
-{
- [ContentProperty("Setters")]
- [ProvideCompiled("Tizen.NUI.Xaml.Core.XamlC.PassthroughValueProvider")]
- [AcceptEmptyServiceProvider]
- internal sealed class DataTrigger : TriggerBase, IValueProvider
- {
- public DataTrigger([TypeConverter(typeof(TypeTypeConverter))] [Parameter("TargetType")] Type targetType) : base(new BindingCondition(), targetType)
- {
- }
-
- public BindingBase Binding
- {
- get { return ((BindingCondition)Condition).Binding; }
- set
- {
- if (((BindingCondition)Condition).Binding == value)
- return;
- if (IsSealed)
- throw new InvalidOperationException("Can not change Binding once the Trigger has been applied.");
- OnPropertyChanging();
- ((BindingCondition)Condition).Binding = value;
- OnPropertyChanged();
- }
- }
-
- public new IList<Setter> Setters
- {
- get { return base.Setters; }
- }
-
- public object Value
- {
- get { return ((BindingCondition)Condition).Value; }
- set
- {
- if (((BindingCondition)Condition).Value == value)
- return;
- if (IsSealed)
- throw new InvalidOperationException("Can not change Value once the Trigger has been applied.");
- OnPropertyChanging();
- ((BindingCondition)Condition).Value = value;
- OnPropertyChanged();
- }
- }
-
- object IValueProvider.ProvideValue(IServiceProvider serviceProvider)
- {
- //This is no longer required
- return this;
- }
- }
-}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using Tizen.NUI.Binding.Internals;
-
-namespace Tizen.NUI.Binding
-{
- [ContentProperty("Actions")]
- internal sealed class EventTrigger : TriggerBase
- {
- static readonly MethodInfo s_handlerinfo = typeof(EventTrigger).GetRuntimeMethods().Single(mi => mi.Name == "OnEventTriggered" && mi.IsPublic == false);
- readonly List<BindableObject> _associatedObjects = new List<BindableObject>();
-
- EventInfo _eventinfo;
-
- string _eventname;
- Delegate _handlerdelegate;
-
- public EventTrigger() : base(typeof(BindableObject))
- {
- Actions = new SealedList<TriggerAction>();
- }
-
- public IList<TriggerAction> Actions { get; }
-
- public string Event
- {
- get { return _eventname; }
- set
- {
- if (_eventname == value)
- return;
- if (IsSealed)
- throw new InvalidOperationException("Event cannot be changed once the Trigger has been applied");
- OnPropertyChanging();
- _eventname = value;
- OnPropertyChanged();
- }
- }
-
- internal override void OnAttachedTo(BindableObject bindable)
- {
- base.OnAttachedTo(bindable);
- if (!string.IsNullOrEmpty(Event))
- AttachHandlerTo(bindable);
- _associatedObjects.Add(bindable);
- }
-
- internal override void OnDetachingFrom(BindableObject bindable)
- {
- _associatedObjects.Remove(bindable);
- DetachHandlerFrom(bindable);
- base.OnDetachingFrom(bindable);
- }
-
- internal override void OnSeal()
- {
- base.OnSeal();
- ((SealedList<TriggerAction>)Actions).IsReadOnly = true;
- }
-
- void AttachHandlerTo(BindableObject bindable)
- {
- try
- {
- _eventinfo = bindable.GetType().GetRuntimeEvent(Event);
- _handlerdelegate = s_handlerinfo.CreateDelegate(_eventinfo?.EventHandlerType, this);
- }
- catch (Exception)
- {
- Console.WriteLine("EventTrigger", "Can not attach EventTrigger to {0}.{1}. Check if the handler exists and if the signature is right.", bindable.GetType(), Event);
- }
- if (_eventinfo != null && _handlerdelegate != null)
- _eventinfo.AddEventHandler(bindable, _handlerdelegate);
- }
-
- void DetachHandlerFrom(BindableObject bindable)
- {
- if (_eventinfo != null && _handlerdelegate != null)
- _eventinfo.RemoveEventHandler(bindable, _handlerdelegate);
- }
-
- // [Preserve]
- void OnEventTriggered(object sender, EventArgs e)
- {
- var bindable = (BindableObject)sender;
- foreach (TriggerAction action in Actions)
- action.DoInvoke(bindable);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-namespace Tizen.NUI.Binding
-{
- internal interface IAttachedObject
- {
- void AttachTo(BindableObject bindable);
- void DetachFrom(BindableObject bindable);
- }
-}
\ No newline at end of file
+++ /dev/null
-using System.Collections.Generic;
-
-namespace Tizen.NUI.Binding
-{
- internal sealed class MultiCondition : Condition
- {
- readonly BindableProperty _aggregatedStateProperty;
-
- public MultiCondition()
- {
- _aggregatedStateProperty = BindableProperty.CreateAttached("AggregatedState", typeof(bool), typeof(MultiCondition), false, propertyChanged: OnAggregatedStatePropertyChanged);
- Conditions = new TriggerBase.SealedList<Condition>();
- }
-
- public IList<Condition> Conditions { get; }
-
- internal override bool GetState(BindableObject bindable)
- {
- return (bool)bindable.GetValue(_aggregatedStateProperty);
- }
-
- internal override void OnSealed()
- {
- ((TriggerBase.SealedList<Condition>)Conditions).IsReadOnly = true;
- foreach (Condition condition in Conditions)
- condition.ConditionChanged = OnConditionChanged;
- }
-
- internal override void SetUp(BindableObject bindable)
- {
- foreach (Condition condition in Conditions)
- condition.SetUp(bindable);
- }
-
- internal override void TearDown(BindableObject bindable)
- {
- foreach (Condition condition in Conditions)
- condition.TearDown(bindable);
- }
-
- void OnAggregatedStatePropertyChanged(BindableObject bindable, object oldValue, object newValue)
- {
- if ((bool)oldValue == (bool)newValue)
- return;
-
- ConditionChanged?.Invoke(bindable, (bool)oldValue, (bool)newValue);
- }
-
- void OnConditionChanged(BindableObject bindable, bool oldValue, bool newValue)
- {
- var oldState = (bool)bindable.GetValue(_aggregatedStateProperty);
- var newState = true;
- foreach (Condition condition in Conditions)
- {
- if (!condition.GetState(bindable))
- {
- newState = false;
- break;
- }
- }
- if (newState != oldState)
- bindable.SetValue(_aggregatedStateProperty, newState);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-
-namespace Tizen.NUI.Binding
-{
- [ContentProperty("Setters")]
- internal sealed class MultiTrigger : TriggerBase
- {
- public MultiTrigger([TypeConverter(typeof(TypeTypeConverter))] [Parameter("TargetType")] Type targetType) : base(new MultiCondition(), targetType)
- {
- }
-
- public IList<Condition> Conditions
- {
- get { return ((MultiCondition)Condition).Conditions; }
- }
-
- public new IList<Setter> Setters
- {
- get { return base.Setters; }
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-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
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-
-using Tizen.NUI.Xaml;
-
-namespace Tizen.NUI.Binding
-{
- [ContentProperty("Setters")]
- [ProvideCompiled("Tizen.NUI.Xaml.Core.XamlC.PassthroughValueProvider")]
- [AcceptEmptyServiceProvider]
- internal sealed class Trigger : TriggerBase, IValueProvider
- {
- public Trigger([TypeConverter(typeof(TypeTypeConverter))] [Parameter("TargetType")] Type targetType) : base(new XamlPropertyCondition(), targetType)
- {
- }
-
- public BindableProperty Property
- {
- get { return ((XamlPropertyCondition)Condition).Property; }
- set
- {
- if (((XamlPropertyCondition)Condition).Property == value)
- return;
- if (IsSealed)
- throw new InvalidOperationException("Can not change Property once the Trigger has been applied.");
- OnPropertyChanging();
- ((XamlPropertyCondition)Condition).Property = value;
- OnPropertyChanged();
- }
- }
-
- public new IList<Setter> Setters
- {
- get { return base.Setters; }
- }
-
- public object Value
- {
- get { return ((XamlPropertyCondition)Condition).Value; }
- set
- {
- if (((XamlPropertyCondition)Condition).Value == value)
- return;
- if (IsSealed)
- throw new InvalidOperationException("Can not change Value once the Trigger has been applied.");
- OnPropertyChanging();
- ((XamlPropertyCondition)Condition).Value = value;
- OnPropertyChanged();
- }
- }
-
- object IValueProvider.ProvideValue(IServiceProvider serviceProvider)
- {
- //This is no longer required
- return this;
- }
- }
-}
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Binding
-{
- internal abstract class TriggerAction
- {
- internal TriggerAction(Type associatedType)
- {
- if (associatedType == null)
- throw new ArgumentNullException("associatedType");
- AssociatedType = associatedType;
- }
-
- protected Type AssociatedType { get; private set; }
-
- protected abstract void Invoke(object sender);
-
- internal virtual void DoInvoke(object sender)
- {
- Invoke(sender);
- }
- }
-
- internal abstract class TriggerAction<T> : TriggerAction where T : BindableObject
- {
- protected TriggerAction() : base(typeof(T))
- {
- }
-
- protected override void Invoke(object sender)
- {
- Invoke((T)sender);
- }
-
- protected abstract void Invoke(T sender);
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Reflection;
-using System.Collections;
-using System.Collections.Generic;
-
-namespace Tizen.NUI.Binding
-{
- internal abstract class TriggerBase : BindableObject, IAttachedObject
- {
- bool _isSealed;
-
- internal TriggerBase(Type targetType)
- {
- if (targetType == null)
- throw new ArgumentNullException("targetType");
- TargetType = targetType;
-
- EnterActions = new SealedList<TriggerAction>();
- ExitActions = new SealedList<TriggerAction>();
- }
-
- internal TriggerBase(Condition condition, Type targetType) : this(targetType)
- {
- Setters = new SealedList<Setter>();
- Condition = condition;
- Condition.ConditionChanged = OnConditionChanged;
- }
-
- public IList<TriggerAction> EnterActions { get; }
-
- public IList<TriggerAction> ExitActions { get; }
-
- public bool IsSealed
- {
- get { return _isSealed; }
- private set
- {
- if (_isSealed == value)
- return;
- if (!value)
- throw new InvalidOperationException("What is sealed can not be unsealed.");
- _isSealed = value;
- OnSeal();
- }
- }
-
- public Type TargetType { get; }
-
- internal Condition Condition { get; }
-
- //Setters and Condition are used by Trigger, DataTrigger and MultiTrigger
- internal IList<Setter> Setters { get; }
-
- void IAttachedObject.AttachTo(BindableObject bindable)
- {
- IsSealed = true;
-
- if (bindable == null)
- throw new ArgumentNullException("bindable");
- if (!TargetType.IsInstanceOfType(bindable))
- throw new InvalidOperationException("bindable not an instance of AssociatedType");
- OnAttachedTo(bindable);
- }
-
- void IAttachedObject.DetachFrom(BindableObject bindable)
- {
- if (bindable == null)
- throw new ArgumentNullException("bindable");
- OnDetachingFrom(bindable);
- }
-
- internal virtual void OnAttachedTo(BindableObject bindable)
- {
- if (Condition != null)
- Condition.SetUp(bindable);
- }
-
- internal virtual void OnDetachingFrom(BindableObject bindable)
- {
- if (Condition != null)
- Condition.TearDown(bindable);
- }
-
- internal virtual void OnSeal()
- {
- ((SealedList<TriggerAction>)EnterActions).IsReadOnly = true;
- ((SealedList<TriggerAction>)ExitActions).IsReadOnly = true;
- if (Setters != null)
- ((SealedList<Setter>)Setters).IsReadOnly = true;
- if (Condition != null)
- Condition.IsSealed = true;
- }
-
- void OnConditionChanged(BindableObject bindable, bool oldValue, bool newValue)
- {
- if (newValue)
- {
- foreach (TriggerAction action in EnterActions)
- action.DoInvoke(bindable);
- foreach (Setter setter in Setters)
- setter.Apply(bindable);
- }
- else
- {
- foreach (Setter setter in Setters)
- setter.UnApply(bindable);
- foreach (TriggerAction action in ExitActions)
- action.DoInvoke(bindable);
- }
- }
-
- internal class SealedList<T> : IList<T>
- {
- readonly IList<T> _actual;
-
- bool _isReadOnly;
-
- public SealedList()
- {
- _actual = new List<T>();
- }
-
- public void Add(T item)
- {
- if (IsReadOnly)
- throw new InvalidOperationException("This list is ReadOnly");
- _actual.Add(item);
- }
-
- public void Clear()
- {
- if (IsReadOnly)
- throw new InvalidOperationException("This list is ReadOnly");
- _actual.Clear();
- }
-
- public bool Contains(T item)
- {
- return _actual.Contains(item);
- }
-
- public void CopyTo(T[] array, int arrayIndex)
- {
- _actual.CopyTo(array, arrayIndex);
- }
-
- public int Count
- {
- get { return _actual.Count; }
- }
-
- public bool IsReadOnly
- {
- get { return _isReadOnly; }
- set
- {
- if (_isReadOnly == value)
- return;
- if (!value)
- throw new InvalidOperationException("Can't change this back to non readonly");
- _isReadOnly = value;
- }
- }
-
- public bool Remove(T item)
- {
- if (IsReadOnly)
- throw new InvalidOperationException("This list is ReadOnly");
- return _actual.Remove(item);
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- return ((IEnumerable)_actual).GetEnumerator();
- }
-
- public IEnumerator<T> GetEnumerator()
- {
- return _actual.GetEnumerator();
- }
-
- public int IndexOf(T item)
- {
- return _actual.IndexOf(item);
- }
-
- public void Insert(int index, T item)
- {
- if (IsReadOnly)
- throw new InvalidOperationException("This list is ReadOnly");
- _actual.Insert(index, item);
- }
-
- public T this[int index]
- {
- get { return _actual[index]; }
- set
- {
- if (IsReadOnly)
- throw new InvalidOperationException("This list is ReadOnly");
- _actual[index] = value;
- }
- }
-
- public void RemoveAt(int index)
- {
- if (IsReadOnly)
- throw new InvalidOperationException("This list is ReadOnly");
- _actual.RemoveAt(index);
- }
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.ComponentModel;
-using System.Reflection;
-using Tizen.NUI.Xaml;
-
-namespace Tizen.NUI.Binding
-{
- [ProvideCompiled("Tizen.NUI.Core.XamlC.PassthroughValueProvider")]
- [AcceptEmptyServiceProvider]
- internal sealed class XamlPropertyCondition : Condition, IValueProvider
- {
- readonly BindableProperty _stateProperty;
-
- BindableProperty _property;
- object _triggerValue;
-
- public XamlPropertyCondition()
- {
- _stateProperty = BindableProperty.CreateAttached("State", typeof(bool), typeof(XamlPropertyCondition), 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);
- _triggerValue = s_valueConverter.Convert(value, _property.ReturnType, minforetriever, null);
- }
- else
- {
- _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);
- }
- }
-}
+++ /dev/null
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding.Internals
-{
- internal class DynamicResource
- {
- public DynamicResource(string key)
- {
- Key = key;
- }
-
- public string Key { get; private set; }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding.Internals
-{
- internal interface IDataTemplate
- {
- Func<object> LoadTemplate { get; set; }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Threading.Tasks;
-
-namespace Tizen.NUI.Binding.Internals
-{
- internal interface IDeserializer
- {
- Task<IDictionary<string, object>> DeserializePropertiesAsync();
- Task SerializePropertiesAsync(IDictionary<string, object> properties);
- }
-}
\ No newline at end of file
+++ /dev/null
-using System.ComponentModel;
-using Tizen.NUI.Binding;
-
-namespace Tizen.NUI.Binding.Internals
-{
- internal interface IDynamicResourceHandler
- {
- void SetDynamicResource(BindableProperty property, string key);
- }
-}
+++ /dev/null
-using System;
-using System.ComponentModel;
-using System.Xml;
-
-namespace Tizen.NUI.Binding.Internals
-{
- internal interface INameScope
- {
- object FindByName(string name);
- void RegisterName(string name, object scopedElement);
- void UnregisterName(string name);
- [Obsolete]void RegisterName(string name, object scopedElement, IXmlLineInfo xmlLineInfo);
- }
-}
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Binding.Internals
-{
- interface INameScopeProvider
- {
- INameScope NameScope { get; }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding.Internals
-{
- [Flags]
- internal enum InvalidationTrigger
- {
- Undefined = 0,
- MeasureChanged = 1 << 0,
- HorizontalOptionsChanged = 1 << 1,
- VerticalOptionsChanged = 1 << 2,
- SizeRequestChanged = 1 << 3,
- RendererReady = 1 << 4,
- MarginChanged = 1 << 5
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Xml;
-using Tizen.NUI.Binding;
-using Tizen.NUI.Xaml;
-
-namespace Tizen.NUI.Binding.Internals
-{
- internal class NameScope : INameScope
- {
- public static readonly BindableProperty NameScopeProperty = BindableProperty.CreateAttached("NameScope", typeof(INameScope), typeof(NameScope), default(INameScope));
-
- readonly Dictionary<string, object> _names = new Dictionary<string, object>();
-
- object INameScope.FindByName(string name)
- {
- if (_names.ContainsKey(name))
- return _names[name];
- return null;
- }
-
- void INameScope.RegisterName(string name, object scopedElement)
- {
- if (_names.ContainsKey(name))
- throw new ArgumentException("An element with the same key already exists in NameScope", "name");
-
- _names[name] = scopedElement;
- }
-
- [Obsolete]
- void INameScope.RegisterName(string name, object scopedElement, IXmlLineInfo xmlLineInfo)
- {
- try
- {
- ((INameScope)this).RegisterName(name, scopedElement);
- }
- catch (ArgumentException)
- {
- throw new XamlParseException(string.Format("An element with the name \"{0}\" already exists in this NameScope", name), xmlLineInfo);
- }
- }
-
- void INameScope.UnregisterName(string name)
- {
- _names.Remove(name);
- }
-
- public static INameScope GetNameScope(BindableObject bindable)
- {
- return (INameScope)bindable.GetValue(NameScopeProperty);
- }
-
- public static void SetNameScope(BindableObject bindable, INameScope value)
- {
- bindable.SetValue(NameScopeProperty, value);
- }
- }
-}
+++ /dev/null
-using System;
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding.Internals
-{
- internal static class NumericExtensions
- {
-
- public static double Clamp(this double self, double min, double max)
- {
- return Math.Min(max, Math.Max(self, min));
- }
-
- public static float Clamp(this float self, float min, float max)
- {
- return Math.Min(max, Math.Max(self, min));
- }
-
- public static int Clamp(this int self, int min, int max)
- {
- return Math.Min(max, Math.Max(self, min));
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-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
+++ /dev/null
-using System;
-using System.IO;
-using System.Reflection;
-using Tizen.NUI.Xaml;
-
-namespace Tizen.NUI.Binding.Internals
-{
- internal static class ResourceLoader
- {
- static Func<AssemblyName, string, string> resourceProvider = (asmName, path) =>
- {
- string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
- path = resource + path;
-
- string ret = File.ReadAllText(path);
- return ret;
- };
-
- //takes a resource path, returns string content
- public static Func<AssemblyName, string, string> ResourceProvider {
- get => resourceProvider;
- internal set {
- DesignMode.IsDesignModeEnabled = true;
- resourceProvider = value;
- }
- }
-
- internal static Action<Exception> ExceptionHandler { get; set; }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Diagnostics;
-using System.Linq;
-using Tizen.NUI.Binding;
-
-namespace Tizen.NUI.Binding.Internals
-{
- internal abstract class Ticker
- {
- static Ticker s_ticker;
- readonly Stopwatch _stopwatch;
- readonly List<Tuple<int, Func<long, bool>>> _timeouts;
-
- int _count;
- bool _enabled;
-
- protected Ticker()
- {
- _count = 0;
- _timeouts = new List<Tuple<int, Func<long, bool>>>();
-
- _stopwatch = new Stopwatch();
- }
-
- public static void SetDefault(Ticker ticker) => Default = ticker;
- public static Ticker Default
- {
- internal set { s_ticker = value; }
- get { return s_ticker ?? (s_ticker = Device.PlatformServices.CreateTicker()); }
- }
-
- public virtual int Insert(Func<long, bool> timeout)
- {
- _count++;
- _timeouts.Add(new Tuple<int, Func<long, bool>>(_count, timeout));
-
- if (!_enabled)
- {
- _enabled = true;
- Enable();
- }
-
- return _count;
- }
-
- public virtual void Remove(int handle)
- {
- Device.BeginInvokeOnMainThread(() =>
- {
- _timeouts.RemoveAll(t => t.Item1 == handle);
-
- if (!_timeouts.Any())
- {
- _enabled = false;
- Disable();
- }
- });
- }
-
- protected abstract void DisableTimer();
-
- protected abstract void EnableTimer();
-
- protected void SendSignals(int timestep = -1)
- {
- long step = timestep >= 0 ? timestep : _stopwatch.ElapsedMilliseconds;
- _stopwatch.Reset();
- _stopwatch.Start();
-
- var localCopy = new List<Tuple<int, Func<long, bool>>>(_timeouts);
- foreach (Tuple<int, Func<long, bool>> timeout in localCopy)
- {
- bool remove = !timeout.Item2(step);
- if (remove)
- _timeouts.RemoveAll(t => t.Item1 == timeout.Item1);
- }
-
- if (!_timeouts.Any())
- {
- _enabled = false;
- Disable();
- }
- }
-
- void Disable()
- {
- _stopwatch.Reset();
- DisableTimer();
- }
-
- void Enable()
- {
- _stopwatch.Start();
- EnableTimer();
- }
- }
-}
+++ /dev/null
-#define DO_NOT_CHECK_FOR_BINDING_REUSE
-
-using System;
-using System.ComponentModel;
-using System.Globalization;
-using System.Collections.Generic;
-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
- internal abstract class TypedBindingBase : BindingBase
- {
- IValueConverter _converter;
- object _converterParameter;
- object _source;
- string _updateSourceEventName;
-
- public IValueConverter Converter {
- get { return _converter; }
- set {
- ThrowIfApplied();
- _converter = value;
- }
- }
-
- public object ConverterParameter {
- get { return _converterParameter; }
- set {
- ThrowIfApplied();
- _converterParameter = value;
- }
- }
-
- public object Source {
- get { return _source; }
- set {
- ThrowIfApplied();
- _source = value;
- }
- }
-
- internal string UpdateSourceEventName {
- get { return _updateSourceEventName; }
- set {
- ThrowIfApplied();
- _updateSourceEventName = value;
- }
- }
-
- internal TypedBindingBase()
- {
- }
- }
-
- internal sealed class TypedBinding<TSource, TProperty> : TypedBindingBase
- {
- readonly Func<TSource, TProperty> _getter;
- readonly Action<TSource, TProperty> _setter;
- readonly PropertyChangedProxy [] _handlers;
-
- public TypedBinding(Func<TSource, TProperty> getter, Action<TSource, TProperty> setter, Tuple<Func<TSource, object>, string> [] handlers)
- {
- if (getter == null)
- throw new ArgumentNullException(nameof(getter));
-
- _getter = getter;
- _setter = setter;
-
- if (handlers == null)
- return;
-
- _handlers = new PropertyChangedProxy [handlers.Length];
- for (var i = 0; i < handlers.Length; i++)
- _handlers [i] = new PropertyChangedProxy(handlers [i].Item1, handlers [i].Item2, this);
- }
-
- readonly WeakReference<object> _weakSource = new WeakReference<object>(null);
- readonly WeakReference<BindableObject> _weakTarget = new WeakReference<BindableObject>(null);
- BindableProperty _targetProperty;
-
- // Applies the binding to a previously set source and target.
- internal override void Apply(bool fromTarget = false)
- {
- base.Apply(fromTarget);
-
- BindableObject target;
-#if DO_NOT_CHECK_FOR_BINDING_REUSE
- if (!_weakTarget.TryGetTarget(out target))
- throw new InvalidOperationException();
-#else
- if (!_weakTarget.TryGetTarget(out target) || target == null) {
- Unapply();
- return;
- }
-#endif
- object source;
- if (_weakSource.TryGetTarget(out source) && source != null)
- ApplyCore(source, target, _targetProperty, fromTarget);
- }
-
- // Applies the binding to a new source or target.
- internal override void Apply(object context, BindableObject bindObj, BindableProperty targetProperty, bool fromBindingContextChanged = false)
- {
- _targetProperty = targetProperty;
- var source = Source ?? Context ?? context;
- var isApplied = IsApplied;
-
- if (Source != null && isApplied && fromBindingContextChanged)
- return;
-
- base.Apply(source, bindObj, targetProperty, fromBindingContextChanged);
-
-#if (!DO_NOT_CHECK_FOR_BINDING_REUSE)
- BindableObject prevTarget;
- if (_weakTarget.TryGetTarget(out prevTarget) && !ReferenceEquals(prevTarget, bindObj))
- throw new InvalidOperationException("Binding instances can not be reused");
-
- object previousSource;
- if (_weakSource.TryGetTarget(out previousSource) && !ReferenceEquals(previousSource, source))
- throw new InvalidOperationException("Binding instances can not be reused");
-#endif
- _weakSource.SetTarget(source);
- _weakTarget.SetTarget(bindObj);
-
- ApplyCore(source, bindObj, targetProperty);
- }
-
- internal override BindingBase Clone()
- {
- Tuple<Func<TSource, object>, string> [] handlers = _handlers == null ? null : new Tuple<Func<TSource, object>, string> [_handlers.Length];
- if (handlers != null) {
- for (var i = 0; i < _handlers.Length; i++)
- handlers [i] = new Tuple<Func<TSource, object>, string>(_handlers [i].PartGetter, _handlers [i].PropertyName);
- }
- return new TypedBinding<TSource, TProperty>(_getter, _setter, handlers) {
- Mode = Mode,
- Converter = Converter,
- ConverterParameter = ConverterParameter,
- StringFormat = StringFormat,
- Source = Source,
- UpdateSourceEventName = UpdateSourceEventName,
- };
- }
-
- internal override object GetSourceValue(object value, Type targetPropertyType)
- {
- if (Converter != null)
- value = Converter.Convert(value, targetPropertyType, ConverterParameter, CultureInfo.CurrentUICulture);
-
- //return base.GetSourceValue(value, targetPropertyType);
- if (StringFormat != null)
- return string.Format(StringFormat, value);
-
- return value;
- }
-
- internal override object GetTargetValue(object value, Type sourcePropertyType)
- {
- if (Converter != null)
- value = Converter.ConvertBack(value, sourcePropertyType, ConverterParameter, CultureInfo.CurrentUICulture);
-
- //return base.GetTargetValue(value, sourcePropertyType);
- return value;
- }
-
- internal override void Unapply(bool fromBindingContextChanged = false)
- {
- if (Source != null && fromBindingContextChanged && IsApplied)
- return;
-
-#if (!DO_NOT_CHECK_FOR_BINDING_REUSE)
- base.Unapply(fromBindingContextChanged:fromBindingContextChanged);
-#endif
- if (_handlers != null)
- Unsubscribe();
-
-#if (!DO_NOT_CHECK_FOR_BINDING_REUSE)
- _weakSource.SetTarget(null);
- _weakTarget.SetTarget(null);
-#endif
- }
-
- // ApplyCore is as slim as it should be:
- // Setting 100000 values : 17ms.
- // ApplyCore 100000 (w/o INPC, w/o unnapply) : 20ms.
- internal void ApplyCore(object sourceObject, BindableObject target, BindableProperty property, bool fromTarget = false)
- {
- var isTSource = sourceObject != null && sourceObject is TSource;
- var mode = this.GetRealizedMode(property);
- if ((mode == BindingMode.OneWay || mode == BindingMode.OneTime) && fromTarget)
- return;
-
- var needsGetter = (mode == BindingMode.TwoWay && !fromTarget) || mode == BindingMode.OneWay || mode == BindingMode.OneTime;
-
- if (isTSource && (mode == BindingMode.OneWay || mode == BindingMode.TwoWay) && _handlers != null)
- Subscribe((TSource)sourceObject);
-
- if (needsGetter) {
- var value = property.DefaultValue;
- if (isTSource) {
- try {
- value = GetSourceValue(_getter((TSource)sourceObject), property.ReturnType);
- } catch (Exception ex) when (ex is NullReferenceException || ex is KeyNotFoundException) {
- }
- }
- if (!TryConvert(ref value, property, property.ReturnType, true)) {
- // Log.Warning("Binding", "{0} can not be converted to type '{1}'", value, property.ReturnType);
- return;
- }
- target.SetValueCore(property, value, SetValueFlags.ClearDynamicResource, BindableObject.SetValuePrivateFlags.Default | BindableObject.SetValuePrivateFlags.Converted, false);
- return;
- }
-
- var needsSetter = (mode == BindingMode.TwoWay && fromTarget) || mode == BindingMode.OneWayToSource;
- if (needsSetter && _setter != null && isTSource) {
- var value = GetTargetValue(target.GetValue(property), typeof(TProperty));
- if (!TryConvert(ref value, property, typeof(TProperty), false)) {
- // Log.Warning("Binding", "{0} can not be converted to type '{1}'", value, typeof(TProperty));
- return;
- }
- _setter((TSource)sourceObject, (TProperty)value);
- }
- }
-
- static bool TryConvert(ref object value, BindableProperty targetProperty, Type convertTo, bool toTarget)
- {
- if (value == null)
- return true;
- if ((toTarget && targetProperty.TryConvert(ref value)) || (!toTarget && convertTo.IsInstanceOfType(value)))
- return true;
-
- object original = value;
- try {
- value = Convert.ChangeType(value, convertTo, CultureInfo.InvariantCulture);
- return true;
- } catch (Exception ex ) when (ex is InvalidCastException || ex is FormatException||ex is OverflowException) {
- value = original;
- return false;
- }
- }
-
- class PropertyChangedProxy
- {
- public Func<TSource, object> PartGetter { get; }
- public string PropertyName { get; }
- public BindingExpression.WeakPropertyChangedProxy Listener { get; }
- WeakReference<INotifyPropertyChanged> _weakPart = new WeakReference<INotifyPropertyChanged>(null);
- readonly BindingBase _binding;
-
- public INotifyPropertyChanged Part {
- get {
- INotifyPropertyChanged target;
- if (_weakPart.TryGetTarget(out target))
- return target;
- return null;
- }
- set {
- _weakPart.SetTarget(value);
- Listener.SubscribeTo(value, OnPropertyChanged);
- }
- }
-
- public PropertyChangedProxy(Func<TSource, object> partGetter, string propertyName, BindingBase binding)
- {
- PartGetter = partGetter;
- PropertyName = propertyName;
- _binding = binding;
- Listener = new BindingExpression.WeakPropertyChangedProxy();
- }
-
- void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
- {
- if (!string.IsNullOrEmpty(e.PropertyName) && string.CompareOrdinal(e.PropertyName, PropertyName) != 0)
- return;
- Device.BeginInvokeOnMainThread(() => _binding.Apply(false));
- }
- }
-
- void Subscribe(TSource sourceObject)
- {
- for (var i = 0; i < _handlers.Length; i++) {
- var part = _handlers [i].PartGetter(sourceObject);
- if (part == null)
- break;
- var inpc = part as INotifyPropertyChanged;
- if (inpc == null)
- continue;
- _handlers [i].Part = (inpc);
- }
- }
-
- void Unsubscribe()
- {
- for (var i = 0; i < _handlers.Length; i++)
- _handlers [i].Listener.Unsubscribe();
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Binding
-{
- internal class InvalidNavigationException : Exception
- {
- public InvalidNavigationException(string message) : base(message)
- {
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using Tizen.NUI.Binding.Internals;
-
-namespace Tizen.NUI.Binding
-{
- internal class InvalidationEventArgs : EventArgs
- {
- public InvalidationEventArgs(InvalidationTrigger trigger)
- {
- Trigger = trigger;
- }
-
- public InvalidationTrigger Trigger { get; private set; }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Collections.Specialized;
-using System.ComponentModel;
-using System.Linq;
-using Tizen.NUI.Binding.Internals;
-using Tizen.NUI.BaseComponents;
-
-namespace Tizen.NUI.Binding
-{
- [ContentProperty("Children")]
- internal abstract class Layout<T> : Layout, IViewContainer<T> where T : View
- {
- readonly ElementCollection<T> _children;
-
- protected Layout()
- {
- _children = new ElementCollection<T>(InternalChildren);
- }
-
- public new IList<T> Children
- {
- get { return _children; }
- }
-
- protected virtual void OnAdded(T view)
- {
- }
-
- protected override void OnChildAdded(Element child)
- {
- base.OnChildAdded(child);
-
- var typedChild = child as T;
- if (typedChild != null)
- OnAdded(typedChild);
- }
-
- protected override void OnChildRemoved(Element child)
- {
- base.OnChildRemoved(child);
-
- var typedChild = child as T;
- if (typedChild != null)
- OnRemoved(typedChild);
- }
-
- protected virtual void OnRemoved(T view)
- {
- }
- }
-
- internal abstract class Layout : View, ILayout, ILayoutController, IPaddingElement
- {
- public static readonly BindableProperty IsClippedToBoundsProperty = BindableProperty.Create("IsClippedToBounds", typeof(bool), typeof(Layout), false);
-
- public static readonly BindableProperty CascadeInputTransparentProperty = BindableProperty.Create(
- nameof(CascadeInputTransparent), typeof(bool), typeof(Layout), true);
-
- public static new readonly BindableProperty PaddingProperty = PaddingElement.PaddingProperty;
-
- static IList<KeyValuePair<Layout, int>> s_resolutionList = new List<KeyValuePair<Layout, int>>();
- static bool s_relayoutInProgress;
-
- bool _hasDoneLayout;
- Size _lastLayoutSize = new Size(-1, -1, 0);
-
- ReadOnlyCollection<Element> _logicalChildren;
-
- protected Layout()
- {
- //if things were added in base ctor (through implicit styles), the items added aren't properly parented
- if (InternalChildren.Count > 0)
- InternalChildrenOnCollectionChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, InternalChildren));
-
- InternalChildren.CollectionChanged += InternalChildrenOnCollectionChanged;
- }
-
- public bool IsClippedToBounds
- {
- get { return (bool)GetValue(IsClippedToBoundsProperty); }
- set { SetValue(IsClippedToBoundsProperty, value); }
- }
-
- public new Thickness Padding
- {
- get { return (Thickness)GetValue(PaddingElement.PaddingProperty); }
- set { SetValue(PaddingElement.PaddingProperty, value); }
- }
-
- public bool CascadeInputTransparent
- {
- get { return (bool)GetValue(CascadeInputTransparentProperty); }
- set { SetValue(CascadeInputTransparentProperty, value); }
- }
-
- Thickness IPaddingElement.PaddingDefaultValueCreator()
- {
- return default(Thickness);
- }
-
- void IPaddingElement.OnPaddingPropertyChanged(Thickness oldValue, Thickness newValue)
- {
- UpdateChildrenLayout();
- }
-
- internal ObservableCollection<Element> InternalChildren { get; } = new ObservableCollection<Element>();
-
- internal override ReadOnlyCollection<Element> LogicalChildrenInternal
- {
- get { return _logicalChildren ?? (_logicalChildren = new ReadOnlyCollection<Element>(InternalChildren)); }
- }
-
- /// <summary>
- /// Raised when the layout of the Page has changed.
- /// </summary>
- public event EventHandler LayoutChanged;
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public new IReadOnlyList<Element> Children
- {
- get { return InternalChildren; }
- }
-
- public void ForceLayout()
- {
- }
-
-
- public static void LayoutChildIntoBoundingRegion(BaseHandle child, Rectangle region)
- {
- var view = child as View;
- if (view == null)
- {
- return;
- }
- }
-
- public void LowerChild(View view)
- {
- if (!InternalChildren.Contains(view) || (InternalChildren.First() as BaseHandle) == view)
- return;
-
- InternalChildren.Move(InternalChildren.IndexOf(view), 0);
- }
-
- public void RaiseChild(View view)
- {
- if (!InternalChildren.Contains(view) || (InternalChildren.Last() as BaseHandle) == view)
- return;
-
- InternalChildren.Move(InternalChildren.IndexOf(view), InternalChildren.Count - 1);
- }
-
- protected virtual void InvalidateLayout()
- {
- _hasDoneLayout = false;
- if (!_hasDoneLayout)
- ForceLayout();
- }
-
- protected abstract void LayoutChildren(double x, double y, double width, double height);
-
- protected void OnChildMeasureInvalidated(object sender, EventArgs e)
- {
- InvalidationTrigger trigger = (e as InvalidationEventArgs)?.Trigger ?? InvalidationTrigger.Undefined;
- OnChildMeasureInvalidated((BaseHandle)sender, trigger);
- OnChildMeasureInvalidated();
- }
-
- protected virtual void OnChildMeasureInvalidated()
- {
- }
-
- protected virtual bool ShouldInvalidateOnChildAdded(View child)
- {
- return true;
- }
-
- protected virtual bool ShouldInvalidateOnChildRemoved(View child)
- {
- return true;
- }
-
- protected void UpdateChildrenLayout()
- {
- _hasDoneLayout = true;
-
- if (!ShouldLayoutChildren())
- return;
-
- LayoutChanged?.Invoke(this, EventArgs.Empty);
- }
-
- internal static void LayoutChildIntoBoundingRegion(View child, Rectangle region, SizeRequest childSizeRequest)
- {
- }
-
- internal virtual void OnChildMeasureInvalidated(BaseHandle child, InvalidationTrigger trigger)
- {
- ReadOnlyCollection<Element> children = LogicalChildrenInternal;
- int count = children.Count;
- for (var index = 0; index < count; index++)
- {
- var v = LogicalChildrenInternal[index] as BaseHandle;
- if (v != null)
- {
- return;
- }
- }
-
- var view = child as View;
- if (view != null)
- {
- //we can ignore the request if we are either fully constrained or when the size request changes and we were already fully constrainted
- if ((trigger == InvalidationTrigger.MeasureChanged) ||
- (trigger == InvalidationTrigger.SizeRequestChanged))
- {
- return;
- }
- }
-
- s_resolutionList.Add(new KeyValuePair<Layout, int>(this, GetElementDepth(this)));
- if (!s_relayoutInProgress)
- {
- s_relayoutInProgress = true;
- Device.BeginInvokeOnMainThread(() =>
- {
- // if thread safety mattered we would need to lock this and compareexchange above
- IList<KeyValuePair<Layout, int>> copy = s_resolutionList;
- s_resolutionList = new List<KeyValuePair<Layout, int>>();
- s_relayoutInProgress = false;
- });
- }
- }
-
- static int GetElementDepth(Element view)
- {
- var result = 0;
- while (view.Parent != null)
- {
- result++;
- view = view.Parent;
- }
- return result;
- }
-
- void InternalChildrenOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
- {
- if (e.Action == NotifyCollectionChangedAction.Move)
- {
- return;
- }
-
- if (e.OldItems != null)
- {
- foreach (object item in e.OldItems)
- {
- var v = item as View;
- if (v == null)
- continue;
-
- OnInternalRemoved(v);
- }
- }
-
- if (e.NewItems != null)
- {
- foreach (object item in e.NewItems)
- {
- var v = item as View;
- if (v == null)
- continue;
-
- if ((item as BaseHandle) == this)
- throw new InvalidOperationException("Can not add self to own child collection.");
-
- OnInternalAdded(v);
- }
- }
- }
-
- void OnInternalAdded(View view)
- {
- var parent = view.GetParent() as Layout;
- parent?.InternalChildren.Remove(view);
-
- OnChildAdded(view);
- if (ShouldInvalidateOnChildAdded(view))
- InvalidateLayout();
- }
-
- void OnInternalRemoved(View view)
- {
- OnChildRemoved(view);
- if (ShouldInvalidateOnChildRemoved(view))
- InvalidateLayout();
- }
-
- bool ShouldLayoutChildren()
- {
- if ( !LogicalChildrenInternal.Any() )
- {
- return false;
- }
-
- foreach (Element element in VisibleDescendants())
- {
- var visual = element as BaseHandle;
- if (visual == null)
- {
- continue;
- }
- }
- return true;
- }
- }
-}
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Binding
-{
- [Flags]
- internal enum LayoutAlignment
- {
- Start = 0,
- Center = 1,
- End = 2,
- Fill = 3
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Binding
-{
- [Flags]
- internal enum LayoutExpandFlag
- {
- Expand = 4
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Binding
-{
- [TypeConverter(typeof(LayoutOptionsConverter))]
- internal struct LayoutOptions
- {
- int _flags;
-
- public static readonly LayoutOptions Start = new LayoutOptions(LayoutAlignment.Start, false);
- public static readonly LayoutOptions Center = new LayoutOptions(LayoutAlignment.Center, false);
- public static readonly LayoutOptions End = new LayoutOptions(LayoutAlignment.End, false);
- public static readonly LayoutOptions Fill = new LayoutOptions(LayoutAlignment.Fill, false);
- public static readonly LayoutOptions StartAndExpand = new LayoutOptions(LayoutAlignment.Start, true);
- public static readonly LayoutOptions CenterAndExpand = new LayoutOptions(LayoutAlignment.Center, true);
- public static readonly LayoutOptions EndAndExpand = new LayoutOptions(LayoutAlignment.End, true);
- public static readonly LayoutOptions FillAndExpand = new LayoutOptions(LayoutAlignment.Fill, true);
-
- public LayoutOptions(LayoutAlignment alignment, bool expands)
- {
- var a = (int)alignment;
- if (a < 0 || a > 3)
- throw new ArgumentOutOfRangeException();
- _flags = (int)alignment | (expands ? (int)LayoutExpandFlag.Expand : 0);
- }
-
- public LayoutAlignment Alignment
- {
- get { return (LayoutAlignment)(_flags & 3); }
- set { _flags = (_flags & ~3) | (int)value; }
- }
-
- public bool Expands
- {
- get { return (_flags & (int)LayoutExpandFlag.Expand) != 0; }
- set { _flags = (_flags & 3) | (value ? (int)LayoutExpandFlag.Expand : 0); }
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Linq;
-using System.Reflection;
-using Tizen.NUI.Binding.Internals;
-
-using Tizen.NUI;
-
-namespace Tizen.NUI.Binding
-{
- [Xaml.ProvideCompiled("Tizen.NUI.Xaml.Core.XamlC.LayoutOptionsConverter")]
- [Xaml.TypeConversion(typeof(LayoutOptions))]
- internal sealed class LayoutOptionsConverter : TypeConverter
- {
- public override object ConvertFromInvariantString(string value)
- {
- if (value != null) {
- var parts = value.Split('.');
- if (parts.Length > 2 || (parts.Length == 2 && parts [0] != "LayoutOptions"))
- throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(LayoutOptions)}");
- value = parts [parts.Length - 1];
- switch (value) {
- case "Start": return LayoutOptions.Start;
- case "Center": return LayoutOptions.Center;
- case "End": return LayoutOptions.End;
- case "Fill": return LayoutOptions.Fill;
- case "StartAndExpand": return LayoutOptions.StartAndExpand;
- case "CenterAndExpand": return LayoutOptions.CenterAndExpand;
- case "EndAndExpand": return LayoutOptions.EndAndExpand;
- case "FillAndExpand": return LayoutOptions.FillAndExpand;
- }
- FieldInfo field = typeof(LayoutOptions).GetFields().FirstOrDefault(fi => fi.IsStatic && fi.Name == value);
- if (field != null)
- return (LayoutOptions)field.GetValue(null);
- }
-
- throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(LayoutOptions)}");
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace Tizen.NUI.Binding
-{
- [Xaml.ProvideCompiled("Tizen.NUI.Core.XamlC.ListStringTypeConverter")]
- [Xaml.TypeConversion(typeof(List<string>))]
- internal class ListStringTypeConverter : TypeConverter
- {
- public override object ConvertFromInvariantString(string value)
- {
- if (value == null)
- return null;
-
- return value.Split(new [] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(s => s.Trim()).ToList();
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Windows.Input;
-
-namespace Tizen.NUI.Binding
-{
-
- internal class MenuItem : BaseMenuItem, IMenuItemController
- {
- public static readonly BindableProperty AcceleratorProperty = BindableProperty.CreateAttached(nameof(Accelerator), typeof(Accelerator), typeof(MenuItem), null);
-
- public static Accelerator GetAccelerator(BindableObject bindable) => (Accelerator)bindable.GetValue(AcceleratorProperty);
-
- public static void SetAccelerator(BindableObject bindable, Accelerator value) => bindable.SetValue(AcceleratorProperty, value);
-
- public static readonly BindableProperty TextProperty = BindableProperty.Create("Text", typeof(string), typeof(MenuItem), null);
-
- public static readonly BindableProperty CommandProperty = BindableProperty.Create("Command", typeof(ICommand), typeof(MenuItem), null,
- propertyChanging: (bo, o, n) => ((MenuItem)bo).OnCommandChanging(), propertyChanged: (bo, o, n) => ((MenuItem)bo).OnCommandChanged());
-
- public static readonly BindableProperty CommandParameterProperty = BindableProperty.Create("CommandParameter", typeof(object), typeof(MenuItem), null,
- propertyChanged: (bo, o, n) => ((MenuItem)bo).OnCommandParameterChanged());
-
- public static readonly BindableProperty IsDestructiveProperty = BindableProperty.Create("IsDestructive", typeof(bool), typeof(MenuItem), false);
-
- public static readonly BindableProperty IconProperty = BindableProperty.Create("Icon", typeof(FileImageSource), typeof(MenuItem), default(FileImageSource));
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static readonly BindableProperty IsEnabledProperty = BindableProperty.Create("IsEnabled", typeof(bool), typeof(ToolbarItem), true);
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public string IsEnabledPropertyName
- {
- get
- {
- return IsEnabledProperty.PropertyName;
- }
- }
-
- public ICommand Command
- {
- get { return (ICommand)GetValue(CommandProperty); }
- set { SetValue(CommandProperty, value); }
- }
-
- public object CommandParameter
- {
- get { return GetValue(CommandParameterProperty); }
- set { SetValue(CommandParameterProperty, value); }
- }
-
- public FileImageSource Icon
- {
- get { return (FileImageSource)GetValue(IconProperty); }
- set { SetValue(IconProperty, value); }
- }
-
- public bool IsDestructive
- {
- get { return (bool)GetValue(IsDestructiveProperty); }
- set { SetValue(IsDestructiveProperty, value); }
- }
-
- public string Text
- {
- get { return (string)GetValue(TextProperty); }
- set { SetValue(TextProperty, value); }
- }
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public bool IsEnabled
- {
- get { return (bool)GetValue(IsEnabledProperty); }
- set { SetValue(IsEnabledProperty, value); }
- }
-
- bool IsEnabledCore
- {
- set { SetValueCore(IsEnabledProperty, value); }
- }
-
- public event EventHandler Clicked;
-
- protected virtual void OnClicked()
- => Clicked?.Invoke(this, EventArgs.Empty);
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public void Activate()
- {
- if (Command != null)
- {
- if (IsEnabled)
- Command.Execute(CommandParameter);
- }
-
- OnClicked();
- }
-
- void OnCommandCanExecuteChanged(object sender, EventArgs eventArgs)
- {
- IsEnabledCore = Command.CanExecute(CommandParameter);
- }
-
- void OnCommandChanged()
- {
- if (Command == null)
- {
- IsEnabledCore = true;
- return;
- }
-
- IsEnabledCore = Command.CanExecute(CommandParameter);
-
- Command.CanExecuteChanged += OnCommandCanExecuteChanged;
- }
-
- void OnCommandChanging()
- {
- if (Command == null)
- return;
-
- Command.CanExecuteChanged -= OnCommandCanExecuteChanged;
- }
-
- void OnCommandParameterChanged()
- {
- if (Command == null)
- return;
-
- IsEnabledCore = Command.CanExecute(CommandParameter);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using Tizen.NUI.StyleSheets;
-using Tizen.NUI.BaseComponents;
-
-namespace Tizen.NUI.Binding
-{
- internal sealed class MergedStyle : IStyle
- {
- ////If the base type is one of these, stop registering dynamic resources further
- ////The last one (typeof(Element)) is a safety guard as we might be creating VisualElement directly in internal code
- static readonly IList<Type> s_stopAtTypes = new List<Type> { typeof(View), typeof(Layout<>), typeof(Element) };
-
- IList<BindableProperty> _classStyleProperties;
-
- readonly List<BindableProperty> _implicitStyles = new List<BindableProperty>();
-
- IList<Style> _classStyles;
-
- IStyle _implicitStyle;
-
- IStyle _style;
-
- IList<string> _styleClass;
-
- public MergedStyle(Type targetType, BindableObject target)
- {
- Target = target;
- TargetType = targetType;
- RegisterImplicitStyles();
- Apply(Target);
- }
-
- public IStyle Style
- {
- get { return _style; }
- set { SetStyle(ImplicitStyle, ClassStyles, value); }
- }
-
- public IList<string> StyleClass
- {
- get { return _styleClass; }
- set
- {
- if (_styleClass == value)
- return;
-
- if (_styleClass != null && _classStyles != null)
- foreach (var classStyleProperty in _classStyleProperties)
- Target.RemoveDynamicResource(classStyleProperty);
-
- _styleClass = value;
-
- if (_styleClass != null) {
- _classStyleProperties = new List<BindableProperty> ();
- foreach (var styleClass in _styleClass) {
- var classStyleProperty = BindableProperty.Create ("ClassStyle", typeof(IList<Style>), typeof(View), default(IList<Style>),
- propertyChanged: (bindable, oldvalue, newvalue) => ((View)bindable)._mergedStyle.OnClassStyleChanged());
- _classStyleProperties.Add (classStyleProperty);
- Target.OnSetDynamicResource (classStyleProperty, Tizen.NUI.Binding.Style.StyleClassPrefix + styleClass);
- }
- }
- }
- }
-
- public BindableObject Target { get; }
-
- IList<Style> ClassStyles
- {
- get { return _classStyles; }
- set { SetStyle(ImplicitStyle, value, Style); }
- }
-
- IStyle ImplicitStyle
- {
- get { return _implicitStyle; }
- set { SetStyle(value, ClassStyles, Style); }
- }
-
- public void Apply(BindableObject bindable)
- {
- ImplicitStyle?.Apply(bindable);
- if (ClassStyles != null)
- foreach (var classStyle in ClassStyles)
- ((IStyle)classStyle)?.Apply(bindable);
- Style?.Apply(bindable);
- }
-
- public Type TargetType { get; }
-
- public void UnApply(BindableObject bindable)
- {
- Style?.UnApply(bindable);
- if (ClassStyles != null)
- foreach (var classStyle in ClassStyles)
- ((IStyle)classStyle)?.UnApply(bindable);
- ImplicitStyle?.UnApply(bindable);
- }
-
- void OnClassStyleChanged()
- {
- ClassStyles = _classStyleProperties.Select (p => (Target.GetValue (p) as IList<Style>)?.FirstOrDefault (s => s.CanBeAppliedTo (TargetType))).ToList ();
- }
-
- void OnImplicitStyleChanged()
- {
- var first = true;
- foreach (BindableProperty implicitStyleProperty in _implicitStyles)
- {
- var implicitStyle = (Style)Target.GetValue(implicitStyleProperty);
- if (implicitStyle != null)
- {
- if (first || implicitStyle.ApplyToDerivedTypes)
- {
- ImplicitStyle = implicitStyle;
- return;
- }
- }
- first = false;
- }
- }
-
- void RegisterImplicitStyles()
- {
- Type type = TargetType;
- while (true) {
- BindableProperty implicitStyleProperty = BindableProperty.Create("ImplicitStyle", typeof(Style), typeof(View), default(Style),
- propertyChanged: (bindable, oldvalue, newvalue) => OnImplicitStyleChanged());
- _implicitStyles.Add(implicitStyleProperty);
- Target.SetDynamicResource(implicitStyleProperty, type.FullName);
- type = type.GetTypeInfo().BaseType;
- if (s_stopAtTypes.Contains(type))
- return;
- }
- }
-
- void SetStyle(IStyle implicitStyle, IList<Style> classStyles, IStyle style)
- {
- bool shouldReApplyStyle = implicitStyle != ImplicitStyle || classStyles != ClassStyles || Style != style;
- bool shouldReApplyClassStyle = implicitStyle != ImplicitStyle || classStyles != ClassStyles;
- bool shouldReApplyImplicitStyle = implicitStyle != ImplicitStyle && (Style as Style == null || ((Style)Style).CanCascade);
-
- if (shouldReApplyStyle)
- Style?.UnApply(Target);
- if (shouldReApplyClassStyle && ClassStyles != null)
- foreach (var classStyle in ClassStyles)
- ((IStyle)classStyle)?.UnApply(Target);
- if (shouldReApplyImplicitStyle)
- ImplicitStyle?.UnApply(Target);
-
- _implicitStyle = implicitStyle;
- _classStyles = classStyles;
- _style = style;
-
- if (shouldReApplyImplicitStyle)
- ImplicitStyle?.Apply(Target);
- if (shouldReApplyClassStyle && ClassStyles != null)
- foreach (var classStyle in ClassStyles)
- ((IStyle)classStyle)?.Apply(Target);
- if (shouldReApplyStyle)
- Style?.Apply(Target);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-
-namespace Tizen.NUI.Binding
-{
- internal interface IMessagingCenter
- {
- void Send<TSender, TArgs>(TSender sender, string message, TArgs args) where TSender : class;
-
- void Send<TSender>(TSender sender, string message) where TSender : class;
-
- void Subscribe<TSender, TArgs>(object subscriber, string message, Action<TSender, TArgs> callback, TSender source = null) where TSender : class;
-
- void Subscribe<TSender>(object subscriber, string message, Action<TSender> callback, TSender source = null) where TSender : class;
-
- void Unsubscribe<TSender, TArgs>(object subscriber, string message) where TSender : class;
-
- void Unsubscribe<TSender>(object subscriber, string message) where TSender : class;
- }
-
- internal class MessagingCenter : IMessagingCenter
- {
- public static IMessagingCenter Instance { get; } = new MessagingCenter();
-
- class Sender : Tuple<string, Type, Type>
- {
- public Sender(string message, Type senderType, Type argType) : base(message, senderType, argType)
- {
- }
- }
-
- delegate bool Filter(object sender);
-
- class MaybeWeakReference
- {
- WeakReference DelegateWeakReference { get; }
- object DelegateStrongReference { get; }
-
- readonly bool _isStrongReference;
-
- public MaybeWeakReference(object subscriber, object delegateSource)
- {
- if (subscriber.Equals(delegateSource))
- {
- // The target is the subscriber; we can use a weakreference
- DelegateWeakReference = new WeakReference(delegateSource);
- _isStrongReference = false;
- }
- else
- {
- DelegateStrongReference = delegateSource;
- _isStrongReference = true;
- }
- }
-
- public object Target => _isStrongReference ? DelegateStrongReference : DelegateWeakReference.Target;
- public bool IsAlive => _isStrongReference || DelegateWeakReference.IsAlive;
- }
-
- class Subscription : Tuple<WeakReference, MaybeWeakReference, MethodInfo, Filter>
- {
- public Subscription(object subscriber, object delegateSource, MethodInfo methodInfo, Filter filter)
- : base(new WeakReference(subscriber), new MaybeWeakReference(subscriber, delegateSource), methodInfo, filter)
- {
- }
-
- public WeakReference Subscriber => Item1;
- MaybeWeakReference DelegateSource => Item2;
- MethodInfo MethodInfo => Item3;
- Filter Filter => Item4;
-
- public void InvokeCallback(object sender, object args)
- {
- if (!Filter(sender))
- {
- return;
- }
-
- if (MethodInfo.IsStatic)
- {
- MethodInfo.Invoke(null, MethodInfo.GetParameters().Length == 1 ? new[] { sender } : new[] { sender, args });
- return;
- }
-
- var target = DelegateSource.Target;
-
- if (target == null)
- {
- return; // Collected
- }
-
- MethodInfo.Invoke(target, MethodInfo.GetParameters().Length == 1 ? new[] { sender } : new[] { sender, args });
- }
-
- public bool CanBeRemoved()
- {
- return !Subscriber.IsAlive || !DelegateSource.IsAlive;
- }
- }
-
- readonly Dictionary<Sender, List<Subscription>> _subscriptions =
- new Dictionary<Sender, List<Subscription>>();
-
- public static void Send<TSender, TArgs>(TSender sender, string message, TArgs args) where TSender : class
- {
- Instance.Send(sender, message, args);
- }
-
- void IMessagingCenter.Send<TSender, TArgs>(TSender sender, string message, TArgs args)
- {
- if (sender == null)
- throw new ArgumentNullException(nameof(sender));
- InnerSend(message, typeof(TSender), typeof(TArgs), sender, args);
- }
-
- public static void Send<TSender>(TSender sender, string message) where TSender : class
- {
- Instance.Send(sender, message);
- }
-
- void IMessagingCenter.Send<TSender>(TSender sender, string message)
- {
- if (sender == null)
- throw new ArgumentNullException(nameof(sender));
- InnerSend(message, typeof(TSender), null, sender, null);
- }
-
- public static void Subscribe<TSender, TArgs>(object subscriber, string message, Action<TSender, TArgs> callback, TSender source = null) where TSender : class
- {
- Instance.Subscribe(subscriber, message, callback, source);
- }
-
- void IMessagingCenter.Subscribe<TSender, TArgs>(object subscriber, string message, Action<TSender, TArgs> callback, TSender source)
- {
- if (subscriber == null)
- throw new ArgumentNullException(nameof(subscriber));
- if (callback == null)
- throw new ArgumentNullException(nameof(callback));
-
- var target = callback.Target;
-
- Filter filter = sender =>
- {
- var send = (TSender)sender;
- return (source == null || send == source);
- };
-
- InnerSubscribe(subscriber, message, typeof(TSender), typeof(TArgs), target, callback.GetMethodInfo(), filter);
- }
-
- public static void Subscribe<TSender>(object subscriber, string message, Action<TSender> callback, TSender source = null) where TSender : class
- {
- Instance.Subscribe(subscriber, message, callback, source);
- }
-
- void IMessagingCenter.Subscribe<TSender>(object subscriber, string message, Action<TSender> callback, TSender source)
- {
- if (subscriber == null)
- throw new ArgumentNullException(nameof(subscriber));
- if (callback == null)
- throw new ArgumentNullException(nameof(callback));
-
- var target = callback.Target;
-
- Filter filter = sender =>
- {
- var send = (TSender)sender;
- return (source == null || send == source);
- };
-
- InnerSubscribe(subscriber, message, typeof(TSender), null, target, callback.GetMethodInfo(), filter);
- }
-
- public static void Unsubscribe<TSender, TArgs>(object subscriber, string message) where TSender : class
- {
- Instance.Unsubscribe<TSender, TArgs>(subscriber, message);
- }
-
- void IMessagingCenter.Unsubscribe<TSender, TArgs>(object subscriber, string message)
- {
- InnerUnsubscribe(message, typeof(TSender), typeof(TArgs), subscriber);
- }
-
- public static void Unsubscribe<TSender>(object subscriber, string message) where TSender : class
- {
- Instance.Unsubscribe<TSender>(subscriber, message);
- }
-
- void IMessagingCenter.Unsubscribe<TSender>(object subscriber, string message)
- {
- InnerUnsubscribe(message, typeof(TSender), null, subscriber);
- }
-
- void InnerSend(string message, Type senderType, Type argType, object sender, object args)
- {
- if (message == null)
- throw new ArgumentNullException(nameof(message));
- var key = new Sender(message, senderType, argType);
- if (!_subscriptions.ContainsKey(key))
- return;
- List<Subscription> subcriptions = _subscriptions[key];
- if (subcriptions == null || !subcriptions.Any())
- return; // should not be reachable
-
- // ok so this code looks a bit funky but here is the gist of the problem. It is possible that in the course
- // of executing the callbacks for this message someone will subscribe/unsubscribe from the same message in
- // the callback. This would invalidate the enumerator. To work around this we make a copy. However if you unsubscribe
- // from a message you can fairly reasonably expect that you will therefor not receive a call. To fix this we then
- // check that the item we are about to send the message to actually exists in the live list.
- List<Subscription> subscriptionsCopy = subcriptions.ToList();
- foreach (Subscription subscription in subscriptionsCopy)
- {
- if (subscription.Subscriber.Target != null && subcriptions.Contains(subscription))
- {
- subscription.InvokeCallback(sender, args);
- }
- }
- }
-
- void InnerSubscribe(object subscriber, string message, Type senderType, Type argType, object target, MethodInfo methodInfo, Filter filter)
- {
- if (message == null)
- throw new ArgumentNullException(nameof(message));
- var key = new Sender(message, senderType, argType);
- var value = new Subscription(subscriber, target, methodInfo, filter);
- if (_subscriptions.ContainsKey(key))
- {
- _subscriptions[key].Add(value);
- }
- else
- {
- var list = new List<Subscription> { value };
- _subscriptions[key] = list;
- }
- }
-
- void InnerUnsubscribe(string message, Type senderType, Type argType, object subscriber)
- {
- if (subscriber == null)
- throw new ArgumentNullException(nameof(subscriber));
- if (message == null)
- throw new ArgumentNullException(nameof(message));
-
- var key = new Sender(message, senderType, argType);
- if (!_subscriptions.ContainsKey(key))
- return;
- _subscriptions[key].RemoveAll(sub => sub.CanBeRemoved() || sub.Subscriber.Target == subscriber);
- if (!_subscriptions[key].Any())
- _subscriptions.Remove(key);
- }
-
- // This is a bit gross; it only exists to support the unit tests in PageTests
- // because the implementations of ActionSheet, Alert, and IsBusy are all very
- // tightly coupled to the MessagingCenter singleton
- internal static void ClearSubscribers()
- {
- (Instance as MessagingCenter)?._subscriptions.Clear();
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Binding
-{
- internal abstract class ModalEventArgs : EventArgs
- {
- protected ModalEventArgs(Page modal)
- {
- Modal = modal;
- }
-
- public Page Modal { get; private set; }
- }
-}
\ No newline at end of file
+++ /dev/null
-namespace Tizen.NUI.Binding
-{
- internal class ModalPoppedEventArgs : ModalEventArgs
- {
- public ModalPoppedEventArgs(Page modal) : base(modal)
- {
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-namespace Tizen.NUI.Binding
-{
- internal class ModalPoppingEventArgs : ModalEventArgs
- {
- public ModalPoppingEventArgs(Page modal) : base(modal)
- {
- }
-
- public bool Cancel { get; set; }
- }
-}
\ No newline at end of file
+++ /dev/null
-namespace Tizen.NUI.Binding
-{
- internal class ModalPushedEventArgs : ModalEventArgs
- {
- public ModalPushedEventArgs(Page modal) : base(modal)
- {
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-namespace Tizen.NUI.Binding
-{
- internal class ModalPushingEventArgs : ModalEventArgs
- {
- public ModalPushingEventArgs(Page modal) : base(modal)
- {
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using Tizen.NUI;
-using Tizen.NUI.Binding;
-using System.Collections.Generic;
-
-namespace Tizen.NUI.Binding
-{
- internal static class VisualExtension
- {
- public static Dictionary<string, int> KeyDictionary = new Dictionary<string, int>()
- {
- // Visual.Property
- { "Visual.Property.Type", Visual.Property.Type },
- { "Visual.Property.Shader", Visual.Property.Shader },
- { "Visual.Property.Transform", Visual.Property.Transform },
- { "Visual.Property.PremultipliedAlpha", Visual.Property.PremultipliedAlpha },
- { "Visual.Property.MixColor", Visual.Property.MixColor },
- { "Visual.Property.Opacity", Visual.Property.Opacity },
- // ShaderProperty
- { "Visual.ShaderProperty.VertexShader", Visual.ShaderProperty.VertexShader },
- { "Visual.ShaderProperty.FragmentShader", Visual.ShaderProperty.FragmentShader },
- { "Visual.ShaderProperty.ShaderSubdivideGridX", Visual.ShaderProperty.ShaderSubdivideGridX },
- { "Visual.ShaderProperty.ShaderSubdivideGridY", Visual.ShaderProperty.ShaderSubdivideGridY },
- { "Visual.ShaderProperty.ShaderHints", Visual.ShaderProperty.ShaderHints },
- // BorderVisualProperty
- { "BorderVisualProperty.Color", BorderVisualProperty.Color },
- { "BorderVisualProperty.Size", BorderVisualProperty.Size },
- { "BorderVisualProperty.AntiAliasing", BorderVisualProperty.AntiAliasing },
- // ColorVisualProperty
- { "ColorVisualProperty.MixColor", ColorVisualProperty.MixColor},
- // GradientVisualProperty
- { "GradientVisualProperty.StartPosition", GradientVisualProperty.StartPosition },
- { "GradientVisualProperty.EndPosition", GradientVisualProperty.EndPosition },
- { "GradientVisualProperty.Center", GradientVisualProperty.Center },
- { "GradientVisualProperty.Radius", GradientVisualProperty.Radius },
- { "GradientVisualProperty.StopOffset", GradientVisualProperty.StopOffset },
- { "GradientVisualProperty.StopColor", GradientVisualProperty.StopColor },
- { "GradientVisualProperty.Units", GradientVisualProperty.Units },
- { "GradientVisualProperty.SpreadMethod", GradientVisualProperty.SpreadMethod },
- // ImageVisualProperty
- { "ImageVisualProperty.URL", ImageVisualProperty.URL },
- { "ImageVisualProperty.AlphaMaskURL", ImageVisualProperty.AlphaMaskURL },
- { "ImageVisualProperty.FittingMode", ImageVisualProperty.FittingMode },
- { "ImageVisualProperty.SamplingMode", ImageVisualProperty.SamplingMode },
- { "ImageVisualProperty.DesiredWidth", ImageVisualProperty.DesiredWidth },
- { "ImageVisualProperty.DesiredHeight", ImageVisualProperty.DesiredHeight },
- { "ImageVisualProperty.SynchronousLoading", ImageVisualProperty.SynchronousLoading },
- { "ImageVisualProperty.BorderOnly", ImageVisualProperty.BorderOnly },
- { "ImageVisualProperty.PixelArea", ImageVisualProperty.PixelArea },
- { "ImageVisualProperty.WrapModeU", ImageVisualProperty.WrapModeU },
- { "ImageVisualProperty.WrapModeV", ImageVisualProperty.WrapModeV },
- { "ImageVisualProperty.Border", ImageVisualProperty.Border },
- { "ImageVisualProperty.MaskContentScale", ImageVisualProperty.MaskContentScale },
- { "ImageVisualProperty.CropToMask", ImageVisualProperty.CropToMask },
- { "ImageVisualProperty.BatchSize", ImageVisualProperty.BatchSize },
- { "ImageVisualProperty.CacheSize", ImageVisualProperty.CacheSize },
- { "ImageVisualProperty.FrameDelay", ImageVisualProperty.FrameDelay },
- { "ImageVisualProperty.LoopCount", ImageVisualProperty.LoopCount },
- { "ImageVisualProperty.ReleasePolicy", ImageVisualProperty.ReleasePolicy },
- { "ImageVisualProperty.LoadPolicy", ImageVisualProperty.LoadPolicy },
- { "ImageVisualProperty.OrientationCorrection", ImageVisualProperty.OrientationCorrection },
- { "ImageVisualProperty.AuxiliaryImageURL", ImageVisualProperty.AuxiliaryImageURL },
- { "ImageVisualProperty.AuxiliaryImageAlpha", ImageVisualProperty.AuxiliaryImageAlpha },
- // MeshVisualProperty
- { "MeshVisualProperty.ObjectURL", MeshVisualProperty.ObjectURL },
- { "MeshVisualProperty.MaterialtURL", MeshVisualProperty.MaterialtURL },
- { "MeshVisualProperty.TexturesPath", MeshVisualProperty.TexturesPath },
- { "MeshVisualProperty.ShadingMode", MeshVisualProperty.ShadingMode },
- { "MeshVisualProperty.UseMipmapping", MeshVisualProperty.UseMipmapping },
- { "MeshVisualProperty.UseSoftNormals", MeshVisualProperty.UseSoftNormals },
- { "MeshVisualProperty.LightPosition", MeshVisualProperty.LightPosition },
- // PrimitiveVisualProperty
- { "PrimitiveVisualProperty.Shape", PrimitiveVisualProperty.Shape },
- { "PrimitiveVisualProperty.MixColor", PrimitiveVisualProperty.MixColor },
- { "PrimitiveVisualProperty.Slices", PrimitiveVisualProperty.Slices },
- { "PrimitiveVisualProperty.Stacks", PrimitiveVisualProperty.Stacks },
- { "PrimitiveVisualProperty.ScaleTopRadius", PrimitiveVisualProperty.ScaleTopRadius },
- { "PrimitiveVisualProperty.ScaleBottomRadius", PrimitiveVisualProperty.ScaleBottomRadius },
- { "PrimitiveVisualProperty.ScaleHeight", PrimitiveVisualProperty.ScaleHeight },
- { "PrimitiveVisualProperty.ScaleRadius", PrimitiveVisualProperty.ScaleRadius },
- { "PrimitiveVisualProperty.ScaleDimensions", PrimitiveVisualProperty.ScaleDimensions },
- { "PrimitiveVisualProperty.BevelPercentage", PrimitiveVisualProperty.BevelPercentage },
- { "PrimitiveVisualProperty.BevelSmoothness", PrimitiveVisualProperty.BevelSmoothness },
- { "PrimitiveVisualProperty.LightPosition", PrimitiveVisualProperty.LightPosition },
- // TextVisualProperty
- { "TextVisualProperty.Text", TextVisualProperty.Text },
- { "TextVisualProperty.FontFamily", TextVisualProperty.FontFamily },
- { "TextVisualProperty.FontStyle", TextVisualProperty.FontStyle },
- { "TextVisualProperty.PointSize", TextVisualProperty.PointSize },
- { "TextVisualProperty.MultiLine", TextVisualProperty.MultiLine },
- { "TextVisualProperty.HorizontalAlignment", TextVisualProperty.HorizontalAlignment },
- { "TextVisualProperty.VerticalAlignment", TextVisualProperty.VerticalAlignment },
- { "TextVisualProperty.TextColor", TextVisualProperty.TextColor },
- { "TextVisualProperty.EnableMarkup", TextVisualProperty.EnableMarkup },
- // NpatchImageVisualProperty
- { "NpatchImageVisualProperty.URL", NpatchImageVisualProperty.URL },
- { "NpatchImageVisualProperty.FittingMode", NpatchImageVisualProperty.FittingMode },
- { "NpatchImageVisualProperty.SamplingMode", NpatchImageVisualProperty.SamplingMode },
- { "NpatchImageVisualProperty.DesiredWidth", NpatchImageVisualProperty.DesiredWidth },
- { "NpatchImageVisualProperty.DesiredHeight", NpatchImageVisualProperty.DesiredHeight },
- { "NpatchImageVisualProperty.SynchronousLoading", NpatchImageVisualProperty.SynchronousLoading },
- { "NpatchImageVisualProperty.BorderOnly", NpatchImageVisualProperty.BorderOnly },
- { "NpatchImageVisualProperty.PixelArea", NpatchImageVisualProperty.PixelArea },
- { "NpatchImageVisualProperty.WrapModeU", NpatchImageVisualProperty.WrapModeU },
- { "NpatchImageVisualProperty.WrapModeV", NpatchImageVisualProperty.WrapModeV },
- { "NpatchImageVisualProperty.Border", NpatchImageVisualProperty.Border },
- // HiddenInputProperty
- { "HiddenInputProperty.Mode", HiddenInputProperty.Mode },
- { "HiddenInputProperty.SubstituteCharacter", HiddenInputProperty.SubstituteCharacter },
- { "HiddenInputProperty.SubstituteCount", HiddenInputProperty.SubstituteCount },
- { "HiddenInputProperty.ShowLastCharacterDuration", HiddenInputProperty.ShowLastCharacterDuration },
- };
- }
-
- internal enum VisualTypeExtension
- {
- Border = Visual.Type.Border,
- Color = Visual.Type.Color,
- Gradient = Visual.Type.Gradient,
- Image = Visual.Type.Image,
- Mesh = Visual.Type.Mesh,
- Primitive = Visual.Type.Primitive,
- Wireframe = Visual.Type.Wireframe,
- Text = Visual.Type.Text,
- NPatch = Visual.Type.NPatch,
- SVG = Visual.Type.SVG,
- AnimatedImage = Visual.Type.AnimatedImage
- }
-
- internal enum VisualAlignTypeExtension
- {
- TopBegin = Visual.AlignType.TopBegin,
- TopCenter = Visual.AlignType.TopCenter,
- TopEnd = Visual.AlignType.TopEnd,
- CenterBegin = Visual.AlignType.CenterBegin,
- Center = Visual.AlignType.Center,
- CenterEnd = Visual.AlignType.CenterEnd,
- BottomBegin = Visual.AlignType.BottomBegin,
- BottomCenter = Visual.AlignType.BottomCenter,
- BottomEnd = Visual.AlignType.BottomEnd
- }
-}
\ No newline at end of file
+++ /dev/null
-namespace Tizen.NUI.Binding
-{
- internal enum NamedSize
- {
- Default = 0,
- Micro = 1,
- Small = 2,
- Medium = 3,
- Large = 4
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding
-{
- /// <summary>
- /// EventArgs for the NavigationPage's navigation events.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal class NavigationEventArgs : EventArgs
- {
- /// <summary>
- /// Create a NavigationEventArgs instance.
- /// </summary>
- /// <param name="page">The page that was popped or is newly visible.</param>
- public NavigationEventArgs(Page page)
- {
- if (page == null)
- throw new ArgumentNullException("page");
-
- Page = page;
- }
-
- /// <summary>
- /// Gets the page that was removed or is newly visible.
- /// </summary>
- public Page Page { get; private set; }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using Tizen.NUI;
-using Tizen.NUI.BaseComponents;
-
-namespace Tizen.NUI.Binding
-{
- // Mark as internal until renderers are ready for release after 1.0
- // [RenderWith(typeof(_NavigationMenuRenderer))]
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal class NavigationMenu : View, /*INavigationMenuController,*/ IElementConfiguration<NavigationMenu>
- {
- readonly List<Page> _targets = new List<Page>();
-
- readonly Lazy<PlatformConfigurationRegistry<NavigationMenu>> _platformConfigurationRegistry;
-
- public NavigationMenu()
- {
- _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<NavigationMenu>>(() => new PlatformConfigurationRegistry<NavigationMenu>(this));
- }
-
- public IEnumerable<Page> Targets
- {
- get { return _targets; }
- set
- {
- if (_targets.AsEnumerable().SequenceEqual(value))
- return;
-
- foreach (Page page in value)
- {
- VerifyTarget(page);
- }
-
- OnPropertyChanging();
- _targets.Clear();
- _targets.AddRange(value);
- OnPropertyChanged();
- }
- }
-
- public void Add(Page target)
- {
- if (_targets.Contains(target))
- return;
- VerifyTarget(target);
-
- OnPropertyChanging("Targets");
- _targets.Add(target);
- OnPropertyChanged("Targets");
- }
-
- public void Remove(Page target)
- {
- if (_targets.Contains(target))
- {
- OnPropertyChanging("Targets");
- if (_targets.Remove(target))
- OnPropertyChanged("Targets");
- }
- }
-
- public IPlatformElementConfiguration<T, NavigationMenu> On<T>() where T : IConfigPlatform
- {
- return _platformConfigurationRegistry.Value.On<T>();
- }
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public void SendTargetSelected(Page target)
- {
- Navigation.PushAsync(target);
- }
-
- void VerifyTarget(Page target)
- {
- if (target.Icon == null || string.IsNullOrWhiteSpace(target.Icon.File))
- throw new Exception("Icon must be set for each page before adding them to a Navigation Menu");
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-
-namespace Tizen.NUI.Binding
-{
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal class NavigationModel
- {
- readonly List<Page> _modalStack = new List<Page>();
- readonly List<List<Page>> _navTree = new List<List<Page>>();
-
- public Page CurrentPage
- {
- get
- {
- if (_navTree.Any())
- return _navTree.Last().Last();
- return null;
- }
- }
-
- public IEnumerable<Page> Modals
- {
- get { return _modalStack; }
- }
-
- public IEnumerable<Page> Roots
- {
- get
- {
- foreach (List<Page> list in _navTree)
- {
- yield return list[0];
- }
- }
- }
-
- public IReadOnlyList<IReadOnlyList<Page>> Tree
- {
- get { return _navTree; }
- }
-
- public void Clear()
- {
- _navTree.Clear();
- _modalStack.Clear();
- }
-
- public void InsertPageBefore(Page page, Page before)
- {
- List<Page> currentStack = _navTree.Last();
- int index = currentStack.IndexOf(before);
-
- if (index == -1)
- throw new ArgumentException("before must be in the current navigation context");
-
- currentStack.Insert(index, page);
- }
-
- public Page Pop(Page ancestralNav)
- {
- ancestralNav = AncestorToRoot(ancestralNav);
- foreach (List<Page> stack in _navTree)
- {
- if (stack.Contains(ancestralNav))
- {
- if (stack.Count <= 1)
- throw new InvalidNavigationException("Can not pop final item in stack");
- Page result = stack.Last();
- stack.Remove(result);
- return result;
- }
- }
-
- throw new InvalidNavigationException("Popped from unpushed item?");
- }
-
- public Page PopModal()
- {
- if (_navTree.Count <= 1)
- throw new InvalidNavigationException("Can't pop modal without any modals pushed");
- Page modal = _navTree.Last().First();
- _modalStack.Remove(modal);
- _navTree.Remove(_navTree.Last());
- return modal;
- }
-
- public Page PopTopPage()
- {
- Page itemToRemove;
- if (_navTree.Count == 1)
- {
- if (_navTree[0].Count > 1)
- {
- itemToRemove = _navTree[0].Last();
- _navTree[0].Remove(itemToRemove);
- return itemToRemove;
- }
- return null;
- }
- itemToRemove = _navTree.Last().Last();
- _navTree.Last().Remove(itemToRemove);
- if (!_navTree.Last().Any())
- {
- _navTree.RemoveAt(_navTree.Count - 1);
- }
- return itemToRemove;
- }
-
- public void PopToRoot(Page ancestralNav)
- {
- ancestralNav = AncestorToRoot(ancestralNav);
- foreach (List<Page> stack in _navTree)
- {
- if (stack.Contains(ancestralNav))
- {
- if (stack.Count <= 1)
- throw new InvalidNavigationException("Can not pop final item in stack");
- stack.RemoveRange(1, stack.Count - 1);
- return;
- }
- }
-
- throw new InvalidNavigationException("Popped from unpushed item?");
- }
-
- public void Push(Page page, Page ancestralNav)
- {
- if (ancestralNav == null)
- {
- if (_navTree.Any())
- throw new InvalidNavigationException("Ancestor must be provided for all pushes except first");
- _navTree.Add(new List<Page> { page });
- return;
- }
-
- ancestralNav = AncestorToRoot(ancestralNav);
-
- foreach (List<Page> stack in _navTree)
- {
- if (stack.Contains(ancestralNav))
- {
- stack.Add(page);
- return;
- }
- }
-
- throw new InvalidNavigationException("Invalid ancestor passed");
- }
-
- public void PushModal(Page page)
- {
- _navTree.Add(new List<Page> { page });
- _modalStack.Add(page);
- }
-
- public bool RemovePage(Page page)
- {
- bool found;
- List<Page> currentStack = _navTree.Last();
- var i = 0;
- while (!(found = currentStack.Remove(page)) && i < _navTree.Count - 1)
- {
- currentStack = _navTree[i++];
- }
-
- return found;
- }
-
- Page AncestorToRoot(Page ancestor)
- {
- Page result = ancestor;
- // while (!Application.IsApplicationOrNull(result.RealParent))
- result = (Page)result.RealParent;
- return result;
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.ComponentModel;
-using System.Linq;
-using System.Threading.Tasks;
-using Tizen.NUI.Binding.Internals;
-using Tizen.NUI.Binding;
-
-namespace Tizen.NUI
-{
- /// <summary>
- /// A Page that manages the navigation and user-experience of a stack of other pages.
- /// </summary>
- // [RenderWith(typeof(_NavigationPageRenderer))]
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal class NavigationPage : Page, IPageContainer<Page>, INavigationPageController, IElementConfiguration<NavigationPage>
- {
- /// <summary>
- /// Identifies the property associated with the title of the back button.
- /// </summary>
- public static readonly BindableProperty BackButtonTitleProperty = BindableProperty.CreateAttached("BackButtonTitle", typeof(string), typeof(Page), null);
-
- /// <summary>
- /// Backing store for the HasNavigationBar property.
- /// </summary>
- public static readonly BindableProperty HasNavigationBarProperty = BindableProperty.CreateAttached("HasNavigationBar", typeof(bool), typeof(Page), true);
-
- /// <summary>
- /// Backing store for the HasBackButton property.
- /// </summary>
- public static readonly BindableProperty HasBackButtonProperty = BindableProperty.CreateAttached("HasBackButton", typeof(bool), typeof(NavigationPage), true);
-
- /// <summary>
- /// Identifies the Tint bindable property.
- /// </summary>
- [Obsolete("TintProperty is obsolete as of version 1.2.0. Please use BarBackgroundColorProperty and BarTextColorProperty to change NavigationPage bar color properties.")]
- public static readonly BindableProperty TintProperty = BindableProperty.Create("Tint", typeof(Color), typeof(NavigationPage), /*Color.Default*/Color.Black);
-
- /// <summary>
- /// Identifies the property associated with the color of the NavigationPage's bar background color.
- /// </summary>
- public static readonly BindableProperty BarBackgroundColorProperty = BindableProperty.Create("BarBackgroundColor", typeof(Color), typeof(NavigationPage), /*Color.Default*/Color.Black);
-
- /// <summary>
- /// Identifies the property associated with the color of the NavigationPage's bar text color.
- /// </summary>
- public static readonly BindableProperty BarTextColorProperty = BindableProperty.Create("BarTextColor", typeof(Color), typeof(NavigationPage), /*Color.Default*/Color.Black);
-
- /// <summary>
- /// Indicates the NavigationPage.SetTitleIcon/NavigationPage.GetTitleIcon property.
- /// </summary>
- public static readonly BindableProperty TitleIconProperty = BindableProperty.CreateAttached("TitleIcon", typeof(FileImageSource), typeof(NavigationPage), default(FileImageSource));
-
- static readonly BindablePropertyKey CurrentPagePropertyKey = BindableProperty.CreateReadOnly("CurrentPage", typeof(Page), typeof(NavigationPage), null);
-
- /// <summary>
- /// Identifies the property associated with NavigationPage.CurrentPage
- /// </summary>
- public static readonly BindableProperty CurrentPageProperty = CurrentPagePropertyKey.BindableProperty;
-
- static readonly BindablePropertyKey RootPagePropertyKey = BindableProperty.CreateReadOnly(nameof(RootPage), typeof(Page), typeof(NavigationPage), null);
- /// <summary>
- /// Identifies the property associated with NavigationPage.RootPage
- /// </summary>
- public static readonly BindableProperty RootPageProperty = RootPagePropertyKey.BindableProperty;
-
- /// <summary>
- /// Initializes a new NavigationPage object.
- /// </summary>
- public NavigationPage()
- {
- _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<NavigationPage>>(() => new PlatformConfigurationRegistry<NavigationPage>(this));
-
- Navigation = new NavigationImpl(this);
- }
-
- /// <summary>
- /// Creates a new NavigationPage element with root as its root element.
- /// </summary>
- /// <param name="root">The root page.</param>
- public NavigationPage(Page root) : this()
- {
- PushPage(root);
- }
-
- /// <summary>
- /// Gets or sets the background color for the bar at the top of the NavigationPage.
- /// </summary>
- public Color BarBackgroundColor
- {
- get { return (Color)GetValue(BarBackgroundColorProperty); }
- set { SetValue(BarBackgroundColorProperty, value); }
- }
-
- /// <summary>
- /// Gets or sets the text that appears on the bar at the top of the NavigationPage.
- /// </summary>
- public Color BarTextColor
- {
- get { return (Color)GetValue(BarTextColorProperty); }
- set { SetValue(BarTextColorProperty, value); }
- }
-
- /// <summary>
- /// The color to be used as the Tint of the NavigationPage.
- /// </summary>
- [Obsolete("Tint is obsolete as of version 1.2.0. Please use BarBackgroundColor and BarTextColor to change NavigationPage bar color properties.")]
- public Color Tint
- {
- get { return (Color)GetValue(TintProperty); }
- set { SetValue(TintProperty, value); }
- }
-
- internal Task CurrentNavigationTask { get; set; }
-
- /// <summary>
- /// For internal use
- /// </summary>
- /// <param name="depth">The depth</param>
- /// <returns>The page instance</returns>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public Page Peek(int depth)
- {
- if (depth < 0)
- {
- return null;
- }
-
- if (InternalChildren.Count <= depth)
- {
- return null;
- }
-
- return (Page)InternalChildren[InternalChildren.Count - depth - 1];
- }
-
- /// <summary>
- /// For internal use.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public IEnumerable<Page> Pages => InternalChildren.Cast<Page>();
-
- /// <summary>
- /// For internal use
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public int StackDepth
- {
- get { return InternalChildren.Count; }
- }
-
- /// <summary>
- /// The Page that is currently top-most on the navigation stack.
- /// </summary>
- public Page CurrentPage
- {
- get { return (Page)GetValue(CurrentPageProperty); }
- private set { SetValue(CurrentPagePropertyKey, value); }
- }
-
- /// <summary>
- /// The Page that is the root of the navigation stack.
- /// </summary>
- public Page RootPage
- {
- get { return (Page)GetValue(RootPageProperty); }
- private set { SetValue(RootPagePropertyKey, value); }
- }
-
- /// <summary>
- /// 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 Tizen.NUI.Xaml.CurrentPage.</returns>
- public static string GetBackButtonTitle(BindableObject page)
- {
- return (string)page.GetValue(BackButtonTitleProperty);
- }
-
- /// <summary>
- /// Returns a value that indicates whether page has a back button.
- /// </summary>
- /// <param name="page">The page to be checked</param>
- /// <returns>true if the page has a back button.</returns>
- public static bool GetHasBackButton(Page page)
- {
- if (page == null)
- throw new ArgumentNullException("page");
- return (bool)page.GetValue(HasBackButtonProperty);
- }
-
- /// <summary>
- /// Returns a value that indicates whether the page has a navigation bar.
- /// </summary>
- /// <param name="page">The Page being queried.</param>
- /// <returns>true if page would display a navigation bar were it the CurrentPage.</returns>
- public static bool GetHasNavigationBar(BindableObject page)
- {
- return (bool)page.GetValue(HasNavigationBarProperty);
- }
-
- internal static FileImageSource GetTitleIcon(BindableObject bindable)
- {
- return (FileImageSource)bindable.GetValue(TitleIconProperty);
- }
-
- /// <summary>
- /// Asynchronously removes the top Page from the navigation stack.
- /// </summary>
- /// <returns>The Page that had been at the top of the navigation stack.</returns>
- public Task<Page> PopAsync()
- {
- return PopAsync(true);
- }
-
- /// <summary>
- /// Asynchronously removes the top Page from the navigation stack, with optional animation.
- /// </summary>
- /// <param name="animated">Whether to animate the pop.</param>
- /// <returns>The Page that had been at the top of the navigation stack.</returns>
- public async Task<Page> PopAsync(bool animated)
- {
- var tcs = new TaskCompletionSource<bool>();
- if (CurrentNavigationTask != null && !CurrentNavigationTask.IsCompleted)
- {
- var oldTask = CurrentNavigationTask;
- CurrentNavigationTask = tcs.Task;
- await oldTask;
- }
- else
- CurrentNavigationTask = tcs.Task;
-
- var result = await PopAsyncInner(animated, false);
- tcs.SetResult(true);
- return result;
- }
-
- /// <summary>
- /// Event that is raised after a page is popped from this NavigationPage element.
- /// </summary>
- public event EventHandler<NavigationEventArgs> Popped;
-
- /// <summary>
- /// Pops all but the root Page off the navigation stack.
- /// </summary>
- /// <returns>A task that represents the asynchronous dismiss operation.</returns>
- public Task PopToRootAsync()
- {
- return PopToRootAsync(true);
- }
-
- /// <summary>
- /// A task for asynchronously popping all pages off of the navigation stack.
- /// </summary>
- /// <param name="animated">Whether to animate the pop.</param>
- /// <returns>A task that represents the asynchronous dismiss operation.</returns>
- public async Task PopToRootAsync(bool animated)
- {
- if (CurrentNavigationTask != null && !CurrentNavigationTask.IsCompleted)
- {
- var tcs = new TaskCompletionSource<bool>();
- Task oldTask = CurrentNavigationTask;
- CurrentNavigationTask = tcs.Task;
- await oldTask;
-
- await PopToRootAsyncInner(animated);
- tcs.SetResult(true);
- return;
- }
-
- Task result = PopToRootAsyncInner(animated);
- CurrentNavigationTask = result;
- await result;
- }
-
- /// <summary>
- /// Presents a Page modally.
- /// </summary>
- /// <param name="page">The Page to present modally.</param>
- /// <returns>An awaitable Task, indicating the PushModal completion.</returns>
- public Task PushAsync(Page page)
- {
- return PushAsync(page, true);
- }
-
- /// <summary>
- /// A task for asynchronously pushing a page onto the navigation stack, with optional animation.
- /// </summary>
- /// <param name="page">The Page to present modally.</param>
- /// <param name="animated">Whether to animate the pop.</param>
- /// <returns>An awaitable Task, indicating the PushModal completion.</returns>
- public async Task PushAsync(Page page, bool animated)
- {
- if (CurrentNavigationTask != null && !CurrentNavigationTask.IsCompleted)
- {
- var tcs = new TaskCompletionSource<bool>();
- Task oldTask = CurrentNavigationTask;
- CurrentNavigationTask = tcs.Task;
- await oldTask;
-
- await PushAsyncInner(page, animated);
- tcs.SetResult(true);
- return;
- }
-
- CurrentNavigationTask = PushAsyncInner(page, animated);
- await CurrentNavigationTask;
- }
-
- /// <summary>
- /// Event that is raised when a page is pushed onto this NavigationPage element.
- /// </summary>
- public event EventHandler<NavigationEventArgs> Pushed;
-
- /// <summary>
- /// Sets the title that appears on the back button for page.
- /// </summary>
- /// <param name="page">The BindableObject object.</param>
- /// <param name="value">The value to set.</param>
- public static void SetBackButtonTitle(BindableObject page, string value)
- {
- page.SetValue(BackButtonTitleProperty, value);
- }
-
- /// <summary>
- /// Adds or removes a back button to page, with optional animation.
- /// </summary>
- /// <param name="page">The page object.</param>
- /// <param name="value">The value to set.</param>
- public static void SetHasBackButton(Page page, bool value)
- {
- if (page == null)
- throw new ArgumentNullException("page");
- page.SetValue(HasBackButtonProperty, value);
- }
-
- /// <summary>
- /// Sets a value that indicates whether or not this NavigationPage element has a navigation bar.
- /// </summary>
- /// <param name="page">The BindableObject object</param>
- /// <param name="value">The value to set</param>
- public static void SetHasNavigationBar(BindableObject page, bool value)
- {
- page.SetValue(HasNavigationBarProperty, value);
- }
-
- internal static void SetTitleIcon(BindableObject bindable, FileImageSource value)
- {
- bindable.SetValue(TitleIconProperty, value);
- }
-
- /// <summary>
- /// Event that is raised when the hardware back button is pressed.
- /// </summary>
- /// <returns>true if consumed</returns>
- protected override bool OnBackButtonPressed()
- {
- if (CurrentPage.SendBackButtonPressed())
- return true;
-
- if (StackDepth > 1)
- {
- SafePop();
- return true;
- }
-
- return base.OnBackButtonPressed();
- }
-
- /// <summary>
- /// For internal use
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public event EventHandler<NavigationRequestedEventArgs> InsertPageBeforeRequested;
-
- /// <summary>
- /// For internal use
- /// </summary>
- /// <param name="animated">Whether animate the pop.</param>
- /// <param name="fast"></param>
- /// <returns>A task that represents the asynchronous dismiss operation.</returns>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public async Task<Page> PopAsyncInner(bool animated, bool fast)
- {
- if (StackDepth == 1)
- {
- return null;
- }
-
- var page = (Page)InternalChildren.Last();
-
- return await (this as INavigationPageController).RemoveAsyncInner(page, animated, fast);
- }
-
- async Task<Page> INavigationPageController.RemoveAsyncInner(Page page, bool animated, bool fast)
- {
- if (StackDepth == 1)
- {
- return null;
- }
-
- var args = new NavigationRequestedEventArgs(page, animated);
-
- var removed = true;
-
- EventHandler<NavigationRequestedEventArgs> requestPop = PopRequested;
- if (requestPop != null)
- {
- requestPop(this, args);
-
- if (args.Task != null && !fast)
- removed = await args.Task;
- }
-
- if (!removed && !fast)
- return CurrentPage;
-
- InternalChildren.Remove(page);
-
- CurrentPage = (Page)InternalChildren.Last();
-
- if (Popped != null)
- Popped(this, args);
-
- return page;
- }
-
- /// <summary>
- /// For internal use.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public event EventHandler<NavigationRequestedEventArgs> PopRequested;
-
- /// <summary>
- /// For internal use.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public event EventHandler<NavigationRequestedEventArgs> PopToRootRequested;
-
- /// <summary>
- /// For internal use.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public event EventHandler<NavigationRequestedEventArgs> PushRequested;
-
- /// <summary>
- /// For internal use.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public event EventHandler<NavigationRequestedEventArgs> RemovePageRequested;
-
- void InsertPageBefore(Page page, Page before)
- {
- if (page == null)
- throw new ArgumentNullException($"{nameof(page)} cannot be null.");
-
- if (before == null)
- throw new ArgumentNullException($"{nameof(before)} cannot be null.");
-
- if (!InternalChildren.Contains(before))
- throw new ArgumentException($"{nameof(before)} must be a child of the NavigationPage", nameof(before));
-
- if (InternalChildren.Contains(page))
- throw new ArgumentException("Cannot insert page which is already in the navigation stack");
-
- EventHandler<NavigationRequestedEventArgs> handler = InsertPageBeforeRequested;
- handler?.Invoke(this, new NavigationRequestedEventArgs(page, before, false));
-
- int index = InternalChildren.IndexOf(before);
- InternalChildren.Insert(index, page);
-
- if (index == 0)
- RootPage = page;
-
- // Shouldn't be required?
- // if (Width > 0 && Height > 0)
- ForceLayout();
- }
-
- async Task PopToRootAsyncInner(bool animated)
- {
- if (StackDepth == 1)
- return;
-
- Element[] childrenToRemove = InternalChildren.Skip(1).ToArray();
- foreach (Element child in childrenToRemove)
- InternalChildren.Remove(child);
-
- CurrentPage = RootPage;
-
- var args = new NavigationRequestedEventArgs(RootPage, animated);
-
- EventHandler<NavigationRequestedEventArgs> requestPopToRoot = PopToRootRequested;
- if (requestPopToRoot != null)
- {
- requestPopToRoot(this, args);
-
- if (args.Task != null)
- await args.Task;
- }
-
- // PoppedToRoot?.Invoke(this, new PoppedToRootEventArgs(RootPage, childrenToRemove.OfType<Page>().ToList()));
- }
-
- async Task PushAsyncInner(Page page, bool animated)
- {
- if (InternalChildren.Contains(page))
- return;
-
- PushPage(page);
-
- var args = new NavigationRequestedEventArgs(page, animated);
-
- EventHandler<NavigationRequestedEventArgs> requestPush = PushRequested;
- if (requestPush != null)
- {
- requestPush(this, args);
-
- if (args.Task != null)
- await args.Task;
- }
-
- Pushed?.Invoke(this, args);
- }
-
- void PushPage(Page page)
- {
- InternalChildren.Add(page);
-
- if (InternalChildren.Count == 1)
- RootPage = page;
-
- CurrentPage = page;
- }
-
- void RemovePage(Page page)
- {
- if (page == null)
- throw new ArgumentNullException($"{nameof(page)} cannot be null.");
-
- if (page == CurrentPage && CurrentPage == RootPage)
- throw new InvalidOperationException("Cannot remove root page when it is also the currently displayed page.");
- if (page == CurrentPage)
- {
- // Log.Warning("NavigationPage", "RemovePage called for CurrentPage object. This can result in undesired behavior, consider calling PopAsync instead.");
- PopAsync();
- return;
- }
-
- if (!InternalChildren.Contains(page))
- throw new ArgumentException("Page to remove must be contained on this Navigation Page");
-
- EventHandler<NavigationRequestedEventArgs> handler = RemovePageRequested;
- handler?.Invoke(this, new NavigationRequestedEventArgs(page, true));
-
- InternalChildren.Remove(page);
- if (RootPage == page)
- RootPage = (Page)InternalChildren.First();
- }
-
- void SafePop()
- {
- PopAsync(true).ContinueWith(t =>
- {
- if (t.IsFaulted)
- throw t.Exception;
- });
- }
-
- class NavigationImpl : NavigationProxy
- {
- // readonly Lazy<ReadOnlyCastingList<Page, Element>> _castingList;
-
- public NavigationImpl(NavigationPage owner)
- {
- Owner = owner;
- // _castingList = new Lazy<ReadOnlyCastingList<Page, Element>>(() => new ReadOnlyCastingList<Page, Element>(Owner.InternalChildren));
- }
-
- NavigationPage Owner { get; }
-
- protected override IReadOnlyList<Page> GetNavigationStack()
- {
- // return _castingList.Value;
- return null;
- }
-
- protected override void OnInsertPageBefore(Page page, Page before)
- {
- Owner.InsertPageBefore(page, before);
- }
-
- protected override Task<Page> OnPopAsync(bool animated)
- {
- return Owner.PopAsync(animated);
- }
-
- protected override Task OnPopToRootAsync(bool animated)
- {
- return Owner.PopToRootAsync(animated);
- }
-
- protected override Task OnPushAsync(Page root, bool animated)
- {
- return Owner.PushAsync(root, animated);
- }
-
- protected override void OnRemovePage(Page page)
- {
- Owner.RemovePage(page);
- }
- }
-
- readonly Lazy<PlatformConfigurationRegistry<NavigationPage>> _platformConfigurationRegistry;
-
- /// <summary>
- /// Returns the platform-specific instance of this NavigationPage, on which a platform-specific method may be called.
- /// </summary>
- /// <typeparam name="T">The platform for which to return an instance.</typeparam>
- /// <returns>The platform-specific instance of this NavigationPage</returns>
- public new IPlatformElementConfiguration<T, NavigationPage> On<T>() where T : IConfigPlatform
- {
- return _platformConfigurationRegistry.Value.On<T>();
- }
- }
-}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace Tizen.NUI.Binding
-{
- /// <summary>
- /// For internal use.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal class NavigationProxy : INavigation
- {
- INavigation _inner;
- Lazy<List<Page>> _modalStack = new Lazy<List<Page>>(() => new List<Page>());
-
- Lazy<List<Page>> _pushStack = new Lazy<List<Page>>(() => new List<Page>());
-
- internal INavigation Inner
- {
- get { return _inner; }
- set
- {
- if (_inner == value)
- return;
- _inner = value;
- // reverse so that things go into the new stack in the same order
- // null out to release memory that will likely never be needed again
-
- if (ReferenceEquals(_inner, null))
- {
- _pushStack = new Lazy<List<Page>>(() => new List<Page>());
- _modalStack = new Lazy<List<Page>>(() => new List<Page>());
- }
- else
- {
- if (_pushStack != null && _pushStack.IsValueCreated)
- {
- foreach (Page page in _pushStack.Value)
- {
- _inner.PushAsync(page);
- }
- }
-
- if (_modalStack != null && _modalStack.IsValueCreated)
- {
- foreach (Page page in _modalStack.Value)
- {
- _inner.PushModalAsync(page);
- }
- }
-
- _pushStack = null;
- _modalStack = null;
- }
- }
- }
-
- /// <summary>
- /// Inserts a page in the navigation stack before an existing page in the stack.
- /// </summary>
- /// <param name="page">The page to add.</param>
- /// <param name="before">The existing page, before which page will be inserted.</param>
- public void InsertPageBefore(Page page, Page before)
- {
- OnInsertPageBefore(page, before);
- }
-
- /// <summary>
- /// Gets the modal navigation stack.
- /// </summary>
- public IReadOnlyList<Page> ModalStack
- {
- get { return GetModalStack(); }
- }
-
- /// <summary>
- /// Gets the stack of pages in the navigation.
- /// </summary>
- public IReadOnlyList<Page> NavigationStack
- {
- get { return GetNavigationStack(); }
- }
-
- /// <summary>
- /// Asynchronously removes the most recent Page from the navigation stack.
- /// </summary>
- /// <returns>The Page that had been at the top of the navigation stack.</returns>
- public Task<Page> PopAsync()
- {
- return OnPopAsync(true);
- }
-
- /// <summary>
- /// Asynchronously removes the top Page from the navigation stack, with optional animation.
- /// </summary>
- /// <param name="animated">Whether to animate the pop.</param>
- /// <returns>The Page that had been at the top of the navigation stack.</returns>
- public Task<Page> PopAsync(bool animated)
- {
- return OnPopAsync(animated);
- }
-
- /// <summary>
- /// Asynchronously dismisses the most recent modally presented Page.
- /// </summary>
- /// <returns>An awaitable instance, indicating the PopModalAsync completion. The Task.Result is the Page that has been popped.</returns>
- public Task<Page> PopModalAsync()
- {
- return OnPopModal(true);
- }
-
- /// <summary>
- /// Asynchronously removes the top Page from the navigation stack, with optional animation.
- /// </summary>
- /// <param name="animated">Whether to animate the pop.</param>
- /// <returns>The Page that had been at the top of the navigation stack.</returns>
- public Task<Page> PopModalAsync(bool animated)
- {
- return OnPopModal(animated);
- }
-
- /// <summary>
- /// Pops all but the root Page off the navigation stack.
- /// </summary>
- /// <returns>A task representing the asynchronous dismiss operation.</returns>
- public Task PopToRootAsync()
- {
- return OnPopToRootAsync(true);
- }
-
- /// <summary>
- /// Pops all but the root Page off the navigation stack, with optional animation.
- /// </summary>
- /// <param name="animated">Whether to animate the pop.</param>
- /// <returns>A task representing the asynchronous dismiss operation.</returns>
- public Task PopToRootAsync(bool animated)
- {
- return OnPopToRootAsync(animated);
- }
-
- /// <summary>
- /// Asynchronously adds a Page to the top of the navigation stack.
- /// </summary>
- /// <param name="root">The Page to be pushed on top of the navigation stack.</param>
- /// <returns>A task that represents the asynchronous push operation.</returns>
- public Task PushAsync(Page root)
- {
- return PushAsync(root, true);
- }
-
- /// <summary>
- /// Asynchronously adds a Page to the top of the navigation stack, with optional animation.
- /// </summary>
- /// <param name="root">The page to push.</param>
- /// <param name="animated">Whether to animate the push.</param>
- /// <returns>A task that represents the asynchronous push operation.</returns>
- public Task PushAsync(Page root, bool animated)
- {
- if (root.RealParent != null)
- throw new InvalidOperationException("Page must not already have a parent.");
- return OnPushAsync(root, animated);
- }
-
- /// <summary>
- /// Presents a Page modally.
- /// </summary>
- /// <param name="modal">The Page to present modally.</param>
- /// <returns>An awaitable Task, indicating the PushModal completion.</returns>
- public Task PushModalAsync(Page modal)
- {
- return PushModalAsync(modal, true);
- }
-
- /// <summary>
- /// Presents a Page modally, with optional animation.
- /// </summary>
- /// <param name="modal">The page to push.</param>
- /// <param name="animated">Whether to animate the push.</param>
- /// <returns>An awaitable Task, indicating the PushModal completion.</returns>
- public Task PushModalAsync(Page modal, bool animated)
- {
- if (modal.RealParent != null)
- throw new InvalidOperationException("Page must not already have a parent.");
- return OnPushModal(modal, animated);
- }
-
- /// <summary>
- /// Removes the specified page from the navigation stack.
- /// </summary>
- /// <param name="page">The page to remove.</param>
- public void RemovePage(Page page)
- {
- OnRemovePage(page);
- }
-
- /// <summary>
- /// For internal use. Returns the modal navigation stack.
- /// </summary>
- /// <returns>The modal navigation stack.</returns>
- protected virtual IReadOnlyList<Page> GetModalStack()
- {
- INavigation currentInner = Inner;
- return currentInner == null ? _modalStack.Value : currentInner.ModalStack;
- }
-
- /// <summary>
- /// For internal use. Returns the stack of pages in the navigation.
- /// </summary>
- /// <returns>The stack of pages in the navigation.</returns>
- protected virtual IReadOnlyList<Page> GetNavigationStack()
- {
- INavigation currentInner = Inner;
- return currentInner == null ? _pushStack.Value : currentInner.NavigationStack;
- }
-
- /// <summary>
- /// The method called when insert a page in the navigation stack before an existing page in the stack.
- /// </summary>
- /// <param name="page">The page to add.</param>
- /// <param name="before">The existing page, before which page will be inserted.</param>
- protected virtual void OnInsertPageBefore(Page page, Page before)
- {
- INavigation currentInner = Inner;
- if (currentInner == null)
- {
- int index = _pushStack.Value.IndexOf(before);
- if (index == -1)
- throw new ArgumentException("before must be in the pushed stack of the current context");
- _pushStack.Value.Insert(index, page);
- }
- else
- {
- currentInner.InsertPageBefore(page, before);
- }
- }
-
- /// <summary>
- /// This method calls when removes the top Page from the navigation stack
- /// </summary>
- /// <param name="animated">Whether to animate the pop.</param>
- /// <returns></returns>
- protected virtual Task<Page> OnPopAsync(bool animated)
- {
- INavigation inner = Inner;
- return inner == null ? Task.FromResult(Pop()) : inner.PopAsync(animated);
- }
-
- /// <summary>
- /// This method calls when removes the top Page from the navigation stack
- /// </summary>
- /// <param name="animated">Whether to animate the pop.</param>
- /// <returns>An awaitable instance, indicating the PopModalAsync completion</returns>
- protected virtual Task<Page> OnPopModal(bool animated)
- {
- INavigation innerNav = Inner;
- return innerNav == null ? Task.FromResult(PopModal()) : innerNav.PopModalAsync(animated);
- }
-
- /// <summary>
- /// This method calls when Pops all but the root Page off the navigation stack.
- /// </summary>
- /// <param name="animated">Whether to animate the pop.</param>
- /// <returns>A task representing the asynchronous dismiss operation.</returns>
- protected virtual Task OnPopToRootAsync(bool animated)
- {
- INavigation currentInner = Inner;
- if (currentInner == null)
- {
- Page root = _pushStack.Value.Last();
- _pushStack.Value.Clear();
- _pushStack.Value.Add(root);
- return Task.FromResult(root);
- }
- return currentInner.PopToRootAsync(animated);
- }
-
- /// <summary>
- /// This method calls when adds a Page to the top of the navigation stack, with optional animation.
- /// </summary>
- /// <param name="page">The page to add</param>
- /// <param name="animated">Whether to animate the pop.</param>
- /// <returns>A task that represents the asynchronous push operation.</returns>
- protected virtual Task OnPushAsync(Page page, bool animated)
- {
- INavigation currentInner = Inner;
- if (currentInner == null)
- {
- _pushStack.Value.Add(page);
- return Task.FromResult(page);
- }
- return currentInner.PushAsync(page, animated);
- }
-
- /// <summary>
- /// This method calls when Presents a Page modally, with optional animation.
- /// </summary>
- /// <param name="modal">The page to push.</param>
- /// <param name="animated">Whether to animate the pop.</param>
- /// <returns>An awaitable Task, indicating the PushModal completion.</returns>
- protected virtual Task OnPushModal(Page modal, bool animated)
- {
- INavigation currentInner = Inner;
- if (currentInner == null)
- {
- _modalStack.Value.Add(modal);
- return Task.FromResult<object>(null);
- }
- return currentInner.PushModalAsync(modal, animated);
- }
-
- /// <summary>
- /// This method calls when Removes the specified page from the navigation stack.
- /// </summary>
- /// <param name="page">The page to add.</param>
- protected virtual void OnRemovePage(Page page)
- {
- INavigation currentInner = Inner;
- if (currentInner == null)
- {
- _pushStack.Value.Remove(page);
- }
- else
- {
- currentInner.RemovePage(page);
- }
- }
-
- Page Pop()
- {
- List<Page> list = _pushStack.Value;
- Page result = list[list.Count - 1];
- list.RemoveAt(list.Count - 1);
- return result;
- }
-
- Page PopModal()
- {
- List<Page> list = _modalStack.Value;
- Page result = list[list.Count - 1];
- list.RemoveAt(list.Count - 1);
- return result;
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System.ComponentModel;
-using System.Threading.Tasks;
-using Tizen.NUI;
-
-namespace Tizen.NUI.Binding
-{
- /// <summary>
- /// For internal use.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal class NavigationRequestedEventArgs : NavigationEventArgs
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="page"></param>
- /// <param name="animated"></param>
- /// <param name="realize"></param>
- public NavigationRequestedEventArgs(Page page, bool animated, bool realize = true) : base(page)
- {
- Animated = animated;
- Realize = realize;
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="page"></param>
- /// <param name="before"></param>
- /// <param name="animated"></param>
- public NavigationRequestedEventArgs(Page page, Page before, bool animated) : this(page, animated)
- {
- BeforePage = before;
- }
-
- /// <summary>
- /// Gets or Sets the whether animate.
- /// </summary>
- public bool Animated { get; set; }
-
- /// <summary>
- /// Gets or Sets the before page.
- /// </summary>
- public Page BeforePage { get; set; }
-
- /// <summary>
- /// Gets or Sets the realize.
- /// </summary>
- public bool Realize { get; set; }
-
- /// <summary>
- /// Gets or Sets the Task.
- /// </summary>
- public Task<bool> Task { get; set; }
- }
-}
\ No newline at end of file
+++ /dev/null
-namespace Tizen.NUI.Binding
-{
- internal class NullEffect : Effect
- {
- protected override void OnAttached()
- {
- }
-
- protected override void OnDetached()
- {
- }
- }
-}
+++ /dev/null
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Collections.Specialized;
-using System.Linq;
-
-namespace Tizen.NUI.Binding
-{
- internal class ObservableWrapper<TTrack, TRestrict> : IList<TRestrict>, INotifyCollectionChanged where TTrack : Element where TRestrict : TTrack
- {
- readonly ObservableCollection<TTrack> _list;
-
- public ObservableWrapper(ObservableCollection<TTrack> list)
- {
- if (list == null)
- throw new ArgumentNullException("list");
-
- _list = list;
-
- list.CollectionChanged += ListOnCollectionChanged;
- }
-
- public void Add(TRestrict item)
- {
- if (item == null)
- throw new ArgumentNullException("item");
- if (IsReadOnly)
- throw new NotSupportedException("The collection is read-only.");
-
- if (_list.Contains(item))
- return;
-
- item.Owned = true;
- _list.Add(item);
- }
-
- public void Clear()
- {
- if (IsReadOnly)
- throw new NotSupportedException("The collection is read-only.");
-
- foreach (TRestrict item in _list.OfType<TRestrict>().ToArray())
- {
- _list.Remove(item);
- item.Owned = false;
- }
- }
-
- public bool Contains(TRestrict item)
- {
- return item.Owned && _list.Contains(item);
- }
-
- public void CopyTo(TRestrict[] array, int destIndex)
- {
- if (array.Length - destIndex < Count)
- throw new ArgumentException("Destination array was not long enough. Check destIndex and length, and the array's lower bounds.");
- foreach (TRestrict item in this)
- {
- array[destIndex] = item;
- destIndex++;
- }
- }
-
- public int Count
- {
- get { return _list.Where(i => i.Owned).OfType<TRestrict>().Count(); }
- }
-
- public bool IsReadOnly { get; internal set; }
-
- public bool Remove(TRestrict item)
- {
- if (item == null)
- throw new ArgumentNullException("item");
- if (IsReadOnly)
- throw new NotSupportedException("The collection is read-only.");
-
- if (!item.Owned)
- return false;
-
- if (_list.Remove(item))
- {
- item.Owned = false;
- return true;
- }
- return false;
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
-
- public IEnumerator<TRestrict> GetEnumerator()
- {
- return _list.Where(i => i.Owned).OfType<TRestrict>().GetEnumerator();
- }
-
- public int IndexOf(TRestrict value)
- {
- int innerIndex = _list.IndexOf(value);
- if (innerIndex == -1)
- return -1;
- return ToOuterIndex(innerIndex);
- }
-
- public void Insert(int index, TRestrict item)
- {
- if (item == null)
- throw new ArgumentNullException("item");
- if (IsReadOnly)
- throw new NotSupportedException("The collection is read-only.");
-
- item.Owned = true;
- _list.Insert(ToInnerIndex(index), item);
- }
-
- public TRestrict this[int index]
- {
- get { return (TRestrict)_list[ToInnerIndex(index)]; }
- set
- {
- int innerIndex = ToInnerIndex(index);
- if (value != null)
- value.Owned = true;
- TTrack old = _list[innerIndex];
- _list[innerIndex] = value;
-
- if (old != null)
- old.Owned = false;
- }
- }
-
- public void RemoveAt(int index)
- {
- if (IsReadOnly)
- throw new NotSupportedException("The collection is read-only");
- int innerIndex = ToInnerIndex(index);
- TTrack item = _list[innerIndex];
- if (item != null && item.Owned)
- {
- _list.RemoveAt(innerIndex);
- item.Owned = false;
- }
- }
-
- public event NotifyCollectionChangedEventHandler CollectionChanged;
-
- void ListOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
- {
- NotifyCollectionChangedEventHandler handler = CollectionChanged;
- if (handler == null)
- return;
-
- switch (e.Action)
- {
- case NotifyCollectionChangedAction.Add:
- if (e.NewStartingIndex == -1 || e.NewItems?.Count > 1)
- goto case NotifyCollectionChangedAction.Reset;
-
- var newItem = e.NewItems?[0] as TRestrict;
- if (newItem == null || !newItem.Owned)
- break;
-
- int outerIndex = ToOuterIndex(e.NewStartingIndex);
- handler(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, e.NewItems, outerIndex));
- break;
- case NotifyCollectionChangedAction.Move:
- if (e.NewStartingIndex == -1 || e.OldStartingIndex == -1 || e.NewItems?.Count > 1)
- goto case NotifyCollectionChangedAction.Reset;
-
- var movedItem = e.NewItems?[0] as TRestrict;
- if (movedItem == null || !movedItem.Owned)
- break;
-
- int outerOldIndex = ToOuterIndex(e.OldStartingIndex);
- int outerNewIndex = ToOuterIndex(e.NewStartingIndex);
- handler(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Move, e.NewItems, outerNewIndex, outerOldIndex));
- break;
- case NotifyCollectionChangedAction.Remove:
- if (e.OldStartingIndex == -1 || e.OldItems?.Count > 1)
- goto case NotifyCollectionChangedAction.Reset;
-
- var removedItem = e.OldItems?[0] as TRestrict;
- if (removedItem == null || !removedItem.Owned)
- break;
-
- int outerRemovedIndex = ToOuterIndex(e.OldStartingIndex);
- var args = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, removedItem, outerRemovedIndex);
- handler(this, args);
- break;
- case NotifyCollectionChangedAction.Replace:
- if (e.NewStartingIndex == -1 || e.OldStartingIndex == -1 || e.NewItems?.Count > 1)
- goto case NotifyCollectionChangedAction.Reset;
-
- var newReplaceItem = e.NewItems?[0] as TRestrict;
- var oldReplaceItem = e.OldItems?[0] as TRestrict;
-
- if ((newReplaceItem == null || !newReplaceItem.Owned) && (oldReplaceItem == null || !oldReplaceItem.Owned))
- {
- break;
- }
- if (newReplaceItem == null || !newReplaceItem.Owned || oldReplaceItem == null || !oldReplaceItem.Owned)
- {
- goto case NotifyCollectionChangedAction.Reset;
- }
-
- int index = ToOuterIndex(e.NewStartingIndex);
-
- var replaceArgs = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, newReplaceItem, oldReplaceItem, index);
- handler(this, replaceArgs);
- break;
- case NotifyCollectionChangedAction.Reset:
- handler(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
- break;
- default:
- throw new ArgumentOutOfRangeException();
- }
- }
-
- int ToInnerIndex(int outterIndex)
- {
- var outerIndex = 0;
- int innerIndex;
- for (innerIndex = 0; innerIndex < _list.Count; innerIndex++)
- {
- TTrack item = _list[innerIndex];
- if (item is TRestrict && item.Owned)
- {
- if (outerIndex == outterIndex)
- return innerIndex;
- outerIndex++;
- }
- }
-
- return innerIndex;
- }
-
- int ToOuterIndex(int innerIndex)
- {
- var outerIndex = 0;
- for (var index = 0; index < innerIndex; index++)
- {
- TTrack item = _list[index];
- if (item is TRestrict && item.Owned)
- {
- outerIndex++;
- }
- }
-
- return outerIndex;
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using Tizen.NUI.Binding.Internals;
-
-namespace Tizen.NUI.Binding
-{
- internal class OnIdiom<T>
- {
- public T Phone { get; set; }
-
- public T Tablet { get; set; }
-
- public T Desktop { get; set; }
-
- public T TV { get; set; }
-
- public T Watch { get; set; }
-
- public static implicit operator T(OnIdiom<T> onIdiom)
- {
- switch (Device.Idiom)
- {
- default:
- case TargetIdiom.Phone:
- return onIdiom.Phone;
- case TargetIdiom.Tablet:
- return onIdiom.Tablet;
- case TargetIdiom.Desktop:
- return onIdiom.Desktop;
- case TargetIdiom.TV:
- return onIdiom.TV;
- case TargetIdiom.Watch:
- return onIdiom.Watch;
- }
- }
- }
-}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using Tizen.NUI.Xaml;
-
-namespace Tizen.NUI.Binding
-{
- [ContentProperty("Platforms")]
- internal class OnPlatform<T>
- {
- public OnPlatform()
- {
- Platforms = new List<On>();
- }
-
- bool useLegacyFallback;
- T android;
- [Obsolete]
- public T Android {
- get { return android; }
- set {
- useLegacyFallback = true;
- android = value;
- }
- }
-
- T ios;
- [Obsolete]
- public T iOS {
- get { return ios; }
- set {
- useLegacyFallback = true;
- ios = value;
- }
- }
-
- T winPhone;
- [Obsolete]
- public T WinPhone {
- get { return winPhone; }
- set {
- useLegacyFallback = true;
- winPhone = value;
- }
- }
-
- bool hasDefault;
- T @default;
- public T Default {
- get { return @default; }
- set {
- hasDefault = true;
- @default = value;
- }
- }
-
- public IList<On> Platforms { get; private set; }
-
-#pragma warning disable RECS0108 // Warns about static fields in generic types
- static readonly IValueConverterProvider s_valueConverter = DependencyService.Get<IValueConverterProvider>();
-#pragma warning restore RECS0108 // Warns about static fields in generic types
-
- public static implicit operator T(OnPlatform<T> onPlatform)
- {
- foreach (var onPlat in onPlatform.Platforms) {
- if (onPlat.Platform == null)
- continue;
- if (!onPlat.Platform.Contains(Device.RuntimePlatform))
- continue;
- if (s_valueConverter == null)
- continue;
- return (T)s_valueConverter.Convert(onPlat.Value, typeof(T), null, null);
- }
-
- if (!onPlatform.useLegacyFallback)
- return onPlatform.hasDefault ? onPlatform.@default : default(T);
-
- //legacy fallback
-#pragma warning disable 0618, 0612
- return Device.OnPlatform(iOS: onPlatform.iOS, Android: onPlatform.Android, WinPhone: onPlatform.WinPhone);
-#pragma warning restore 0618, 0612
- }
- }
-
- [ContentProperty("Value")]
- internal class On
- {
- [TypeConverter(typeof(ListStringTypeConverter))]
- public IList<string> Platform { get; set; }
- public object Value { get; set; }
- }
-}
+++ /dev/null
-namespace Tizen.NUI.Binding
-{
- internal static class PaddingElement
- {
- internal static readonly BindableProperty PaddingProperty =
- BindableProperty.Create("Padding", typeof(Thickness), typeof(IPaddingElement), default(Thickness),
- propertyChanged: OnPaddingPropertyChanged,
- defaultValueCreator: PaddingDefaultValueCreator);
-
- static void OnPaddingPropertyChanged(BindableObject bindable, object oldValue, object newValue)
- {
- ((IPaddingElement)bindable).OnPaddingPropertyChanged((Thickness)oldValue, (Thickness)newValue);
- }
-
- static object PaddingDefaultValueCreator(BindableObject bindable)
- {
- return ((IPaddingElement)bindable).PaddingDefaultValueCreator();
- }
-
- public static readonly BindableProperty PaddingLeftProperty =
- BindableProperty.Create("PaddingLeft", typeof(double), typeof(IPaddingElement), default(double),
- propertyChanged: OnPaddingLeftChanged);
-
- static void OnPaddingLeftChanged(BindableObject bindable, object oldValue, object newValue)
- {
- var padding = (Thickness)bindable.GetValue(PaddingProperty);
- padding.Left = (double)newValue;
- bindable.SetValue(PaddingProperty, padding);
- }
-
- public static readonly BindableProperty PaddingTopProperty =
- BindableProperty.Create("PaddingTop", typeof(double), typeof(IPaddingElement), default(double),
- propertyChanged: OnPaddingTopChanged);
-
- static void OnPaddingTopChanged(BindableObject bindable, object oldValue, object newValue)
- {
- var padding = (Thickness)bindable.GetValue(PaddingProperty);
- padding.Top = (double)newValue;
- bindable.SetValue(PaddingProperty, padding);
- }
-
- public static readonly BindableProperty PaddingRightProperty =
- BindableProperty.Create("PaddingRight", typeof(double), typeof(IPaddingElement), default(double),
- propertyChanged: OnPaddingRightChanged);
-
- static void OnPaddingRightChanged(BindableObject bindable, object oldValue, object newValue)
- {
- var padding = (Thickness)bindable.GetValue(PaddingProperty);
- padding.Right = (double)newValue;
- bindable.SetValue(PaddingProperty, padding);
- }
-
- public static readonly BindableProperty PaddingBottomProperty =
- BindableProperty.Create("PaddingBottom", typeof(double), typeof(IPaddingElement), default(double),
- propertyChanged: OnPaddingBottomChanged);
-
- static void OnPaddingBottomChanged(BindableObject bindable, object oldValue, object newValue)
- {
- var padding = (Thickness)bindable.GetValue(PaddingProperty);
- padding.Bottom = (double)newValue;
- bindable.SetValue(PaddingProperty, padding);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Binding
-{
- [AttributeUsage(AttributeTargets.Parameter)]
- internal sealed class ParameterAttribute : Attribute
- {
- public ParameterAttribute(string name)
- {
- Name = name;
- }
-
- public string Name { get; }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-
-namespace Tizen.NUI.Binding
-{
- /// <summary>
- /// Helper that handles storing and lookup of platform specifics implementations
- /// </summary>
- /// <typeparam name="TElement">The Element type</typeparam>
- internal class PlatformConfigurationRegistry<TElement> : IElementConfiguration<TElement>
- where TElement : Element
- {
- readonly TElement _element;
- readonly Dictionary<Type, object> _platformSpecifics = new Dictionary<Type, object>();
-
- internal PlatformConfigurationRegistry(TElement element)
- {
- _element = element;
- }
-
-
- public IPlatformElementConfiguration<T, TElement> On<T>() where T : IConfigPlatform
- {
- if (_platformSpecifics.ContainsKey(typeof(T)))
- {
- return (IPlatformElementConfiguration<T, TElement>)_platformSpecifics[typeof(T)];
- }
-
- var emptyConfig = Configuration<T, TElement>.Create(_element);
-
- _platformSpecifics.Add(typeof(T), emptyConfig);
-
- return emptyConfig;
- }
- }
-}
+++ /dev/null
-using System;
-using System.Linq;
-using System.Reflection;
-using System.Globalization;
-
-using Tizen.NUI;
-
-namespace Tizen.NUI.Binding
-{
- internal class PositionTypeConverter : TypeConverter
- {
- public override object ConvertFromInvariantString(string value)
- {
- if (value != null)
- {
- string[] parts = value.Split('.');
- if (parts.Length == 1 || ( parts.Length == 2 && (parts[0].Trim() == "ParentOrigin" || parts[0].Trim() == "PivotPoint") ))
- {
- string position = parts[parts.Length - 1].Trim();
-
- switch(position)
- {
- case "Top":
- return ParentOrigin.Top;
- case "Bottom":
- return ParentOrigin.Bottom;
- case "Left":
- return ParentOrigin.Left;
- case "Right":
- return ParentOrigin.Right;
- case "Middle":
- return ParentOrigin.Middle;
- case "TopLeft":
- return ParentOrigin.TopLeft;
- case "TopCenter":
- return ParentOrigin.TopCenter;
- case "TopRight":
- return ParentOrigin.TopRight;
- case "CenterLeft":
- return ParentOrigin.CenterLeft;
- case "Center":
- return ParentOrigin.Center;
- case "CenterRight":
- return ParentOrigin.CenterRight;
- case "BottomLeft":
- return ParentOrigin.BottomLeft;
- case "BottomCenter":
- return ParentOrigin.BottomCenter;
- case "BottomRight":
- return ParentOrigin.BottomRight;
- }
- }
-
- parts = value.Split(',');
- if (parts.Length == 3)
- {
- int x = (int)GraphicsTypeManager.Instance.ConvertScriptToPixel(parts[0].Trim());
- int y = (int)GraphicsTypeManager.Instance.ConvertScriptToPixel(parts[1].Trim());
- int z = (int)GraphicsTypeManager.Instance.ConvertScriptToPixel(parts[2].Trim());
- return new Position(x, y, z);
- }
- }
-
- throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(Position)}");
- }
- }
-
- internal class Position2DTypeConverter : TypeConverter
- {
- public override object ConvertFromInvariantString(string value)
- {
- return Position2D.ConvertFromString(value);
- }
- }
-}
+++ /dev/null
-using System;
-using System.Globalization;
-
-using Tizen.NUI;
-
-namespace Tizen.NUI.Binding
-{
- [Xaml.ProvideCompiled("Tizen.NUI.Xaml.Core.XamlC.RectangleTypeConverter")]
- [Xaml.TypeConversion(typeof(Rectangle))]
- internal class RectangleTypeConverter : TypeConverter
- {
- public override object ConvertFromInvariantString(string value)
- {
- if (value != null)
- {
- double x, y, w, h;
- string[] xywh = value.Split(',');
- if (xywh.Length == 4 && double.TryParse(xywh[0], NumberStyles.Number, CultureInfo.InvariantCulture, out x) && double.TryParse(xywh[1], NumberStyles.Number, CultureInfo.InvariantCulture, out y) &&
- double.TryParse(xywh[2], NumberStyles.Number, CultureInfo.InvariantCulture, out w) && double.TryParse(xywh[3], NumberStyles.Number, CultureInfo.InvariantCulture, out h))
- return new Rectangle((int)x, (int)y, (int)w, (int)h);
- }
-
- throw new InvalidOperationException(string.Format("Cannot convert \"{0}\" into {1}", value, typeof(Rectangle)));
- }
- }
-}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Reflection;
-using Tizen.NUI.Binding;
-
-namespace Tizen.NUI.Binding
-{
- // Previewer uses reflection to bind to this method; Removal or modification of visibility will break previewer.
- internal static class Registrar
- {
- internal static void RegisterAll(Type[] attrTypes) => Internals.Registrar.RegisterAll(attrTypes);
- }
-}
-
-namespace Tizen.NUI.Binding.Internals
-{
- /// <summary>
- /// For internal use.
- /// </summary>
- /// <typeparam name="TRegistrable"></typeparam>
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal class Registrar<TRegistrable> where TRegistrable : class
- {
- readonly Dictionary<Type, Type> _handlers = new Dictionary<Type, Type>();
-
- /// <summary>
- /// Register.
- /// </summary>
- /// <param name="tview">The type of the view</param>
- /// <param name="trender">The type of the render.</param>
- public void Register(Type tview, Type trender)
- {
- //avoid caching null renderers
- if (trender == null)
- return;
- _handlers[tview] = trender;
- }
-
- internal TRegistrable GetHandler(Type type)
- {
- Type handlerType = GetHandlerType(type);
- if (handlerType == null)
- return null;
-
- object handler = DependencyResolver.ResolveOrCreate(handlerType);
-
- return (TRegistrable)handler;
- }
-
- internal TRegistrable GetHandler(Type type, params object[] args)
- {
- if (args.Length == 0)
- {
- return GetHandler(type);
- }
-
- Type handlerType = GetHandlerType(type);
- if (handlerType == null)
- return null;
-
- return (TRegistrable)DependencyResolver.ResolveOrCreate(handlerType, args);
- }
-
- /// <summary>
- /// For internal use. Returns handler.
- /// </summary>
- /// <typeparam name="TOut">The type of the handler</typeparam>
- /// <param name="type">The type.</param>
- /// <returns>The handler instance.</returns>
- public TOut GetHandler<TOut>(Type type) where TOut : TRegistrable
- {
- return (TOut)GetHandler(type);
- }
-
- /// <summary>
- /// For internal use. Returns handler.
- /// </summary>
- /// <typeparam name="TOut">The type of the handler</typeparam>
- /// <param name="type">The type.</param>
- /// <param name="args">The args of the type</param>
- /// <returns>The handler instance.</returns>
- public TOut GetHandler<TOut>(Type type, params object[] args) where TOut : TRegistrable
- {
- return (TOut)GetHandler(type, args);
- }
-
- /// <summary>
- /// For internal use. Return the handler of the object.
- /// </summary>
- /// <typeparam name="TOut">Thetype</typeparam>
- /// <param name="obj">The object instance.</param>
- /// <returns>The handle of the obj.</returns>
- public TOut GetHandlerForObject<TOut>(object obj) where TOut : TRegistrable
- {
- if (obj == null)
- throw new ArgumentNullException(nameof(obj));
-
- var reflectableType = obj as IReflectableType;
- var type = reflectableType != null ? reflectableType.GetTypeInfo().AsType() : obj.GetType();
-
- return (TOut)GetHandler(type);
- }
-
- /// <summary>
- /// For inetrnal use. Return the handler of the object.
- /// </summary>
- /// <typeparam name="TOut">The type</typeparam>
- /// <param name="obj">The object instance</param>
- /// <param name="args">The args of the type</param>
- /// <returns>The handler of the object.</returns>
- public TOut GetHandlerForObject<TOut>(object obj, params object[] args) where TOut : TRegistrable
- {
- if (obj == null)
- throw new ArgumentNullException(nameof(obj));
-
- var reflectableType = obj as IReflectableType;
- var type = reflectableType != null ? reflectableType.GetTypeInfo().AsType() : obj.GetType();
-
- return (TOut)GetHandler(type, args);
- }
-
- /// <summary>
- /// For internal use. Returns the handle type.
- /// </summary>
- /// <param name="viewType">The view type.</param>
- /// <returns>The type of the handle.</returns>
- public Type GetHandlerType(Type viewType)
- {
- Type type;
- if (LookupHandlerType(viewType, out type))
- return type;
-
- // lazy load render-view association with RenderWithAttribute (as opposed to using ExportRenderer)
- var attribute = viewType.GetTypeInfo().GetCustomAttribute<RenderWithAttribute>();
- if (attribute == null)
- {
- Register(viewType, null); // Cache this result so we don't have to do GetCustomAttribute again
- return null;
- }
-
- type = attribute.Type;
-
- if (type.Name.StartsWith("_", StringComparison.Ordinal))
- {
- // TODO: Remove attribute2 once renderer names have been unified across all platforms
- var attribute2 = type.GetTypeInfo().GetCustomAttribute<RenderWithAttribute>();
- if (attribute2 != null)
- type = attribute2.Type;
-
- if (type.Name.StartsWith("_", StringComparison.Ordinal))
- {
- Register(viewType, null); // Cache this result so we don't work through this chain again
- return null;
- }
- }
-
- Register(viewType, type); // Register this so we don't have to look for the RenderWith Attibute again in the future
-
- return type;
- }
-
- /// <summary>
- /// For internal use. Return the handle type of the object
- /// </summary>
- /// <param name="obj">The object instance.</param>
- /// <returns>The type of the handler.</returns>
- public Type GetHandlerTypeForObject(object obj)
- {
- if (obj == null)
- throw new ArgumentNullException(nameof(obj));
-
- var reflectableType = obj as IReflectableType;
- var type = reflectableType != null ? reflectableType.GetTypeInfo().AsType() : obj.GetType();
-
- return GetHandlerType(type);
- }
-
- bool LookupHandlerType(Type viewType, out Type handlerType)
- {
- Type type = viewType;
-
- while (type != null)
- {
- if (_handlers.ContainsKey(type))
- {
- handlerType = _handlers[type];
- return true;
- }
-
- type = type.GetTypeInfo().BaseType;
- }
-
- handlerType = null;
- return false;
- }
- }
-
- /// <summary>
- /// For internal use
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal static class Registrar
- {
- static Registrar()
- {
- Registered = new Registrar<IRegisterable>();
- }
-
- internal static Dictionary<string, Type> Effects { get; } = new Dictionary<string, Type>();
- internal static Dictionary<string, StyleSheets.StylePropertyAttribute> StyleProperties { get; } = new Dictionary<string, StyleSheets.StylePropertyAttribute>();
-
- public static IEnumerable<Assembly> ExtraAssemblies { get; set; }
-
- public static Registrar<IRegisterable> Registered { get; internal set; }
-
- public static void RegisterAll(Type[] attrTypes)
- {
- Assembly[] assemblies = Device.GetAssemblies();
- if (ExtraAssemblies != null)
- assemblies = assemblies.Union(ExtraAssemblies).ToArray();
-
- Assembly defaultRendererAssembly = Device.PlatformServices.GetType().GetTypeInfo().Assembly;
- int indexOfExecuting = Array.IndexOf(assemblies, defaultRendererAssembly);
-
- if (indexOfExecuting > 0)
- {
- assemblies[indexOfExecuting] = assemblies[0];
- assemblies[0] = defaultRendererAssembly;
- }
-
- // Don't use LINQ for performance reasons
- // Naive implementation can easily take over a second to run
- foreach (Assembly assembly in assemblies)
- {
- foreach (Type attrType in attrTypes)
- {
- Attribute[] attributes;
- try
- {
- attributes = assembly.GetCustomAttributes(attrType).ToArray();
- }
- catch (System.IO.FileNotFoundException)
- {
- // Sometimes the previewer doesn't actually have everything required for these loads to work
- Console.WriteLine(nameof(Registrar), "Could not load assembly: {0} for Attibute {1} | Some renderers may not be loaded", assembly.FullName, attrType.FullName);
- continue;
- }
- var length = attributes.Length;
- for (var i = 0; i < length;i++)
- {
- var attribute = (HandlerAttribute)attributes[i];
- if (attribute.ShouldRegister())
- Registered.Register(attribute.HandlerType, attribute.TargetType);
- }
- }
-
- string resolutionName = assembly.FullName;
- var resolutionNameAttribute = (ResolutionGroupNameAttribute)assembly.GetCustomAttribute(typeof(ResolutionGroupNameAttribute));
- if (resolutionNameAttribute != null)
- resolutionName = resolutionNameAttribute.ShortName;
-
- Attribute[] effectAttributes = assembly.GetCustomAttributes(typeof(ExportEffectAttribute)).ToArray();
- var exportEffectsLength = effectAttributes.Length;
- for (var i = 0; i < exportEffectsLength;i++)
- {
- var effect = (ExportEffectAttribute)effectAttributes[i];
- Effects [resolutionName + "." + effect.Id] = effect.Type;
- }
-
- Attribute[] styleAttributes = assembly.GetCustomAttributes(typeof(StyleSheets.StylePropertyAttribute)).ToArray();
- var stylePropertiesLength = styleAttributes.Length;
- for (var i = 0; i < stylePropertiesLength; i++)
- {
- var attribute = (StyleSheets.StylePropertyAttribute)styleAttributes[i];
- StyleProperties[attribute.CssPropertyName] = attribute;
- }
- }
-
- DependencyService.Initialize(assemblies);
- }
- }
-}
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Binding
-{
- [AttributeUsage(AttributeTargets.Class)]
- internal sealed class RenderWithAttribute : Attribute
- {
- public RenderWithAttribute(Type type)
- {
- Type = type;
- }
-
- public Type Type { get; }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Binding
-{
- [AttributeUsage(AttributeTargets.Assembly)]
- internal class ResolutionGroupNameAttribute : Attribute
- {
- public ResolutionGroupNameAttribute(string name)
- {
- ShortName = name;
- }
-
- internal string ShortName { get; private set; }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding
-{
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal class ResourcesChangedEventArgs : EventArgs
- {
- public static readonly ResourcesChangedEventArgs StyleSheets = new ResourcesChangedEventArgs(null);
-
- public ResourcesChangedEventArgs(IEnumerable<KeyValuePair<string, object>> values)
- {
- Values = values;
- }
-
- public IEnumerable<KeyValuePair<string, object>> Values { get; private set; }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-
-namespace Tizen.NUI.Binding
-{
- internal static class ResourcesExtensions
- {
- public static IEnumerable<KeyValuePair<string, object>> GetMergedResources(this IElement element)
- {
- Dictionary<string, object> resources = null;
- while (element != null)
- {
- var ve = element as IResourcesProvider;
- if (ve != null && ve.IsResourcesCreated)
- {
- resources = resources ?? new Dictionary<string, object>();
- if (ve.XamlResources != null)
- {
- foreach (KeyValuePair<string, object> res in ve.XamlResources.MergedResources)
- if (!resources.ContainsKey(res.Key))
- resources.Add(res.Key, res.Value);
- else if (res.Key.StartsWith(Style.StyleClassPrefix, StringComparison.Ordinal))
- {
- var mergedClassStyles = new List<Style>(resources[res.Key] as List<Style>);
- mergedClassStyles.AddRange(res.Value as List<Style>);
- resources[res.Key] = mergedClassStyles;
- }
- }
- }
- var app = element as Application;
- if (app != null && app.SystemResources != null)
- {
- resources = resources ?? new Dictionary<string, object>(8);
- foreach (KeyValuePair<string, object> res in app.SystemResources)
- if (!resources.ContainsKey(res.Key))
- resources.Add(res.Key, res.Value);
- else if (res.Key.StartsWith(Style.StyleClassPrefix, StringComparison.Ordinal))
- {
- var mergedClassStyles = new List<Style>(resources[res.Key] as List<Style>);
- mergedClassStyles.AddRange(res.Value as List<Style>);
- resources[res.Key] = mergedClassStyles;
- }
- }
- element = element.Parent;
- }
- return resources;
- }
-
- public static bool TryGetResource(this IElement element, string key, out object value)
- {
- while (element != null)
- {
- var ve = element as IResourcesProvider;
- if (ve != null && ve.IsResourcesCreated && ve.XamlResources != null && ve.XamlResources.TryGetValue(key, out value))
- {
- return true;
- }
- var app = element as Application;
- if (app != null && app.SystemResources != null && app.SystemResources.TryGetValue(key, out value))
- {
- return true;
- }
- element = element.Parent;
- }
-
- //Fallback for the XF previewer
- if (Application.Current != null && ((IResourcesProvider)Application.Current).IsResourcesCreated && Application.Current.XamlResources.TryGetValue(key, out value))
- return true;
-
- value = null;
- return false;
- }
- }
-}
+++ /dev/null
-using System;
-using System.Globalization;
-
-namespace Tizen.NUI.Binding
-{
- internal class RotationTypeConverter : TypeConverter
- {
- 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)
- {
- 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);
- }
- }
-
- throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(Rotation)}");
- }
- }
-}
+++ /dev/null
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding
-{
- internal class RoutingEffect : Effect
- {
- internal readonly Effect Inner;
-
- protected RoutingEffect(string effectId)
- {
- Inner = Resolve(effectId);
- }
-
- protected override void OnAttached()
- {
- }
-
- protected override void OnDetached()
- {
- }
-
- internal override void ClearEffect()
- {
- Inner?.ClearEffect();
- }
-
- internal override void SendAttached()
- {
- Inner?.SendAttached();
- }
-
- internal override void SendDetached()
- {
- Inner?.SendDetached();
- }
-
- internal override void SendOnElementPropertyChanged(PropertyChangedEventArgs args)
- {
- Inner?.SendOnElementPropertyChanged(args);
- }
- }
-}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Xml;
-using Tizen.NUI.Binding.Internals;
-using Tizen.NUI.Xaml;
-
-namespace Tizen.NUI.Binding
-{
- [ContentProperty("Value")]
- [ProvideCompiled("Tizen.NUI.Core.XamlC.SetterValueProvider")]
- internal sealed class Setter : IValueProvider
- {
- readonly ConditionalWeakTable<BindableObject, object> _originalValues = new ConditionalWeakTable<BindableObject, object>();
-
- public BindableProperty Property { get; set; }
-
- public object Value { get; set; }
-
- object IValueProvider.ProvideValue(IServiceProvider serviceProvider)
- {
- if (Property == null)
- {
- var lineInfoProvider = serviceProvider.GetService(typeof(IXmlLineInfoProvider)) as IXmlLineInfoProvider;
- IXmlLineInfo lineInfo = lineInfoProvider != null ? lineInfoProvider.XmlLineInfo : new XmlLineInfo();
- throw new XamlParseException("Property not set", lineInfo);
- }
- var valueconverter = serviceProvider.GetService(typeof(IValueConverterProvider)) as IValueConverterProvider;
-
- Func<MemberInfo> minforetriever =
- () =>
- (MemberInfo)Property.DeclaringType.GetRuntimeProperty(Property.PropertyName) ?? (MemberInfo)Property.DeclaringType.GetRuntimeMethod("Get" + Property.PropertyName, new[] { typeof(BindableObject) });
-
- object value = valueconverter?.Convert(Value, Property.ReturnType, minforetriever, serviceProvider);
- Value = value;
- return this;
- }
-
- internal void Apply(BindableObject target, bool fromStyle = false)
- {
- if (target == null)
- throw new ArgumentNullException("target");
- if (Property == null)
- return;
-
- object originalValue = target.GetValue(Property);
- if (!Equals(originalValue, Property.DefaultValue))
- {
- _originalValues.Remove(target);
- _originalValues.Add(target, originalValue);
- }
-
- var dynamicResource = Value as DynamicResource;
- var binding = Value as BindingBase;
- if (binding != null)
- target.SetBinding(Property, binding.Clone(), fromStyle);
- else if (dynamicResource != null)
- target.SetDynamicResource(Property, dynamicResource.Key, fromStyle);
- else
- {
- if (Value is IList<VisualStateGroup> visualStateGroupCollection)
- target.SetValue(Property, visualStateGroupCollection.Clone(), fromStyle);
- else
- target.SetValue(Property, Value, fromStyle);
- }
- }
-
- internal void UnApply(BindableObject target, bool fromStyle = false)
- {
- if (target == null)
- throw new ArgumentNullException(nameof(target));
- if (Property == null)
- return;
-
- object actual = target.GetValue(Property);
- if (!Equals(actual, Value) && !(Value is Tizen.NUI.Binding.Binding) && !(Value is DynamicResource))
- {
- //Do not reset default value if the value has been changed
- _originalValues.Remove(target);
- return;
- }
-
- object defaultValue;
- if (_originalValues.TryGetValue(target, out defaultValue))
- {
- //reset default value, unapply bindings and dynamicResource
- target.SetValue(Property, defaultValue, fromStyle);
- _originalValues.Remove(target);
- }
- else
- target.ClearValue(Property);
- }
- }
-}
+++ /dev/null
-using System.Diagnostics;
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding
-{
- /// <summary>
- /// Struct that defines minimum and maximum Sizes.
- /// </summary>
- [DebuggerDisplay("Request={Request.Width}x{Request.Height}, Minimum={Minimum.Width}x{Minimum.Height}")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal struct SizeRequest
- {
- /// <summary>
- /// The requested size.
- /// </summary>
- public Size Request { get; set; }
-
- /// <summary>
- /// The minimum acceptable size.
- /// </summary>
- public Size Minimum { get; set; }
-
- /// <summary>
- /// Creates a new SizeRequest object that requests at least the size minimum, but preferably the size request.
- /// </summary>
- /// <param name="request">The size of the request.</param>
- /// <param name="minimum">The minimum size for the request.</param>
- public SizeRequest(Size request, Size minimum)
- {
- Request = request;
- Minimum = minimum;
- }
-
- /// <summary>
- /// Creates a new SizeRequest with the specified request size.
- /// </summary>
- /// <param name="request">The size of the request.</param>
- public SizeRequest(Size request)
- {
- Request = request;
- Minimum = request;
- }
-
- /// <summary>
- /// Returns a string representation of the size request.
- /// </summary>
- /// <returns>a string representation of the size request.</returns>
- public override string ToString()
- {
- return string.Format("{{Request={0} Minimum={1}}}", Request, Minimum);
- }
- }
-}
+++ /dev/null
-using System;
-using System.Linq;
-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)
- {
- if (value != null)
- {
- string[] parts = value.Split(',');
- if (parts.Length == 3)
- {
- int x = (int)GraphicsTypeManager.Instance.ConvertScriptToPixel(parts[0].Trim());
- int y = (int)GraphicsTypeManager.Instance.ConvertScriptToPixel(parts[1].Trim());
- int z = (int)GraphicsTypeManager.Instance.ConvertScriptToPixel(parts[2].Trim());
- return new Size(x, y, z);
- }
- }
-
- throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(Size)}");
- }
- }
-
- [ProvideCompiledAttribute("Tizen.NUI.Xaml.Core.XamlC.Size2DTypeConverter")]
- internal class Size2DTypeConverter : TypeConverter
- {
- public override object ConvertFromInvariantString(string value)
- {
- if (value != null)
- {
- string[] parts = value.Split(',');
- if (parts.Length == 2)
- {
- int x = (int)GraphicsTypeManager.Instance.ConvertScriptToPixel(parts[0].Trim());
- int y = (int)GraphicsTypeManager.Instance.ConvertScriptToPixel(parts[1].Trim());
- return new Size2D(x, y);
- }
- }
-
- throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(Size2D)}");
- }
- }
-}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-using Tizen.NUI.StyleSheets;
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding
-{
- [ContentProperty("Setters")]
- internal sealed class Style : IStyle
- {
- internal const string StyleClassPrefix = "Tizen.NUI.Binding.StyleClass.";
-
- readonly BindableProperty _basedOnResourceProperty = BindableProperty.CreateAttached("BasedOnResource", typeof(Style), typeof(Style), default(Style),
- propertyChanged: OnBasedOnResourceChanged);
-
- readonly List<WeakReference<BindableObject>> _targets = new List<WeakReference<BindableObject>>(4);
-
- Style _basedOnStyle;
-
- string _baseResourceKey;
-
- IList<Behavior> _behaviors;
-
- IList<TriggerBase> _triggers;
-
- public Style([TypeConverter(typeof(TypeTypeConverter))] [Parameter("TargetType")] Type targetType)
- {
- if (targetType == null)
- throw new ArgumentNullException("targetType");
-
- TargetType = targetType;
- Setters = new List<Setter>();
- }
-
- public bool ApplyToDerivedTypes { get; set; }
-
- public Style BasedOn
- {
- get { return _basedOnStyle; }
- set
- {
- if (_basedOnStyle == value)
- return;
- if (!ValidateBasedOn(value))
- throw new ArgumentException("BasedOn.TargetType is not compatible with TargetType");
- Style oldValue = _basedOnStyle;
- _basedOnStyle = value;
- BasedOnChanged(oldValue, value);
- if (value != null)
- BaseResourceKey = null;
- }
- }
-
- public string BaseResourceKey
- {
- get { return _baseResourceKey; }
- set
- {
- if (_baseResourceKey == value)
- return;
- _baseResourceKey = value;
- //update all DynamicResources
- foreach (WeakReference<BindableObject> bindableWr in _targets)
- {
- BindableObject target;
- if (!bindableWr.TryGetTarget(out target))
- continue;
- target.RemoveDynamicResource(_basedOnResourceProperty);
- if (value != null)
- target.SetDynamicResource(_basedOnResourceProperty, value);
- }
- if (value != null)
- BasedOn = null;
- }
- }
-
- internal IList<Behavior> Behaviors
- {
- get { return _behaviors ?? (_behaviors = new AttachedCollection<Behavior>()); }
- }
-
- public bool CanCascade { get; set; }
-
- public string Class { get; set; }
-
- public IList<Setter> Setters { get; }
-
- /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
- public IList<TriggerBase> Triggers
- {
- get { return _triggers ?? (_triggers = new AttachedCollection<TriggerBase>()); }
- }
-
- void IStyle.Apply(BindableObject bindable)
- {
- _targets.Add(new WeakReference<BindableObject>(bindable));
- if (BaseResourceKey != null)
- bindable.SetDynamicResource(_basedOnResourceProperty, BaseResourceKey);
- ApplyCore(bindable, BasedOn ?? GetBasedOnResource(bindable));
- }
-
- public Type TargetType { get; }
-
- void IStyle.UnApply(BindableObject bindable)
- {
- UnApplyCore(bindable, BasedOn ?? GetBasedOnResource(bindable));
- bindable.RemoveDynamicResource(_basedOnResourceProperty);
- _targets.RemoveAll(wr =>
- {
- BindableObject target;
- return wr.TryGetTarget(out target) && target == bindable;
- });
- }
-
- internal bool CanBeAppliedTo(Type targetType)
- {
- if (TargetType == targetType)
- return true;
- if (!ApplyToDerivedTypes)
- return false;
- do
- {
- targetType = targetType.GetTypeInfo().BaseType;
- if (TargetType == targetType)
- return true;
- } while (targetType != typeof(Element));
- return false;
- }
-
- void ApplyCore(BindableObject bindable, Style basedOn)
- {
- if (basedOn != null)
- ((IStyle)basedOn).Apply(bindable);
-
- foreach (Setter setter in Setters)
- setter.Apply(bindable, true);
- ((AttachedCollection<Behavior>)Behaviors).AttachTo(bindable);
- ((AttachedCollection<TriggerBase>)Triggers).AttachTo(bindable);
- }
-
- void BasedOnChanged(Style oldValue, Style newValue)
- {
- foreach (WeakReference<BindableObject> bindableRef in _targets)
- {
- BindableObject bindable;
- if (!bindableRef.TryGetTarget(out bindable))
- continue;
-
- UnApplyCore(bindable, oldValue);
- ApplyCore(bindable, newValue);
- }
- }
-
- Style GetBasedOnResource(BindableObject bindable)
- {
- return (Style)bindable.GetValue(_basedOnResourceProperty);
- }
-
- static void OnBasedOnResourceChanged(BindableObject bindable, object oldValue, object newValue)
- {
- // Style style = (bindable as /*VisualElement*/BaseHandle).Style;
- // if (style == null)
- // return;
- // style.UnApplyCore(bindable, (Style)oldValue);
- // style.ApplyCore(bindable, (Style)newValue);
- }
-
- void UnApplyCore(BindableObject bindable, Style basedOn)
- {
- ((AttachedCollection<TriggerBase>)Triggers).DetachFrom(bindable);
- ((AttachedCollection<Behavior>)Behaviors).DetachFrom(bindable);
- foreach (Setter setter in Setters)
- setter.UnApply(bindable, true);
-
- if (basedOn != null)
- ((IStyle)basedOn).UnApply(bindable);
- }
-
- bool ValidateBasedOn(Style value)
- {
- if (value == null)
- return true;
- return value.TargetType.IsAssignableFrom(TargetType);
- }
- }
-}
+++ /dev/null
-using System.Runtime.CompilerServices;
-
-namespace Tizen.NUI.StyleSheets
-{
- internal static class CharExtensions
- {
- //w [ \t\r\n\f]*
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool IsW(this char c)
- {
- return c == ' '
- || c == '\t'
- || c == '\r'
- || c == '\n'
- || c == '\f';
- }
-
- //nmstart [_a-z]|{nonascii}|{escape}
- //escape {unicode}|\\[^\n\r\f0-9a-f]
- //nonascii [^\0-\237]
- // TODO support escape and nonascii
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool IsNmStart(this char c)
- {
- return c == '_' || char.IsLetter(c);
- }
-
- //nmchar [_a-z0-9-]|{nonascii}|{escape}
- //unicode \\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?
- //escape {unicode}|\\[^\n\r\f0-9a-f]
- //nonascii [^\0-\237]
- //TODO support escape, nonascii and unicode
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool IsNmChar(this char c)
- {
- return c == '_'
- || c == '-'
- || char.IsLetterOrDigit(c);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.IO;
-
-namespace Tizen.NUI.StyleSheets
-{
- internal sealed class CssReader : TextReader
- {
- readonly TextReader _reader;
-
- public CssReader(TextReader reader)
- {
- if (reader == null)
- throw new ArgumentNullException(nameof(reader));
-
- _reader = reader;
- }
-
- readonly Queue<char> _cache = new Queue<char>();
-
- //skip comments
- //TODO unescape escaped sequences
- public override int Peek()
- {
- if (_cache.Count > 0)
- return _cache.Peek();
-
- int p = _reader.Peek();
- if (p <= 0)
- return p;
- if (unchecked((char)p) != '/')
- return p;
-
- _cache.Enqueue(unchecked((char)_reader.Read()));
- p = _reader.Peek();
- if (p <= 0)
- return _cache.Peek();
- if (unchecked((char)p) != '*')
- return _cache.Peek();
-
- _cache.Clear();
- _reader.Read(); //consume the '*'
-
- bool hasStar = false;
- while (true) {
- var next = _reader.Read();
- if (next <= 0)
- return next;
- if (unchecked((char)next) == '*')
- hasStar = true;
- else if (hasStar && unchecked((char)next) == '/')
- return Peek(); //recursively call self for comments following comments
- else
- hasStar = false;
- }
- }
-
- //skip comments
- //TODO unescape escaped sequences
- public override int Read()
- {
- if (_cache.Count > 0)
- return _cache.Dequeue();
-
- int p = _reader.Read();
- if (p <= 0)
- return p;
- var c = unchecked((char)p);
- if (c != '/')
- return p;
-
- _cache.Enqueue(c);
- p = _reader.Read();
- if (p <= 0)
- return _cache.Dequeue();
- c = unchecked((char)p);
- if (c != '*')
- return _cache.Dequeue();
-
- _cache.Clear();
- _reader.Read(); //consume the '*'
-
- bool hasStar = false;
- while (true) {
- var next = _reader.Read();
- if (next <= 0)
- return next;
- if (unchecked((char)next) == '*')
- hasStar = true;
- else if (hasStar && unchecked((char)next) == '/')
- return Read(); //recursively call self for comments following comments
- else
- hasStar = false;
- }
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using Tizen.NUI.Binding;
-
-namespace Tizen.NUI.StyleSheets
-{
- internal interface IStyle
- {
- Type TargetType { get; }
-
- void Apply(BindableObject bindable);
- void UnApply(BindableObject bindable);
- }
-}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using Tizen.NUI.Binding;
-
-namespace Tizen.NUI.StyleSheets
-{
- internal interface IStyleSelectable
- {
- string[] NameAndBases { get; }
- string Id { get; }
- IStyleSelectable Parent { get; }
- IList<string> Classes { get; }
- IEnumerable<IStyleSelectable> Children { get; }
- }
-
- internal interface IStylable
- {
- BindableProperty GetProperty(string key, bool inheriting);
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.StyleSheets
-{
- internal abstract class Selector
- {
- Selector()
- {
- }
-
- public static Selector Parse(CssReader reader, char stopChar = '\0')
- {
- Selector root = All, workingRoot = All;
- Operator workingRootParent = null;
- Action<Operator, Selector> setCurrentSelector = (op, sel) => SetCurrentSelector(ref root, ref workingRoot, ref workingRootParent, op, sel);
-
- int p;
- reader.SkipWhiteSpaces();
- while ((p = reader.Peek()) > 0) {
- switch (unchecked((char)p)) {
- case '*':
- setCurrentSelector(new And(), All);
- reader.Read();
- break;
- case '.':
- reader.Read();
- var className = reader.ReadIdent();
- if (className == null)
- return Invalid;
- setCurrentSelector(new And(), new Class(className));
- break;
- case '#':
- reader.Read();
- var id = reader.ReadName();
- if (id == null)
- return Invalid;
- setCurrentSelector(new And(), new Id(id));
- break;
- case '[':
- throw new NotImplementedException("Attributes not implemented");
- case ',':
- reader.Read();
- setCurrentSelector(new Or(), All);
- reader.SkipWhiteSpaces();
- break;
- case '+':
- reader.Read();
- setCurrentSelector(new Adjacent(), All);
- reader.SkipWhiteSpaces();
- break;
- case '~':
- reader.Read();
- setCurrentSelector(new Sibling(), All);
- reader.SkipWhiteSpaces();
- break;
- case '>':
- reader.Read();
- setCurrentSelector(new Child(), All);
- reader.SkipWhiteSpaces();
- break;
- case '^': //not in CSS spec
- reader.Read();
- var element = reader.ReadIdent();
- if (element == null) return Invalid;
- setCurrentSelector(new And(), new Base(element));
- break;
- case ' ':
- case '\t':
- case '\n':
- case '\r':
- case '\f':
- reader.Read();
- bool processWs = false;
- while ((p = reader.Peek()) > 0) {
- var c = unchecked((char)p);
- if (char.IsWhiteSpace(c)) {
- reader.Read();
- continue;
- }
- processWs = (c != '+'
- && c != '>'
- && c != ','
- && c != '~'
- && c != '^'
- && c != stopChar);
- break;
- }
- if (!processWs)
- break;
- setCurrentSelector(new Descendent(), All);
- reader.SkipWhiteSpaces();
- break;
- default:
- if (unchecked((char)p) == stopChar)
- return root;
-
- var elementName = reader.ReadIdent();
- if (elementName == null)
- return Invalid;
- setCurrentSelector(new And(), new Element(elementName));
- break;
- }
- }
- return root;
- }
-
- static void SetCurrentSelector(ref Selector root, ref Selector workingRoot, ref Operator workingRootParent, Operator op, Selector sel)
- {
- var updateRoot = root == workingRoot;
-
- op.Left = workingRoot;
- op.Right = sel;
- workingRoot = op;
- if (workingRootParent != null)
- workingRootParent.Right = workingRoot;
-
- if (updateRoot)
- root = workingRoot;
-
- if (workingRoot is Or) {
- workingRootParent = (Operator)workingRoot;
- workingRoot = sel;
- }
- }
-
- public abstract bool Matches(IStyleSelectable styleable);
-
- internal static Selector Invalid = new Generic(s => false);
- internal static Selector All = new Generic(s => true);
-
- abstract class UnarySelector : Selector
- {
- }
-
- abstract class Operator : Selector
- {
- public Selector Left { get; set; } = Invalid;
- public Selector Right { get; set; } = Invalid;
- }
-
- sealed class Generic : UnarySelector
- {
- readonly Func<IStyleSelectable, bool> func;
- public Generic(Func<IStyleSelectable, bool> func)
- {
- this.func = func;
- }
-
- public override bool Matches(IStyleSelectable styleable) => func(styleable);
- }
-
- sealed class Class : UnarySelector
- {
- public Class(string className)
- {
- ClassName = className;
- }
-
- public string ClassName { get; }
- public override bool Matches(IStyleSelectable styleable)
- => styleable.Classes != null && styleable.Classes.Contains(ClassName);
- }
-
- sealed class Id : UnarySelector
- {
- public Id(string id)
- {
- IdName = id;
- }
-
- public string IdName { get; }
- public override bool Matches(IStyleSelectable styleable) => styleable.Id == IdName;
- }
-
- sealed class Or : Operator
- {
- public override bool Matches(IStyleSelectable styleable) => Right.Matches(styleable) || Left.Matches(styleable);
- }
-
- sealed class And : Operator
- {
- public override bool Matches(IStyleSelectable styleable) => Right.Matches(styleable) && Left.Matches(styleable);
- }
-
- sealed class Element : UnarySelector
- {
- public Element(string elementName)
- {
- ElementName = elementName;
- }
-
- public string ElementName { get; }
- public override bool Matches(IStyleSelectable styleable) =>
- string.Equals(styleable.NameAndBases[0], ElementName, StringComparison.OrdinalIgnoreCase);
- }
-
- sealed class Base : UnarySelector
- {
- public Base(string elementName)
- {
- ElementName = elementName;
- }
-
- public string ElementName { get; }
- public override bool Matches(IStyleSelectable styleable) {
- for (var i = 0; i < styleable.NameAndBases.Length; i++)
- if (string.Equals(styleable.NameAndBases[i], ElementName, StringComparison.OrdinalIgnoreCase))
- return true;
- return false;
- }
- }
-
- sealed class Child : Operator
- {
- public override bool Matches(IStyleSelectable styleable) =>
- Right.Matches(styleable) && styleable.Parent != null && Left.Matches(styleable.Parent);
- }
-
- sealed class Descendent : Operator
- {
- public override bool Matches(IStyleSelectable styleable)
- {
- if (!Right.Matches(styleable))
- return false;
- var parent = styleable.Parent;
- while (parent != null) {
- if (Left.Matches(parent))
- return true;
- parent = parent.Parent;
- }
- return false;
- }
- }
-
- sealed class Adjacent : Operator
- {
- public override bool Matches(IStyleSelectable styleable)
- {
- if (!Right.Matches(styleable))
- return false;
- if (styleable.Parent == null)
- return false;
-
- IStyleSelectable prev = null;
- foreach (var elem in styleable.Parent.Children) {
- if (elem == styleable && prev != null)
- return Left.Matches(prev);
- prev = elem;
- }
- return false;
- //var index = styleable.Parent.Children.IndexOf(styleable);
- //if (index == 0)
- // return false;
- //var adjacent = styleable.Parent.Children[index - 1];
- //return Left.Matches(adjacent);
- }
- }
-
- sealed class Sibling : Operator
- {
- public override bool Matches(IStyleSelectable styleable)
- {
- if (!Right.Matches(styleable))
- return false;
- if (styleable.Parent == null)
- return false;
-
- int selfIndex = 0;
- bool foundSelfInParent = false;
- foreach (var elem in styleable.Parent.Children) {
- if (elem == styleable) {
- foundSelfInParent = true;
- break;
- }
- ++selfIndex;
- }
-
- if (!foundSelfInParent)
- return false;
-
- int index = 0;
- foreach (var elem in styleable.Parent.Children) {
- if (index >= selfIndex)
- return false;
- if (Left.Matches(elem))
- return true;
- ++index;
- }
-
- return false;
-
- //var index = styleable.Parent.Children.IndexOf(styleable);
- //if (index == 0)
- // return false;
- //int siblingIndex = -1;
- //for (var i = 0; i < index; i++)
- // if (Left.Matches(styleable.Parent.Children[i])) {
- // siblingIndex = i;
- // break;
- // }
- //return siblingIndex != -1;
- }
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-using Tizen.NUI.Binding;
-
-namespace Tizen.NUI.StyleSheets
-{
- internal sealed class Style
- {
- Style()
- {
- }
-
- public IDictionary<string, string> Declarations { get; set; } = new Dictionary<string, string>();
- Dictionary<KeyValuePair<string, string>, object> convertedValues = new Dictionary<KeyValuePair<string, string>, object>();
-
- public static Style Parse(CssReader reader, char stopChar = '\0')
- {
- Style style = new Style();
- string propertyName = null, propertyValue = null;
-
- int p;
- reader.SkipWhiteSpaces();
- bool readingName = true;
- while ((p = reader.Peek()) > 0) {
- switch (unchecked((char)p)) {
- case ':':
- reader.Read();
- readingName = false;
- reader.SkipWhiteSpaces();
- break;
- case ';':
- reader.Read();
- if (!string.IsNullOrEmpty(propertyName) && !string.IsNullOrEmpty(propertyValue))
- style.Declarations.Add(propertyName, propertyValue);
- propertyName = propertyValue = null;
- readingName = true;
- reader.SkipWhiteSpaces();
- break;
- default:
- if ((char)p == stopChar)
- return style;
-
- if (readingName) {
- propertyName = reader.ReadIdent();
- if (propertyName == null)
- throw new Exception();
- } else
- propertyValue = reader.ReadUntil(stopChar, ';', ':');
- break;
- }
- }
- return style;
- }
-
- public void Apply(/*VisualElement*/BaseHandle styleable, bool inheriting = false)
- {
- if (styleable == null)
- throw new ArgumentNullException(nameof(styleable));
-
- foreach (var decl in Declarations) {
- var property = ((IStylable)styleable).GetProperty(decl.Key, inheriting);
- if (property == null)
- continue;
- if (string.Equals(decl.Value, "initial", StringComparison.OrdinalIgnoreCase))
- styleable.ClearValue(property, fromStyle: true);
- else {
- object value;
- if (!convertedValues.TryGetValue(decl, out value))
- convertedValues[decl] = (value = Convert(styleable, decl.Value, property));
- styleable.SetValue(property, value, fromStyle: true);
- }
- }
-
- foreach (var child in styleable.LogicalChildrenInternal) {
- var ve = child as /*VisualElement*/BaseHandle;
- if (ve == null)
- continue;
- Apply(ve, inheriting: true);
- }
- }
-
- // [MethodImpl(MethodImplOptions.AggressiveInlining)]
- static object Convert(object target, object value, BindableProperty property)
- {
- Func<MemberInfo> minforetriever = () => property.DeclaringType.GetRuntimeProperty(property.PropertyName) as MemberInfo
- ?? property.DeclaringType.GetRuntimeMethod("Get" + property.PropertyName, new[] { typeof(BindableObject) }) as MemberInfo;
- var serviceProvider = new StyleSheetServiceProvider(target, property);
- // return value.ConvertTo(property.ReturnType, minforetriever, serviceProvider);
- return null;
- }
-
- public void UnApply(IStylable styleable)
- {
- throw new NotImplementedException();
- }
- }
-}
+++ /dev/null
-using System;
-using Tizen.NUI.Binding;
-
-namespace Tizen.NUI.StyleSheets
-{
- [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true, Inherited = true)]
- internal sealed class StylePropertyAttribute : Attribute
- {
- public string CssPropertyName { get; }
- public string BindablePropertyName { get; }
- public Type TargetType { get; }
- public Type PropertyOwnerType { get; set; }
- public BindableProperty BindableProperty { get; set; }
- public bool Inherited { get; set; } = false;
-
-
- public StylePropertyAttribute(string cssPropertyName, Type targetType, string bindablePropertyName)
- {
- CssPropertyName = cssPropertyName;
- BindablePropertyName = bindablePropertyName;
- TargetType = targetType;
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.IO;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Xml;
-using Tizen.NUI.Xaml;
-using Tizen.NUI.Binding;
-
-namespace Tizen.NUI.StyleSheets
-{
- internal sealed class StyleSheet : IStyle
- {
- StyleSheet()
- {
- }
-
- internal IDictionary<Selector, Style> Styles { get; set; } = new Dictionary<Selector, Style>();
-
- public static StyleSheet FromAssemblyResource(Assembly assembly, string resourceId, IXmlLineInfo lineInfo = null)
- {
- using (var stream = assembly.GetManifestResourceStream(resourceId)) {
- if (stream == null)
- throw new XamlParseException($"No resource found for '{resourceId}'.", lineInfo);
- using (var reader = new StreamReader(stream)) {
- return FromReader(reader);
- }
- }
- }
-
- //used by code generated by XamlC. Has to stay public
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static StyleSheet FromString(string stylesheet)
- {
- if (stylesheet == null)
- throw new ArgumentNullException(nameof(stylesheet));
- using (var reader = new StringReader(stylesheet))
- return FromReader(reader);
- }
-
- public static StyleSheet FromReader(TextReader reader)
- {
- if (reader == null)
- throw new ArgumentNullException(nameof(reader));
-
- return Parse(new CssReader(reader));
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- static StyleSheet Parse(CssReader reader)
- {
- var sheet = new StyleSheet();
-
- Style style = null;
- var selector = Selector.All;
-
- int p;
- bool inStyle = false;
- reader.SkipWhiteSpaces();
- while ((p = reader.Peek()) > 0) {
- switch ((char)p) {
- case '@':
- throw new NotSupportedException("AT-rules not supported");
- case '{':
- reader.Read();
- style = Style.Parse(reader, '}');
- inStyle = true;
- break;
- case '}':
- reader.Read();
- if (!inStyle)
- throw new Exception();
- inStyle = false;
- sheet.Styles.Add(selector, style);
- style = null;
- selector = Selector.All;
- break;
- default:
- selector = Selector.Parse(reader, '{');
- break;
- }
- }
- return sheet;
- }
-
- Type IStyle.TargetType
- => typeof(/*VisualElement*/BaseHandle);
-
- void IStyle.Apply(BindableObject bindable)
- {
- var styleable = bindable as Element;
- if (styleable == null)
- return;
- Apply(styleable);
- }
-
- void Apply(Element styleable)
- {
- ApplyCore(styleable);
- foreach (var child in styleable.LogicalChildrenInternal)
- ((IStyle)this).Apply(child);
- }
-
- void ApplyCore(Element styleable)
- {
- var visualStylable = styleable as /*VisualElement*/BaseHandle;
- if (visualStylable == null)
- return;
- foreach (var kvp in Styles) {
- var selector = kvp.Key;
- var style = kvp.Value;
- // if (!selector.Matches(styleable))
- // continue;
- style.Apply(visualStylable);
- }
- }
-
- void IStyle.UnApply(BindableObject bindable)
- {
- throw new NotImplementedException();
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System.Collections.Generic;
-using Tizen.NUI.Binding;
-
-namespace Tizen.NUI.StyleSheets
-{
- internal static class StyleSheetExtensions
- {
- public static IEnumerable<StyleSheet> GetStyleSheets(this IResourcesProvider resourcesProvider)
- {
- if (resourcesProvider == null)
- {
- yield break;
- }
- if (!resourcesProvider.IsResourcesCreated)
- {
- yield break;
- }
- if (resourcesProvider.XamlResources == null || resourcesProvider.XamlResources.StyleSheets == null)
- {
- yield break;
- }
- foreach (var styleSheet in resourcesProvider.XamlResources.StyleSheets)
- {
- yield return styleSheet;
- }
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using Tizen.NUI.Xaml;
-
-namespace Tizen.NUI.StyleSheets
-{
- internal class StyleSheetServiceProvider : IServiceProvider
- {
- IProvideValueTarget vtProvider;
- IConverterOptions convOptions => new ConverterOptions();
-
- public StyleSheetServiceProvider(object targetObject, object targetProperty)
- {
- vtProvider = new ValueTargetProvider {
- TargetObject = targetObject,
- TargetProperty = targetProperty
- };
- }
-
- public object GetService(Type serviceType)
- {
- if (serviceType == typeof(IProvideValueTarget))
- return vtProvider;
- if (serviceType == typeof(IConverterOptions))
- return convOptions;
- return null;
- }
-
- class ValueTargetProvider : IProvideValueTarget
- {
- public object TargetObject { get; set; }
- public object TargetProperty { get; set; }
- }
-
- class ConverterOptions : IConverterOptions
- {
- public bool IgnoreCase => true;
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.IO;
-using System.Linq;
-using System.Text;
-
-namespace Tizen.NUI.StyleSheets
-{
- internal static class TextReaderExtensions
- {
- //ident [-]?{nmstart}{nmchar}*
- public static string ReadIdent(this TextReader reader)
- {
- var sb = new StringBuilder();
- bool first = true;
- bool hasLeadingDash = false;
- int p;
- while ((p = reader.Peek()) > 0) {
- var c = unchecked((char)p);
- if (first && !hasLeadingDash && c == '-') {
- sb.Append((char)reader.Read());
- hasLeadingDash = true;
- } else if (first && c.IsNmStart()) {
- sb.Append((char)reader.Read());
- first = false;
- } else if (first) { //a nmstart is expected
- throw new Exception();
- } else if (c.IsNmChar())
- sb.Append((char)reader.Read());
- else
- break;
- }
- return sb.ToString();
- }
-
- //name {nmchar}+
- public static string ReadName(this TextReader reader)
- {
- var sb = new StringBuilder();
- int p;
- while ((p = reader.Peek()) > 0) {
- var c = unchecked((char)p);
- if (c.IsNmChar())
- sb.Append((char)reader.Read());
- else
- break;
- }
- return sb.ToString();
- }
-
- public static string ReadUntil(this TextReader reader, params char[] limit)
- {
- var sb = new StringBuilder();
- int p;
- while ((p = reader.Peek()) > 0) {
- var c = unchecked((char)p);
- if (limit != null && limit.Contains(c))
- break;
- reader.Read();
- sb.Append(c);
- }
- return sb.ToString();
- }
-
- //w [ \t\r\n\f]*
- public static void SkipWhiteSpaces(this TextReader reader)
- {
- int p;
- while ((p = reader.Peek()) > 0) {
- var c = unchecked((char)p);
- if (!c.IsW())
- break;
- reader.Read();
- }
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Linq;
-
-namespace Tizen.NUI.Binding
-{
- internal class SynchronizedList<T> : IList<T>, IReadOnlyList<T>
- {
- readonly List<T> _list = new List<T>();
- ReadOnlyCollection<T> _snapshot;
-
- public void Add(T item)
- {
- lock (_list)
- {
- _list.Add(item);
- _snapshot = null;
- }
- }
-
- public void Clear()
- {
- lock (_list)
- {
- _list.Clear();
- _snapshot = null;
- }
- }
-
- public bool Contains(T item)
- {
- lock (_list)
- return _list.Contains(item);
- }
-
- public void CopyTo(T[] array, int arrayIndex)
- {
- lock (_list)
- _list.CopyTo(array, arrayIndex);
- }
-
- public int Count
- {
- get
- {
- lock (_list)
- return _list.Count;
- }
- }
-
- bool ICollection<T>.IsReadOnly
- {
- get { return false; }
- }
-
- public bool Remove(T item)
- {
- lock (_list)
- {
- if (_list.Remove(item))
- {
- _snapshot = null;
- return true;
- }
-
- return false;
- }
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
-
- public IEnumerator<T> GetEnumerator()
- {
- ReadOnlyCollection<T> snap = _snapshot;
- if (snap == null)
- {
- lock (_list)
- _snapshot = snap = new ReadOnlyCollection<T>(_list.ToList());
- }
-
- return snap?.GetEnumerator();
- }
-
- public int IndexOf(T item)
- {
- lock (_list)
- return _list.IndexOf(item);
- }
-
- public void Insert(int index, T item)
- {
- lock (_list)
- {
- _list.Insert(index, item);
- _snapshot = null;
- }
- }
-
- public T this[int index]
- {
- get
- {
- lock (_list)
- {
- ReadOnlyCollection<T> snap = _snapshot;
- if (snap != null)
- return snap[index];
-
- return _list[index];
- }
- }
-
- set
- {
- lock (_list)
- {
- _list[index] = value;
- _snapshot = null;
- }
- }
- }
-
- public void RemoveAt(int index)
- {
- lock (_list)
- {
- _list.RemoveAt(index);
- _snapshot = null;
- }
- }
- }
-}
+++ /dev/null
-namespace Tizen.NUI.Binding
-{
- internal enum TargetIdiom
- {
- Unsupported,
- Phone,
- Tablet,
- Desktop,
- TV,
- Watch
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Binding
-{
- [Obsolete]
- internal enum TargetPlatform
- {
- Other,
- iOS,
- Android,
- WinPhone,
- Windows
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Globalization;
-
-namespace Tizen.NUI.Binding
-{
- internal class TemplateBinding : BindingBase
- {
- internal const string SelfPath = ".";
- IValueConverter _converter;
- object _converterParameter;
-
- BindingExpression _expression;
- string _path;
-
- public TemplateBinding()
- {
- }
-
- public TemplateBinding(string path, BindingMode mode = BindingMode.Default, IValueConverter converter = null, object converterParameter = null, string stringFormat = null)
- {
- if (path == null)
- throw new ArgumentNullException("path");
- if (string.IsNullOrWhiteSpace(path))
- throw new ArgumentException("path can not be an empty string", "path");
-
- AllowChaining = true;
- Path = path;
- Converter = converter;
- ConverterParameter = converterParameter;
- Mode = mode;
- StringFormat = stringFormat;
- }
-
- public IValueConverter Converter
- {
- get { return _converter; }
- set
- {
- ThrowIfApplied();
-
- _converter = value;
- }
- }
-
- public object ConverterParameter
- {
- get { return _converterParameter; }
- set
- {
- ThrowIfApplied();
-
- _converterParameter = value;
- }
- }
-
- public string Path
- {
- get { return _path; }
- set
- {
- ThrowIfApplied();
-
- _path = value;
- _expression = GetBindingExpression(value);
- }
- }
-
- internal override void Apply(bool fromTarget)
- {
- base.Apply(fromTarget);
-
- if (_expression == null)
- _expression = new BindingExpression(this, SelfPath);
-
- _expression.Apply(fromTarget);
- }
-
- internal override async void Apply(object newContext, BindableObject bindObj, BindableProperty targetProperty, bool fromBindingContextChanged = false)
- {
- var view = bindObj as Element;
- if (view == null)
- throw new InvalidOperationException();
-
- base.Apply(newContext, bindObj, targetProperty, fromBindingContextChanged);
-
- Element templatedParent = await TemplateUtilities.FindTemplatedParentAsync(view);
- ApplyInner(templatedParent, bindObj, targetProperty);
- }
-
- internal override BindingBase Clone()
- {
- return new TemplateBinding(Path, Mode) { Converter = Converter, ConverterParameter = ConverterParameter, StringFormat = StringFormat };
- }
-
- internal override object GetSourceValue(object value, Type targetPropertyType)
- {
- if (Converter != null)
- value = Converter.Convert(value, targetPropertyType, ConverterParameter, CultureInfo.CurrentUICulture);
-
- return base.GetSourceValue(value, targetPropertyType);
- }
-
- internal override object GetTargetValue(object value, Type sourcePropertyType)
- {
- if (Converter != null)
- value = Converter.ConvertBack(value, sourcePropertyType, ConverterParameter, CultureInfo.CurrentUICulture);
-
- return base.GetTargetValue(value, sourcePropertyType);
- }
-
- internal override void Unapply(bool fromBindingContextChanged = false)
- {
- base.Unapply(fromBindingContextChanged: fromBindingContextChanged);
-
- if (_expression != null)
- _expression.Unapply();
- }
-
- void ApplyInner(Element templatedParent, BindableObject bindableObject, BindableProperty targetProperty)
- {
- if (_expression == null && templatedParent != null)
- _expression = new BindingExpression(this, SelfPath);
-
- _expression?.Apply(templatedParent, bindableObject, targetProperty);
- }
-
- BindingExpression GetBindingExpression(string path)
- {
- return new BindingExpression(this, !string.IsNullOrWhiteSpace(path) ? path : SelfPath);
- }
- }
-}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Threading.Tasks;
-using Tizen.NUI.BaseComponents;
-
-namespace Tizen.NUI.Binding
-{
- internal static class TemplateUtilities
- {
- public static async Task<Element> FindTemplatedParentAsync(Element element)
- {
- if (element.RealParent is Application)
- return null;
-
- element = await GetRealParentAsync(element);
- while (!Application.IsApplicationOrNull(element))
- {
- var controlTemplated = element as IControlTemplated;
- element = await GetRealParentAsync(element);
- }
-
- return null;
- }
-
- public static Task<Element> GetRealParentAsync(Element element)
- {
- Element parent = element.RealParent;
- if (parent is Application)
- return Task.FromResult<Element>(null);
-
- if (parent != null)
- return Task.FromResult(parent);
-
- var tcs = new TaskCompletionSource<Element>();
- EventHandler handler = null;
- handler = (sender, args) =>
- {
- tcs.TrySetResult(element.RealParent);
- element.ParentSet -= handler;
- };
- element.ParentSet += handler;
-
- return tcs.Task;
- }
-
- public static void OnContentChanged(BindableObject bindable, object oldValue, object newValue)
- {
- }
-
- public static void OnControlTemplateChanged(BindableObject bindable, object oldValue, object newValue)
- {
- var self = (IControlTemplated)bindable;
-
- // First make sure any old ContentPresenters are no longer bound up. This MUST be
- // done before we attempt to make the new template.
- if (oldValue != null)
- {
- var queue = new Queue<Element>(16);
- queue.Enqueue((Element)self);
-
- while (queue.Count > 0)
- {
- ReadOnlyCollection<Element> children = queue.Dequeue().LogicalChildrenInternal;
- for (var i = 0; i < children.Count; i++)
- {
- Element child = children[i];
- var controlTemplated = child as IControlTemplated;
- queue.Enqueue(child);
- }
- }
- }
-
- // Now remove all remnants of any other children just to be sure
- while (self.InternalChildren.Count > 0)
- {
- self.InternalChildren.RemoveAt(self.InternalChildren.Count - 1);
- }
- }
- }
-}
+++ /dev/null
-using System.Diagnostics;
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding
-{
- /// <summary>
- /// Struct defining thickness around the edges of a Rectangle using doubles.
- /// </summary>
- [DebuggerDisplay("Left={Left}, Top={Top}, Right={Right}, Bottom={Bottom}, HorizontalThickness={HorizontalThickness}, VerticalThickness={VerticalThickness}")]
- [TypeConverter(typeof(ThicknessTypeConverter))]
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal struct Thickness
- {
- /// <summary>
- /// The thickness of the left side of a rectangle.
- /// </summary>
- public double Left { get; set; }
-
- /// <summary>
- /// The thickness of the top of a rectangle.
- /// </summary>
- public double Top { get; set; }
-
- /// <summary>
- /// The thickness of the right side of a rectangle.
- /// </summary>
- public double Right { get; set; }
-
- /// <summary>
- /// The thickness of the bottom of a rectangle.
- /// </summary>
- public double Bottom { get; set; }
-
- /// <summary>
- /// The sum of Left and Right.
- /// </summary>
- public double HorizontalThickness
- {
- get { return Left + Right; }
- }
-
- /// <summary>
- /// The sum of Top and Bottom.
- /// </summary>
- public double VerticalThickness
- {
- get { return Top + Bottom; }
- }
-
- internal bool IsDefault
- {
- get { return Left == 0 && Top == 0 && Right == 0 && Bottom == 0; }
- }
-
- /// <summary>
- /// Creates a new Thickness object that represents a uniform thickness of size uniformSize.
- /// </summary>
- /// <param name="uniformSize">The uniform size of all edges in the new thickness.</param>
- public Thickness(double uniformSize) : this(uniformSize, uniformSize, uniformSize, uniformSize)
- {
- }
-
- /// <summary>
- /// Creates a new Thickness object that has a horizontal thickness of horizontalSize and a vertical thickness of verticalSize.
- /// </summary>
- /// <param name="horizontalSize">The width of the left and right thicknesses.</param>
- /// <param name="verticalSize">The height of the top and bottom thicknesses.</param>
- public Thickness(double horizontalSize, double verticalSize) : this(horizontalSize, verticalSize, horizontalSize, verticalSize)
- {
- }
-
- /// <summary>
- /// Creates a new Thickness object with thicknesses defined by left, top, right, and bottom.
- /// </summary>
- /// <param name="left">The width of the left thickness.</param>
- /// <param name="top">The height of the top thickness.</param>
- /// <param name="right">The width of the right thickness.</param>
- /// <param name="bottom">The height of the bottom thickness.</param>
- public Thickness(double left, double top, double right, double bottom) : this()
- {
- Left = left;
- Top = top;
- Right = right;
- Bottom = bottom;
- }
-
- /// <summary>
- /// Converts a Size into a Thickness.
- /// </summary>
- /// <param name="size">A Size to convert to a Thickness</param>
- public static implicit operator Thickness(Size size)
- {
- return new Thickness(size.Width, size.Height, size.Width, size.Height);
- }
-
- /// <summary>
- /// Implicit cast operator from Double.
- /// </summary>
- /// <param name="uniformSize">The value for the uniform Thickness.</param>
- public static implicit operator Thickness(double uniformSize)
- {
- return new Thickness(uniformSize);
- }
-
- /// <summary>
- /// Whether the other has equivalent values.
- /// </summary>
- /// <param name="other">A Thickness to be compared.</param>
- /// <returns>true if other has equivalent values.</returns>
- bool Equals(Thickness other)
- {
- return Left.Equals(other.Left) && Top.Equals(other.Top) && Right.Equals(other.Right) && Bottom.Equals(other.Bottom);
- }
-
- /// <summary>
- /// Whether the obj has equivalent values.
- /// </summary>
- /// <param name="obj">A Thickness to be compared.</param>
- /// <returns>true if obj is a Thickness and has equivalent values.</returns>
- public override bool Equals(object obj)
- {
- if (ReferenceEquals(null, obj))
- return false;
- return obj is Thickness && Equals((Thickness)obj);
- }
-
- /// <summary>
- /// A hash value for this Thickness.
- /// </summary>
- /// <returns>The hash value</returns>
- public override int GetHashCode()
- {
- unchecked
- {
- int hashCode = Left.GetHashCode();
- hashCode = (hashCode * 397) ^ Top.GetHashCode();
- hashCode = (hashCode * 397) ^ Right.GetHashCode();
- hashCode = (hashCode * 397) ^ Bottom.GetHashCode();
- return hashCode;
- }
- }
-
- /// <summary>
- /// Whether two Thicknesses have identical values.
- /// </summary>
- /// <param name="left">A Thickness to be compared.</param>
- /// <param name="right">A Thickness to be compared.</param>
- /// <returns>true if left and right have identical values for Left,Right, Top, and Bottom.</returns>
- public static bool operator ==(Thickness left, Thickness right)
- {
- return left.Equals(right);
- }
-
- /// <summary>
- /// Whether the values of two Thickness's have at least one difference.
- /// </summary>
- /// <param name="left">A Thickness to be compared.</param>
- /// <param name="right">A Thickness to be compared.</param>
- /// <returns>true if any of the Left,Right, Top, and Bottom values differ between left and right.</returns>
- public static bool operator !=(Thickness left, Thickness right)
- {
- return !left.Equals(right);
- }
-
- /// <summary>
- /// Stores the components of the thickness in the corresponding arguments.
- /// </summary>
- /// <param name="left">Variable in which to store the left thickness of thickness object.</param>
- /// <param name="top">Variable in which to store the top thickness of thickness object.</param>
- /// <param name="right">Variable in which to store the right thickness of thickness object.</param>
- /// <param name="bottom">Variable in which to store the bottom thickness of thickness object.</param>
- public void Deconstruct(out double left, out double top, out double right, out double bottom)
- {
- left = Left;
- top = Top;
- right = Right;
- bottom = Bottom;
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Globalization;
-
-namespace Tizen.NUI.Binding
-{
- [Xaml.ProvideCompiled("Tizen.NUI.Xaml.Core.XamlC.ThicknessTypeConverter")]
- [Xaml.TypeConversion(typeof(Thickness))]
- internal class ThicknessTypeConverter : TypeConverter
- {
- public override object ConvertFromInvariantString(string value)
- {
- if (value != null) {
- value = value.Trim();
- if (value.Contains(",")) { //Xaml
- var thickness = value.Split(',');
- switch (thickness.Length) {
- case 2:
- if ( double.TryParse(thickness[0], NumberStyles.Number, CultureInfo.InvariantCulture, out double h)
- && double.TryParse(thickness[1], NumberStyles.Number, CultureInfo.InvariantCulture, out double v))
- return new Thickness(h, v);
- break;
- case 4:
- if ( double.TryParse(thickness[0], NumberStyles.Number, CultureInfo.InvariantCulture, out double l)
- && double.TryParse(thickness[1], NumberStyles.Number, CultureInfo.InvariantCulture, out double t)
- && double.TryParse(thickness[2], NumberStyles.Number, CultureInfo.InvariantCulture, out double r)
- && double.TryParse(thickness[3], NumberStyles.Number, CultureInfo.InvariantCulture, out double b))
- return new Thickness(l, t, r, b);
- break;
- }
- }
- else if (value.Contains(" ")) { //CSS
- var thickness = value.Split(' ');
- switch (thickness.Length) {
- case 2:
- if ( double.TryParse(thickness[0], NumberStyles.Number, CultureInfo.InvariantCulture, out double v)
- && double.TryParse(thickness[1], NumberStyles.Number, CultureInfo.InvariantCulture, out double h))
- return new Thickness(h, v);
- break;
- case 3:
- if ( double.TryParse(thickness[0], NumberStyles.Number, CultureInfo.InvariantCulture, out double t)
- && double.TryParse(thickness[1], NumberStyles.Number, CultureInfo.InvariantCulture, out h)
- && double.TryParse(thickness[2], NumberStyles.Number, CultureInfo.InvariantCulture, out double b))
- return new Thickness(h, t, h, b);
- break;
- case 4:
- if ( double.TryParse(thickness[0], NumberStyles.Number, CultureInfo.InvariantCulture, out t)
- && double.TryParse(thickness[1], NumberStyles.Number, CultureInfo.InvariantCulture, out double r)
- && double.TryParse(thickness[2], NumberStyles.Number, CultureInfo.InvariantCulture, out b)
- && double.TryParse(thickness[3], NumberStyles.Number, CultureInfo.InvariantCulture, out double l))
- return new Thickness(l, t, r, b);
- break;
- }
- }
- else { //single uniform thickness
- if (double.TryParse(value, NumberStyles.Number, CultureInfo.InvariantCulture, out double l))
- return new Thickness(l);
- }
- }
-
- throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(Thickness)}");
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-// using ElmSharp;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Net.Http;
-using System.Reflection;
-using System.Security.Cryptography;
-using System.Threading;
-using System.Threading.Tasks;
-using Tizen.NUI.Binding.Internals;
-// using TAppControl = Tizen.Applications.AppControl;
-
-namespace Tizen.NUI.Binding
-{
- internal class TizenPlatformServices : IPlatformServices
- {
- static MD5 checksum = MD5.Create();
-
- static SynchronizationContext s_context;
-
- public TizenPlatformServices()
- {
- s_context = SynchronizationContext.Current;
- }
-
- public class TizenTicker : Ticker
- {
- readonly System.Threading.Timer _timer;
-
- public TizenTicker()
- {
- _timer = new System.Threading.Timer((object o) => HandleElapsed(o), this, Timeout.Infinite, Timeout.Infinite);
- }
-
- protected override void EnableTimer()
- {
- _timer.Change(16, 16);
- }
-
- protected override void DisableTimer()
- {
- _timer.Change(-1, -1);
- }
-
- void HandleElapsed(object state)
- {
- s_context.Post((o) => SendSignals(-1), null);
- }
- }
- #region IPlatformServices implementation
-
- // public double GetNamedSize(NamedSize size, Type targetElementType, bool useOldSizes)
- // {
- // int pt;
- // // Actual font size depends on the target idiom.
- // switch (size)
- // {
- // case NamedSize.Micro:
- // pt = Device.Idiom == TargetIdiom.TV || Device.Idiom == TargetIdiom.Watch ? 24 : 19;
- // break;
- // case NamedSize.Small:
- // pt = Device.Idiom == TargetIdiom.TV ? 26 : (Device.Idiom == TargetIdiom.Watch ? 30 : 22);
- // break;
- // case NamedSize.Default:
- // case NamedSize.Medium:
- // pt = Device.Idiom == TargetIdiom.TV ? 28 : (Device.Idiom == TargetIdiom.Watch ? 32 : 25);
- // break;
- // case NamedSize.Large:
- // pt = Device.Idiom == TargetIdiom.TV ? 84 : (Device.Idiom == TargetIdiom.Watch ? 36 : 31);
- // break;
- // default:
- // throw new ArgumentOutOfRangeException();
- // }
- // return Forms.ConvertToDPFont(pt);
- // }
-
- // public void OpenUriAction(Uri uri)
- // {
- // if (uri == null || uri.AbsoluteUri == null)
- // {
- // throw new ArgumentNullException(nameof(uri));
- // }
- // TAppControl tAppControl = new TAppControl() { Operation = "%", Uri = uri.AbsoluteUri };
- // var matchedApplications = TAppControl.GetMatchedApplicationIds(tAppControl);
- // if (matchedApplications.Count() > 0)
- // {
- // TAppControl.SendLaunchRequest(tAppControl);
- // return;
- // }
- // throw new PlatformNotSupportedException();
- // }
-
- public void BeginInvokeOnMainThread(Action action)
- {
- s_context.Post((o) => action(), null);
- }
-
- public Ticker CreateTicker()
- {
- return new TizenTicker();
- }
-
- public void StartTimer(TimeSpan interval, Func<bool> callback)
- {
- Console.WriteLine("TizenPlatformServices StartTimer ...");
- System.Threading.Timer timer = null;
- bool invoking = false;
- TimerCallback onTimeout = o =>
- {
- if (!invoking)
- {
- invoking = true;
- BeginInvokeOnMainThread(() =>
- {
- if (!callback())
- {
- timer.Dispose();
- }
- invoking = false;
- }
- );
- }
- };
- timer = new System.Threading.Timer(onTimeout, null, Timeout.Infinite, Timeout.Infinite);
- // set interval separarately to prevent calling onTimeout before `timer' is assigned
- timer.Change(interval, interval);
- }
-
- public async Task<Stream> GetStreamAsync(Uri uri, CancellationToken cancellationToken)
- {
- using (var client = new HttpClient())
- using (HttpResponseMessage response = await client.GetAsync(uri, cancellationToken))
- return await response.Content.ReadAsStreamAsync();
- }
-
- public Assembly[] GetAssemblies()
- {
- return AppDomain.CurrentDomain.GetAssemblies();
- }
-
- // public IIsolatedStorageFile GetUserStoreForApplication()
- // {
- // return new TizenIsolatedStorageFile();
- // }
-
- static readonly char[] HexDigits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
- public string GetMD5Hash(string input)
- {
- byte[] bin = checksum.ComputeHash(System.Text.Encoding.UTF8.GetBytes(input));
- char[] hex = new char[32];
- for (var i = 0; i < 16; ++i)
- {
- hex[2 * i] = HexDigits[bin[i] >> 4];
- hex[2 * i + 1] = HexDigits[bin[i] & 0xf];
- }
- return new string(hex);
- }
-
- public void QuitApplication()
- {
- // Forms.Context.Exit();
- Console.WriteLine("!!!!!!!!!!!! Exit !!!!!!!!!!!!!!");
- }
-
- public bool IsInvokeRequired
- {
- get
- {
- // return !EcoreMainloop.IsMainThread;
- return true;
- }
- }
-
- public string RuntimePlatform => Device.Tizen;
-
- #endregion
-
- // In .NETCore, AppDomain is not supported. The list of the assemblies should be generated manually.
- internal class AppDomain
- {
- public static AppDomain CurrentDomain { get; private set; }
-
- List<Assembly> _assemblies;
-
- public static bool IsTizenSpecificAvailable { get; private set; }
-
- static AppDomain()
- {
- CurrentDomain = new AppDomain();
- }
-
- AppDomain()
- {
- _assemblies = new List<Assembly>();
-
- // Add this renderer assembly to the list
- _assemblies.Add(GetType().GetTypeInfo().Assembly);
- }
-
- internal void RegisterAssemblyRecursively(Assembly asm)
- {
- if (_assemblies.Contains(asm))
- return;
-
- _assemblies.Add(asm);
-
- foreach (var refName in asm.GetReferencedAssemblies())
- {
- if (!refName.Name.StartsWith("System.") && !refName.Name.StartsWith("Microsoft.") && !refName.Name.StartsWith("mscorlib"))
- {
- try
- {
- Assembly refAsm = Assembly.Load(refName);
- if (refAsm != null)
- {
- RegisterAssemblyRecursively(refAsm);
- if (refName.Name == "Tizen.NUI.Xaml.Core")
- {
- if (refAsm.GetType("Tizen.NUI.Xaml.PlatformConfiguration.TizenSpecific.VisualElement") != null)
- {
- IsTizenSpecificAvailable = true;
- }
- }
- }
- }
- catch
- {
- Log.Warn("Reference Assembly can not be loaded. {0}", refName.FullName);
- }
- }
- }
- }
-
- public Assembly[] GetAssemblies()
- {
- return _assemblies.ToArray();
- }
- }
- }
-}
-
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Binding
-{
- internal class ToolbarItem : MenuItem
- {
- static readonly BindableProperty OrderProperty = BindableProperty.Create("Order", typeof(ToolbarItemOrder), typeof(ToolbarItem), ToolbarItemOrder.Default, validateValue: (bo, o) =>
- {
- var order = (ToolbarItemOrder)o;
- return order == ToolbarItemOrder.Default || order == ToolbarItemOrder.Primary || order == ToolbarItemOrder.Secondary;
- });
-
- static readonly BindableProperty PriorityProperty = BindableProperty.Create("Priority", typeof(int), typeof(ToolbarItem), 0);
-
- public ToolbarItem()
- {
- }
-
- public ToolbarItem(string name, string icon, Action activated, ToolbarItemOrder order = ToolbarItemOrder.Default, int priority = 0)
- {
- if (activated == null)
- throw new ArgumentNullException("activated");
-
- Text = name;
- Icon = icon;
- Clicked += (s, e) => activated();
- Order = order;
- Priority = priority;
- }
-
- [Obsolete("Name is obsolete as of version 1.3.0. Please use Text instead.")]
- public string Name
- {
- get { return Text; }
- set { Text = value; }
- }
-
- public ToolbarItemOrder Order
- {
- get { return (ToolbarItemOrder)GetValue(OrderProperty); }
- set { SetValue(OrderProperty, value); }
- }
-
- public int Priority
- {
- get { return (int)GetValue(PriorityProperty); }
- set { SetValue(PriorityProperty, value); }
- }
-
- [Obsolete("Activated is obsolete as of version 1.3.0. Please use Clicked instead.")]
- public event EventHandler Activated
- {
- add { Clicked += value; }
- remove { Clicked -= value; }
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Binding
-{
- internal class ToolbarItemEventArgs : EventArgs
- {
- public ToolbarItemEventArgs(ToolbarItem item)
- {
- ToolbarItem = item;
- }
-
- public ToolbarItem ToolbarItem { get; private set; }
- }
-}
\ No newline at end of file
+++ /dev/null
-namespace Tizen.NUI.Binding
-{
- internal enum ToolbarItemOrder
- {
- Default,
- Primary,
- Secondary
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.ObjectModel;
-
-namespace Tizen.NUI.Binding
-{
- internal class TrackableCollection<T> : ObservableCollection<T>
- {
- public event EventHandler Clearing;
-
- protected override void ClearItems()
- {
- Clearing?.Invoke(this, EventArgs.Empty);
- base.ClearItems();
- }
- }
-}
+++ /dev/null
-using System;
-using System.Globalization;
-
-namespace Tizen.NUI.Binding
-{
- internal abstract class TypeConverter
- {
- public virtual bool CanConvertFrom(Type sourceType)
- {
- if (sourceType == null)
- throw new ArgumentNullException(nameof(sourceType));
-
- return sourceType == typeof(string);
- }
-
- [Obsolete("ConvertFrom is obsolete as of version 2.2.0. Please use ConvertFromInvariantString (string) instead.")]
- public virtual object ConvertFrom(object o)
- {
- return null;
- }
-
- [Obsolete("ConvertFrom is obsolete as of version 2.2.0. Please use ConvertFromInvariantString (string) instead.")]
- public virtual object ConvertFrom(CultureInfo culture, object o)
- {
- return null;
- }
-
- public virtual object ConvertFromInvariantString(string value)
- {
-#pragma warning disable 0618 // retain until ConvertFrom removed
- return ConvertFrom(CultureInfo.InvariantCulture, value);
-#pragma warning restore
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-//
-// System.ComponentModel.TypeConverterAttribute
-//
-// Authors:
-// Gonzalo Paniagua Javier (gonzalo@ximian.com)
-// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//
-// (C) 2002 Ximian, Inc (http://www.ximian.com)
-// (C) 2003 Andreas Nahr
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Tizen.NUI.Binding
-{
- [AttributeUsage(AttributeTargets.All)]
- internal sealed class TypeConverterAttribute : Attribute
- {
- internal static string[] TypeConvertersType = { "Tizen.NUI.Binding.TypeConverterAttribute", "System.ComponentModel.TypeConverterAttribute" };
-
- public static readonly TypeConverterAttribute Default = new TypeConverterAttribute();
-
- public TypeConverterAttribute()
- {
- ConverterTypeName = "";
- }
-
- public TypeConverterAttribute(string typeName)
- {
- ConverterTypeName = typeName;
- }
-
- public TypeConverterAttribute(Type type)
- {
- ConverterTypeName = type.AssemblyQualifiedName;
- }
-
- public string ConverterTypeName { get; }
-
- public override bool Equals(object obj)
- {
- if (!(obj is TypeConverterAttribute))
- return false;
-
- return ((TypeConverterAttribute)obj).ConverterTypeName == ConverterTypeName;
- }
-
- public override int GetHashCode()
- {
- return ConverterTypeName.GetHashCode();
- }
- }
-}
+++ /dev/null
-using System;
-using System.Globalization;
-using Tizen.NUI.Xaml;
-
-namespace Tizen.NUI.Binding
-{
- [Xaml.ProvideCompiled("Tizen.NUI.Xaml.Core.XamlC.TypeTypeConverter")]
- [Xaml.TypeConversion(typeof(Type))]
- internal sealed class TypeTypeConverter : TypeConverter, IExtendedTypeConverter
- {
- [Obsolete("IExtendedTypeConverter.ConvertFrom is obsolete as of version 2.2.0. Please use ConvertFromInvariantString (string, IServiceProvider) instead.")]
- object IExtendedTypeConverter.ConvertFrom(CultureInfo culture, object value, IServiceProvider serviceProvider)
- {
- return ((IExtendedTypeConverter)this).ConvertFromInvariantString((string)value, serviceProvider);
- }
-
- object IExtendedTypeConverter.ConvertFromInvariantString(string value, IServiceProvider serviceProvider)
- {
- if (serviceProvider == null)
- throw new ArgumentNullException("serviceProvider");
- var typeResolver = serviceProvider.GetService(typeof(IXamlTypeResolver)) as IXamlTypeResolver;
- if (typeResolver == null)
- throw new ArgumentException("No IXamlTypeResolver in IServiceProvider");
-
- return typeResolver.Resolve(value, serviceProvider);
- }
-
- public override object ConvertFromInvariantString(string value)
- {
- throw new NotImplementedException();
- }
- }
-}
+++ /dev/null
-using System;
-
-namespace Tizen.NUI.Binding
-{
- [Xaml.ProvideCompiled("Tizen.NUI.Core.XamlC.UriTypeConverter")]
- [Xaml.TypeConversion(typeof(Uri))]
- internal class UriTypeConverter : TypeConverter
- {
- public override object ConvertFromInvariantString(string value)
- {
- if (string.IsNullOrWhiteSpace(value))
- return null;
- return new Uri(value, UriKind.RelativeOrAbsolute);
- }
-
- bool CanConvert(Type type)
- {
- if (type == typeof(string))
- return true;
- if (type == typeof(Uri))
- return true;
-
- return false;
- }
- }
-}
+++ /dev/null
-using System;
-using System.Linq;
-using System.Reflection;
-using System.Globalization;
-
-using Tizen.NUI;
-
-namespace Tizen.NUI.Binding
-{
- internal class Vector2TypeConverter : TypeConverter
- {
- public override object ConvertFromInvariantString(string value)
- {
- if (value != null)
- {
- string[] parts = value.Split(',');
- if (parts.Length == 2 )
- {
- return new Vector2(Single.Parse(parts[0].Trim(), CultureInfo.InvariantCulture),
- Single.Parse(parts[1].Trim(), CultureInfo.InvariantCulture));
- }
- }
-
- throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(Vector2)}");
- }
- }
-
- internal class Vector3TypeConverter : TypeConverter
- {
- public override object ConvertFromInvariantString(string value)
- {
- if (value != null)
- {
- string[] parts = value.Split(',');
- if (parts.Length == 3 )
- {
- return new Vector3(Single.Parse(parts[0].Trim(), CultureInfo.InvariantCulture),
- Single.Parse(parts[1].Trim(), CultureInfo.InvariantCulture),
- Single.Parse(parts[2].Trim(), CultureInfo.InvariantCulture));
- }
- }
-
- throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(Vector3)}");
- }
- }
-
- internal class Vector4TypeConverter : TypeConverter
- {
- public override object ConvertFromInvariantString(string value)
- {
- if (value != null)
- {
- string[] parts = value.Split(',');
- if (parts.Length == 4 )
- {
- return new Vector4(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));
- }
- }
-
- throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(Vector4)}");
- }
- }
-
- internal class RelativeVector2TypeConverter : TypeConverter
- {
- public override object ConvertFromInvariantString(string value)
- {
- if (value != null)
- {
- string[] parts = value.Split(',');
- if (parts.Length == 2 )
- {
- return new RelativeVector2(Single.Parse(parts[0].Trim(), CultureInfo.InvariantCulture),
- Single.Parse(parts[1].Trim(), CultureInfo.InvariantCulture));
- }
- }
-
- throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(RelativeVector2)}");
- }
- }
-
- internal class RelativeVector3TypeConverter : TypeConverter
- {
- public override object ConvertFromInvariantString(string value)
- {
- if (value != null)
- {
- string[] parts = value.Split(',');
- if (parts.Length == 3 )
- {
- return new RelativeVector3(Single.Parse(parts[0].Trim(), CultureInfo.InvariantCulture),
- Single.Parse(parts[1].Trim(), CultureInfo.InvariantCulture),
- Single.Parse(parts[2].Trim(), CultureInfo.InvariantCulture));
- }
- }
-
- throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(RelativeVector3)}");
- }
- }
-
- internal class RelativeVector4TypeConverter : TypeConverter
- {
- public override object ConvertFromInvariantString(string value)
- {
- if (value != null)
- {
- string[] parts = value.Split(',');
- if (parts.Length == 4 )
- {
- return new RelativeVector4(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));
- }
- }
-
- throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(RelativeVector4)}");
- }
- }
-}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-using static System.String;
-
-namespace Tizen.NUI.Binding
-{
- internal class WeakEventManager
- {
- readonly Dictionary<string, List<Subscription>> _eventHandlers =
- new Dictionary<string, List<Subscription>>();
-
- public void AddEventHandler<TEventArgs>(string eventName, EventHandler<TEventArgs> handler)
- where TEventArgs : EventArgs
- {
- if (IsNullOrEmpty(eventName))
- {
- throw new ArgumentNullException(nameof(eventName));
- }
-
- if (handler == null)
- {
- throw new ArgumentNullException(nameof(handler));
- }
-
- AddEventHandler(eventName, handler.Target, handler.GetMethodInfo());
- }
-
- public void AddEventHandler(string eventName, EventHandler handler)
- {
- if (IsNullOrEmpty(eventName))
- {
- throw new ArgumentNullException(nameof(eventName));
- }
-
- if (handler == null)
- {
- throw new ArgumentNullException(nameof(handler));
- }
-
- AddEventHandler(eventName, handler.Target, handler.GetMethodInfo());
- }
-
- public void HandleEvent(object sender, object args, string eventName)
- {
- var toRaise = new List<Tuple<object, MethodInfo>>();
- var toRemove = new List<Subscription>();
-
- List<Subscription> target;
- if (_eventHandlers.TryGetValue(eventName, out target))
- {
- foreach (Subscription subscription in target)
- {
- bool isStatic = subscription.Subscriber == null;
- if (isStatic)
- {
- // For a static method, we'll just pass null as the first parameter of MethodInfo.Invoke
- toRaise.Add(Tuple.Create<object, MethodInfo>(null, subscription.Handler));
- continue;
- }
-
- object subscriber = subscription.Subscriber.Target;
-
- if (subscriber == null)
- {
- // The subscriber was collected, so there's no need to keep this subscription around
- toRemove.Add(subscription);
- }
- else
- {
- toRaise.Add(Tuple.Create(subscriber, subscription.Handler));
- }
- }
-
- foreach (Subscription subscription in toRemove)
- {
- target.Remove(subscription);
- }
- }
-
- foreach (Tuple<object, MethodInfo> tuple in toRaise)
- {
- tuple.Item2.Invoke(tuple.Item1, new[] { sender, args });
- }
- }
-
- public void RemoveEventHandler<TEventArgs>(string eventName, EventHandler<TEventArgs> handler)
- where TEventArgs : EventArgs
- {
- if (IsNullOrEmpty(eventName))
- {
- throw new ArgumentNullException(nameof(eventName));
- }
-
- if (handler == null)
- {
- throw new ArgumentNullException(nameof(handler));
- }
-
- RemoveEventHandler(eventName, handler.Target, handler.GetMethodInfo());
- }
-
- public void RemoveEventHandler(string eventName, EventHandler handler)
- {
- if (IsNullOrEmpty(eventName))
- {
- throw new ArgumentNullException(nameof(eventName));
- }
-
- if (handler == null)
- {
- throw new ArgumentNullException(nameof(handler));
- }
-
- RemoveEventHandler(eventName, handler.Target, handler.GetMethodInfo());
- }
-
- void AddEventHandler(string eventName, object handlerTarget, MethodInfo methodInfo)
- {
- List<Subscription> targets;
- if (!_eventHandlers.TryGetValue(eventName, out targets))
- {
- targets = new List<Subscription>();
- _eventHandlers.Add(eventName, targets);
- }
-
- if (handlerTarget == null)
- {
- // This event handler is a static method
- targets.Add(new Subscription(null, methodInfo));
- return;
- }
-
- targets.Add(new Subscription(new WeakReference(handlerTarget), methodInfo));
- }
-
- void RemoveEventHandler(string eventName, object handlerTarget, MemberInfo methodInfo)
- {
- List<Subscription> subscriptions;
- if (!_eventHandlers.TryGetValue(eventName, out subscriptions))
- {
- return;
- }
-
- for (int n = subscriptions.Count; n > 0; n--)
- {
- Subscription current = subscriptions[n - 1];
-
- if (current.Subscriber != handlerTarget
- || current.Handler.Name != methodInfo.Name)
- {
- continue;
- }
-
- subscriptions.Remove(current);
- }
- }
-
- struct Subscription
- {
- public Subscription(WeakReference subscriber, MethodInfo handler)
- {
- if (handler == null)
- {
- throw new ArgumentNullException(nameof(handler));
- }
-
- Subscriber = subscriber;
- Handler = handler;
- }
-
- public readonly WeakReference Subscriber;
- public readonly MethodInfo Handler;
- }
- }
-}
\ No newline at end of file
using System.Linq;
using System.Reflection;
using System.Xml;
- using Tizen.NUI.Binding.Internals;
- using Tizen.NUI.Binding;
using System.Globalization;
- using Tizen.NUI.Xaml.Internals;
/// <summary>
/// Animation can be used to animate the properties of any number of objects, typically view.<br />
private AnimationProgressReachedEventCallbackType _animationProgressReachedEventCallback;
- private string[] _properties = null;
- private string[] _destValue = null;
- private int[] _startTime = null;
- private int[] _endTime = null;
-
/// <summary>
/// Creates an initialized animation.<br />
/// The animation will not loop.<br />
/// <summary>
/// Gets or sets the properties of the animation.
/// </summary>
+ /// Deprecated. Do not use.
public string[] Properties
{
- get
- {
- return _properties;
- }
- set
- {
- _properties = value;
- }
+ get;
+ set;
}
/// <summary>
/// Gets or sets the destination value for each property of the animation.
/// </summary>
+ /// Deprecated. Do not use.
public string[] DestValue
{
- get
- {
- return _destValue;
- }
- set
- {
- _destValue = value;
- }
+ get;
+ set;
}
/// <summary>
/// Gets or sets the start time for each property of the animation.
/// </summary>
+ /// Deprecated. Do not use.
public int[] StartTime
{
- get
- {
- return _startTime;
- }
- set
- {
- _startTime = value;
- }
+ get;
+ set;
}
/// <summary>
/// Gets or sets the end time for each property of the animation.
/// </summary>
+ /// Deprecated. Do not use.
public int[] EndTime
{
- get
- {
- return _endTime;
- }
- set
- {
- _endTime = value;
- }
+ get;
+ set;
}
private bool DisableAnimation
/// Animates one or more properties to a destination value.<br />
/// </summary>
/// <param name="target">The target object to animate.</param>
+ /// Deprecated. Do not use.
public void PlayAnimateTo(View target)
{
- Clear();
- if (_properties.Length == _destValue.Length && _startTime.Length == _endTime.Length && _properties.Length == _startTime.Length)
- {
- int length = _properties.Length;
- for (int index = 0; index < length; index++)
- {
- //object destinationValue = _destValue[index];
- var elementType = target.GetType();
- PropertyInfo propertyInfo = elementType.GetProperties().FirstOrDefault(fi => fi.Name == _properties[index]);
- //var propertyInfo = elementType.GetRuntimeProperties().FirstOrDefault(p => p.Name == localName);
- if (propertyInfo != null)
- {
- object destinationValue = ConvertTo(_destValue[index], propertyInfo.PropertyType);
-
- if (destinationValue != null)
- {
- AnimateTo(target, _properties[index], destinationValue, _startTime[index], _endTime[index]);
- }
- }
- }
- Play();
- }
}
/// <summary>
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
- internal object ConvertTo(object value, Type toType)
- {
- Func<object> getConverter = () =>
- {
- string converterTypeName = GetTypeConverterTypeName(toType.GetTypeInfo().CustomAttributes);
- if (converterTypeName == null)
- return null;
-
- Type convertertype = Type.GetType(converterTypeName);
- return Activator.CreateInstance(convertertype);
- };
-
- return ConvertTo(value, toType, getConverter);
- }
-
- internal object ConvertTo(object value, Type toType, Func<object> getConverter)
- {
- if (value == null)
- return null;
-
- var str = value as string;
- if (str != null)
- {
- //If there's a [TypeConverter], use it
- object converter = getConverter?.Invoke();
- var xfTypeConverter = converter as Tizen.NUI.Binding.TypeConverter;
- 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 });
- }
-
- //If the type is nullable, as the value is not null, it's safe to assume we want the built-in conversion
- if (toType.GetTypeInfo().IsGenericType && toType.GetGenericTypeDefinition() == typeof(Nullable<>))
- toType = Nullable.GetUnderlyingType(toType);
-
- //Obvious Built-in conversions
- if (toType.GetTypeInfo().IsEnum)
- return Enum.Parse(toType, str, true);
- if (toType == typeof(SByte))
- return SByte.Parse(str, CultureInfo.InvariantCulture);
- if (toType == typeof(Int16))
- return Int16.Parse(str, CultureInfo.InvariantCulture);
- if (toType == typeof(Int32))
- return Int32.Parse(str, CultureInfo.InvariantCulture);
- if (toType == typeof(Int64))
- return Int64.Parse(str, CultureInfo.InvariantCulture);
- if (toType == typeof(Byte))
- return Byte.Parse(str, CultureInfo.InvariantCulture);
- if (toType == typeof(UInt16))
- return UInt16.Parse(str, CultureInfo.InvariantCulture);
- if (toType == typeof(UInt32))
- return UInt32.Parse(str, CultureInfo.InvariantCulture);
- if (toType == typeof(UInt64))
- return UInt64.Parse(str, CultureInfo.InvariantCulture);
- if (toType == typeof(Single))
- return Single.Parse(str, CultureInfo.InvariantCulture);
- if (toType == typeof(Double))
- return Double.Parse(str, CultureInfo.InvariantCulture);
- if (toType == typeof(Boolean))
- return Boolean.Parse(str);
- if (toType == typeof(TimeSpan))
- return TimeSpan.Parse(str, CultureInfo.InvariantCulture);
- if (toType == typeof(DateTime))
- return DateTime.Parse(str, CultureInfo.InvariantCulture);
- if (toType == typeof(Char))
- {
- char c = '\0';
- Char.TryParse(str, out c);
- return c;
- }
- if (toType == typeof(String) && str.StartsWith("{}", StringComparison.Ordinal))
- return str.Substring(2);
- if (toType == typeof(String))
- return value;
- if (toType == typeof(Decimal))
- return Decimal.Parse(str, CultureInfo.InvariantCulture);
- }
-
- //if the value is not assignable and there's an implicit conversion, convert
- if (value != null && !toType.IsAssignableFrom(value.GetType()))
- {
- var opImplicit = GetImplicitConversionOperator(value.GetType(), value.GetType(), toType)
- ?? GetImplicitConversionOperator(toType, value.GetType(), toType);
- //var opImplicit = value.GetType().GetImplicitConversionOperator(fromType: value.GetType(), toType: toType)
- // ?? toType.GetImplicitConversionOperator(fromType: value.GetType(), toType: toType);
-
- if (opImplicit != null)
- {
- value = opImplicit.Invoke(null, new[] { value });
- return value;
- }
- }
-
- var nativeValueConverterService = DependencyService.Get<INativeValueConverterService>();
-
- object nativeValue = null;
- if (nativeValueConverterService != null && nativeValueConverterService.ConvertTo(value, toType, out nativeValue))
- return nativeValue;
-
- return value;
- }
-
- internal string GetTypeConverterTypeName(IEnumerable<CustomAttributeData> attributes)
- {
- var converterAttribute =
- attributes.FirstOrDefault(cad => Tizen.NUI.Binding.TypeConverterAttribute.TypeConvertersType.Contains(cad.AttributeType.FullName));
- if (converterAttribute == null)
- return null;
- if (converterAttribute.ConstructorArguments[0].ArgumentType == typeof(string))
- return (string)converterAttribute.ConstructorArguments[0].Value;
- if (converterAttribute.ConstructorArguments[0].ArgumentType == typeof(Type))
- return ((Type)converterAttribute.ConstructorArguments[0].Value).AssemblyQualifiedName;
- return null;
- }
-
- internal MethodInfo GetImplicitConversionOperator(Type onType, Type fromType, Type toType)
- {
-#if NETSTANDARD1_0
- var mi = onType.GetRuntimeMethod("op_Implicit", new[] { fromType });
-#else
- var bindingFlags = BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy;
- var mi = onType.GetMethod("op_Implicit", bindingFlags, null, new[] { fromType }, null);
-#endif
- if (mi == null) return null;
- if (!mi.IsSpecialName) return null;
- if (!mi.IsPublic) return null;
- if (!mi.IsStatic) return null;
- if (!toType.IsAssignableFrom(mi.ReturnType)) return null;
-
- return mi;
- }
-
- internal Animation(float durationSeconds) : this(Interop.Animation.Animation_New(durationSeconds), true)
- {
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-
- }
-
- internal Animation(Animation handle) : this(Interop.Animation.new_Animation__SWIG_1(Animation.getCPtr(handle)), true)
- {
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- }
-
- internal Animation Assign(Animation rhs)
- {
- Animation ret = new Animation(Interop.Animation.Animation_Assign(swigCPtr, Animation.getCPtr(rhs)), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
internal void SetDuration(float seconds)
{
Interop.Animation.Animation_SetDuration(swigCPtr, seconds);
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();
}
if (newValue != null)
{
PropertyMap map = (PropertyMap)newValue;
- if (imageView.IsCreateByXaml)
- {
- 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);
- }
+
if (imageView._border == null)
{
imageView._image = map;
}
}
-
/// <summary>
/// Adds a child to the table.<br />
/// If the row or column index is outside the table, the table gets resized bigger.<br />
}
set
{
- SetValueAndForceSendChangeSignal(TextProperty, value);
+ SetValue(TextProperty, value);
NotifyPropertyChanged();
}
}
}
}
- internal override bool IsCreateByXaml
- {
- get
- {
- return base.IsCreateByXaml;
- }
- set
- {
- base.IsCreateByXaml = value;
-
- if (value == true)
- {
- this.TextChanged += (obj, e) =>
- {
- this.Text = this.Text;
- };
- }
- }
- }
-
/// <summary>
/// Get the InputMethodContext instance.
/// </summary>
}
set
{
- SetValueAndForceSendChangeSignal(TextProperty, value);
+ SetValue(TextProperty, value);
NotifyPropertyChanged();
}
}
}
}
- internal override bool IsCreateByXaml
- {
- get
- {
- return base.IsCreateByXaml;
- }
- set
- {
- base.IsCreateByXaml = value;
-
- if (value == true)
- {
- this.TextChanged += (obj, e) =>
- {
- this.Text = this.Text;
- };
- }
- }
- }
-
/// <summary>
/// Get the InputMethodContext instance.
/// </summary>
/// <summary>
/// Invoked whenever the binding context of the textlabel changes. Implement this method to add class handling for this event.
/// </summary>
- protected override void OnBindingContextChanged()
+ /// Deprecated. Do not use.
+ protected void OnBindingContextChanged()
{
- base.OnBindingContextChanged();
+
}
private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
using System.IO;
using System.Runtime.InteropServices;
using Tizen.NUI.Binding;
-using Tizen.NUI.Xaml;
namespace Tizen.NUI.BaseComponents
{
/// View is the base class for all views.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- [ContentProperty("Children")]
- public class View : Container, IResourcesProvider
+ public class View : Container
{
/// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
Tizen.NUI.Object.GetProperty(view.swigCPtr, View.Property.MARGIN).Get(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 StyleProperty = BindableProperty.Create("Style", typeof(Style), typeof(View), default(Style), propertyChanged: (bindable, oldvalue, newvalue) => ((View)bindable)._mergedStyle.Style = (Style)newvalue);
/// <summary>
/// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
[EditorBrowsable(EditorBrowsableState.Never)]
public static bool layoutingDisabled{get; set;} = true;
- internal readonly MergedStyle _mergedStyle;
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
private LayoutItem _layout; // Exclusive layout assigned to this View.
private int _widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
{
PositionUsesPivotPoint = false;
}
- _mergedStyle = new MergedStyle(GetType(), this);
_onWindowSendEventCallback = SendViewAddedEventToWindow;
this.OnWindowSignal().Connect(_onWindowSendEventCallback);
/// Event when a child is removed.
/// </summary>
/// <since_tizen> 5 </since_tizen>
- public new event EventHandler<ChildRemovedEventArgs> ChildRemoved;
+ public event EventHandler<ChildRemovedEventArgs> ChildRemoved;
/// <summary>
/// Event when a child is added.
/// </summary>
/// <since_tizen> 5 </since_tizen>
- public new event EventHandler<ChildAddedEventArgs> ChildAdded;
+ public event EventHandler<ChildAddedEventArgs> ChildAdded;
/// <summary>
/// An event for the KeyInputFocusGained signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
CONTROL_PROPERTY_END_INDEX = CONTROL_PROPERTY_START_INDEX + 1000
}
- /// 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 bool IsResourcesCreated
- {
- get
- {
- return Application.Current.IsResourcesCreated;
- }
- }
-
- /// 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 ResourceDictionary XamlResources
- {
- get
- {
- return Application.Current.XamlResources;
- }
- set
- {
- Application.Current.XamlResources = value;
- }
- }
-
/// <summary>
/// The StyleName, type string.
/// </summary>
}
}
- internal Style Style
- {
- get
- {
- return (Style)GetValue(StyleProperty);
- }
- set
- {
- SetValue(StyleProperty, value);
- }
- }
-
/// <summary>
/// Child property to specify desired width
/// </summary>
}
}
-
- private Dictionary<string, Transition> transDictionary = new Dictionary<string, Transition>();
-
- /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
- public Transition GetTransition(string transitionName)
- {
- Transition trans = null;
- transDictionary.TryGetValue(transitionName, out trans);
- return trans;
- }
-
- private void LoadTransitions()
- {
- foreach (string str in transitionNames)
- {
- string resourceName = str + ".xaml";
- Transition trans = null;
-
- string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
-
- string likelyResourcePath = resource + "animation/" + resourceName;
-
- if (File.Exists(likelyResourcePath))
- {
- trans = Extensions.LoadObject<Transition>(likelyResourcePath);
- }
- if (trans)
- {
- transDictionary.Add(trans.Name, trans);
- }
- }
- }
-
- /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
- public string[] TransitionNames
- {
- get
- {
- return transitionNames;
- }
- set
- {
- transitionNames = value;
- LoadTransitions();
- }
- }
- private string[] transitionNames;
-
internal class BackgroundResourceLoadedEventArgs : EventArgs
{
private ResourceLoadingStatusType status = ResourceLoadingStatusType.Invalid;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Tizen.NUI.Binding;
-using Tizen.NUI.Binding.Internals;
namespace Tizen.NUI
{
/// <since_tizen> 3 </since_tizen>
public class BaseHandle : Element, global::System.IDisposable
{
- internal static readonly BindablePropertyKey NavigationPropertyKey = BindableProperty.CreateReadOnly("Navigation", typeof(INavigation), typeof(/*VisualElement*/BaseHandle), default(INavigation));
-
- /// <summary>
- /// Backing store for the Navigation property.
- /// </summary>
- internal static readonly BindableProperty NavigationProperty = NavigationPropertyKey.BindableProperty;
-
/// <summary>
/// swigCMemOwn
/// </summary>
}
}
- /// <summary>
- /// For internal use.
- /// </summary>
- internal NavigationProxy NavigationProxy
- {
- get { return Navigation as NavigationProxy; }
- }
-
- /// <summary>
- /// Gets the navigation.
- /// </summary>
- internal INavigation Navigation
- {
- get { return (INavigation)GetValue(NavigationProperty); }
- set { SetValue(NavigationPropertyKey, value); }
- }
-
/// <summary>
/// Returns the bool value true to indicate that an operand is true and returns false otherwise.
/// </summary>
return ret;
}
+ internal object GetValue(BindableProperty property)
+ {
+ return property.DefaultValueCreator?.Invoke(this);
+ }
+
+ internal void SetValue(BindableProperty property, object value)
+ {
+ property.PropertyChanged?.Invoke(this, null, value);
+ }
+
/// <summary>
/// Dispose.
/// </summary>
*/
using System;
-using Tizen.NUI.Binding;
using System.ComponentModel;
namespace Tizen.NUI
/// <summary>
/// The Color class.
/// </summary>
- [Tizen.NUI.Binding.TypeConverter(typeof(ColorTypeConverter))]
public class Color : global::System.IDisposable
{
/// <pre>The child container has been initialized.</pre>
/// <returns>The parent container.</returns>
/// <since_tizen> 4 </since_tizen>
- public new Container Parent
+ public Container Parent
{
get
{
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+using System.Xml;
+
+namespace Tizen.NUI.Binding
+{
+ /// <summary>
+ /// Provides the base class for all Tizen.NUI.Binding hierarchal elements. This class contains all the methods and properties required to represent an element in the Tizen.NUI.Binding hierarchy.
+ /// </summary>
+ /// duplicate, don't use
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class Element
+ {
+ }
+}
*
*/
using System;
-using Tizen.NUI.Binding;
namespace Tizen.NUI
{
/// Extents class describing the a collection of uint16_t.
/// </summary>
/// <since_tizen> 4 </since_tizen>
- [TypeConverter(typeof(ExtentsTypeConverter))]
public class Extents : global::System.IDisposable
{
return _typeConverter.ConvertFromPixel(value);
}
- internal void RegisterCustomConverterForDynamicResourceBinding(global::System.Type type, Tizen.NUI.Binding.TypeConverter userConverter)
- {
- if (Tizen.NUI.Binding.BindableProperty.UserCustomConvertTypes.ContainsKey(type) == false)
- {
- Tizen.NUI.Binding.BindableProperty.UserCustomConvertTypes.Add(type, userConverter);
- }
- //NUILog.Error($"user custom converter ditionary count={Tizen.NUI.Binding.BindableProperty.UserCustomConvertTypes.Count}");
- }
-
private volatile static GraphicsTypeManager _graphicsTypeManager;
private GraphicsTypeConverter _typeConverter;
}
-
}
\ No newline at end of file
using Tizen.NUI.BaseComponents;
using System.ComponentModel;
using System.Runtime.InteropServices;
-using Tizen.NUI.Binding;
namespace Tizen.NUI
{
}
}
- /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
- public ResourceDictionary XamlResources
- {
- get
- {
- return Application.Current.XamlResources;
- }
- set
- {
- Application.Current.XamlResources = value;
- }
- }
-
/// From the Container base class.
/// <summary>
using System.Reflection;
using Tizen.Applications;
using Tizen.Applications.CoreBackend;
-using Tizen.NUI.Binding;
-using Tizen.NUI.Xaml;
namespace Tizen.NUI
{
/// <since_tizen> 5 </since_tizen>
public static void RegisterAssembly(Assembly assembly)
{
- XamlParser.s_assemblies.Add(assembly);
}
/// <summary>
protected override void OnCreate()
{
base.OnCreate();
- Device.PlatformServices = new TizenPlatformServices();
}
}
*/
using System;
-using Tizen.NUI.Binding;
using System.ComponentModel;
namespace Tizen.NUI
/// Position is a three-dimensional vector.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- [Tizen.NUI.Binding.TypeConverter(typeof(PositionTypeConverter))]
public class Position : global::System.IDisposable
{
/// <summary>
*/
using System;
using System.Globalization;
-using Tizen.NUI.Binding;
namespace Tizen.NUI
{
/// Position2D is a two-dimensional vector.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- [Tizen.NUI.Binding.TypeConverter(typeof(Position2DTypeConverter))]
public class Position2D : global::System.IDisposable
{
/// <summary>
using System;
using System.ComponentModel;
using System.Collections.Generic;
-using Tizen.NUI.Binding;
namespace Tizen.NUI
{
set
{
_key = value;
- ParseKey(value);
}
}
TrueValue = new PropertyValue(value);
}
}
-
- private void ParseKey(string key)
- {
- int v = -1;
- if (VisualExtension.KeyDictionary.ContainsKey(key))
- {
- VisualExtension.KeyDictionary.TryGetValue(key, out v);
- KeyInt = v;
- }
- else
- {
- KeyString = Key;
- }
- }
}
internal class Property : global::System.IDisposable
* limitations under the License.
*
*/
- using System;
- using Tizen.NUI.Binding;
+using System;
namespace Tizen.NUI
{
/// The Rectangle class.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- [TypeConverter(typeof(RectangleTypeConverter))]
public class Rectangle : global::System.IDisposable
{
/// <summary>
* limitations under the License.
*
*/
- using System;
- using Tizen.NUI.Binding;
+using System;
namespace Tizen.NUI
{
/// Both values (x and y) should be between [0, 1].
/// </summary>
/// <since_tizen> 3 </since_tizen>
- [TypeConverter(typeof(RelativeVector2TypeConverter))]
public class RelativeVector2 : global::System.IDisposable
{
/// <summary>
*/
using System;
-using Tizen.NUI.Binding;
namespace Tizen.NUI
{
/// All values (x, y, z and w) should be between [0, 1].
/// </summary>
/// <since_tizen> 3 </since_tizen>
- [TypeConverter(typeof(RelativeVector3TypeConverter))]
public class RelativeVector3 : global::System.IDisposable
{
/// <summary>
* limitations under the License.
*
*/
- using System;
- using Tizen.NUI.Binding;
+using System;
namespace Tizen.NUI
{
/// All values (x, y, and z) should be between [0, 1].
/// </summary>
/// <since_tizen> 3 </since_tizen>
- [TypeConverter(typeof(RelativeVector4TypeConverter))]
public class RelativeVector4 : global::System.IDisposable
{
/// <summary>
*
*/
using System;
- using Tizen.NUI.Binding;
namespace Tizen.NUI
{
/// The Rotation class.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- [TypeConverter(typeof(RotationTypeConverter))]
public class Rotation : global::System.IDisposable
{
/// <summary>
using System;
using System.ComponentModel;
-using Tizen.NUI.Binding;
namespace Tizen.NUI
{
/// A three-dimensional size.
/// </summary>
/// <since_tizen> 5 </since_tizen>
- [Tizen.NUI.Binding.TypeConverter(typeof(SizeTypeConverter))]
public class Size : global::System.IDisposable
{
/// <summary>swigCMemOwn.</summary>
*
*/
using System;
-using Tizen.NUI.Binding;
namespace Tizen.NUI
{
/// A two-dimensional size.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- [Tizen.NUI.Binding.TypeConverter(typeof(Size2DTypeConverter))]
public class Size2D : global::System.IDisposable
{
/// <summary>
/// Gets or sets the label.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public Tizen.NUI.PropertyMap Label
+ public PropertyMap Label
{
get
{
using System;
using System.ComponentModel;
-using Tizen.NUI.BaseComponents;
-using Tizen.NUI.Binding;
using System.Windows.Input;
using System.Collections.Generic;
+using Tizen.NUI.Binding;
namespace Tizen.NUI.UIComponents
{
{
/// 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 CommandProperty = BindableProperty.Create("Command", typeof(ICommand), typeof(PushButton), null,
- BindingMode.OneWay, null, null, null, null, null as BindableProperty.CreateDefaultValueDelegate);
+ public static readonly BindableProperty CommandProperty = BindableProperty.Create("Command", typeof(ICommand), typeof(PushButton), null, null);
/// 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 CommandParameterProperty = BindableProperty.Create("CommandParameter", typeof(object), typeof(PushButton), null,
- BindingMode.OneWay, null, null, null, null, null as BindableProperty.CreateDefaultValueDelegate);
+ public static readonly BindableProperty CommandParameterProperty = BindableProperty.Create("CommandParameter", typeof(object), typeof(PushButton), null, null);
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
}
}
- internal override bool IsCreateByXaml
- {
- get
- {
- return base.IsCreateByXaml;
- }
- set
- {
- base.IsCreateByXaml = value;
-
- if (value == true)
- {
- this.Clicked += (sender, e) =>
- {
- ICommand command = this.Command;
- if (command != null)
- {
- command.Execute(this.CommandParameter);
- }
- return true;
- };
- }
- }
- }
-
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PushButton obj)
{
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
using System.ComponentModel;
using Tizen.NUI.BaseComponents;
using Tizen.NUI.Binding;
-using Tizen.NUI.Binding.Internals;
namespace Tizen.NUI.UIComponents
{
});
/// 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 ValueProperty = BindableProperty.Create("Value", typeof(float), typeof(Slider), default(float), BindingMode.TwoWay, propertyChanged: (bindable, oldValue, newValue) =>
+ public static readonly BindableProperty ValueProperty = BindableProperty.Create("Value", typeof(float), typeof(Slider), default(float), propertyChanged: (bindable, oldValue, newValue) =>
{
var slider = (Slider)bindable;
if (newValue != null)
}
set
{
- SetValueAndForceSendChangeSignal(ValueProperty, value);
+ SetValue(ValueProperty, value);
}
}
}
}
- internal override bool IsCreateByXaml
- {
- get
- {
- return base.IsCreateByXaml;
- }
- set
- {
- base.IsCreateByXaml = value;
-
- if (value == true)
- {
- this.ValueChanged += (obj, e) => {
- this.Value = e.SlideValue;
- return true;
- };
- }
- }
- }
-
/// <summary>
/// Downcasts an object handle to the slider.<br />
/// If the handle points to a slider, then the downcast produces a valid handle.<br />
*
*/
using System;
-using Tizen.NUI.Binding;
namespace Tizen.NUI
{
/// A two-dimensional vector.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- [TypeConverter(typeof(Vector2TypeConverter))]
public class Vector2 : global::System.IDisposable
{
/// <summary>
*
*/
using System;
-using Tizen.NUI.Binding;
namespace Tizen.NUI
{
/// A three-dimensional vector.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- [TypeConverter(typeof(Vector3TypeConverter))]
public class Vector3 : global::System.IDisposable
{
/// <summary>
*
*/
using System;
-using Tizen.NUI.Binding;
namespace Tizen.NUI
{
/// A four-dimensional vector.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- [TypeConverter(typeof(Vector4TypeConverter))]
public class Vector4 : global::System.IDisposable
{
/// <summary>
+++ /dev/null
-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
+++ /dev/null
-//
-// ViewExtensions.cs
-//
-// Author:
-// Stephane Delcroix <stephane@mi8.be>
-//
-// Copyright (c) 2013 Mobile Inception
-// Copyright (c) 2013 Xamarin, Inc
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System;
-using System.Reflection;
-using System.ComponentModel;
-using Tizen.NUI.Binding;
-
-namespace Tizen.NUI.Xaml
-{
- /// <summary>
- /// Extension class for View defining Tizen.NUI.Xaml.Extensions.LoadFromXaml{TView} method.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static class Extensions
- {
- /// <summary>
- /// Returns an initialized view by loading the specified xaml.
- /// </summary>
- /// <typeparam name="TXaml">The type of view to initialize with state from XAML.</typeparam>
- /// <param name="view">The view on which this method operates.</param>
- /// <param name="callingType">The type of the caller.</param>
- /// <returns>A TXaml with the properties that are defined in the application manifest for callingType.</returns>
- /// 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 TXaml LoadFromXaml<TXaml>(this TXaml view, Type callingType)
- {
- XamlLoader.Load(view, callingType);
- return view;
- }
-
- /// <summary>
- /// Returns a TXaml with the properties that are defined in the application manifest for callingType.
- /// </summary>
- /// <typeparam name="TXaml">The type of view to initialize with state from XAML.</typeparam>
- /// <param name="view">The view on which this method operates.</param>
- /// <param name="xaml">The XAML that encodes the view state.</param>
- /// <returns>A TXaml with the properties that are defined in the application manifest for callingType.</returns>
- /// 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 TXaml LoadFromXaml<TXaml>(this TXaml view, string xaml)
- {
- XamlLoader.Load(view, xaml);
- return view;
- }
-
- /// 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 LoadObject<T>(string path)
- {
- return XamlLoader.LoadObject<T>(path);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Diagnostics;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using Tizen.NUI.Binding.Internals;
-
-namespace Tizen.NUI.Binding
-{
- /// <summary>
- /// Provides a mechanism by which application developers can propagate changes that are made to data in one object to another, by enabling validation, type coercion, and an event system.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public abstract class BindableObject : INotifyPropertyChanged, IDynamicResourceHandler
- {
- /// <summary>
- /// Implements the bound property whose interface is provided by the BindingContext property.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static readonly BindableProperty BindingContextProperty =
- BindableProperty.Create("BindingContext", typeof(object), typeof(BindableObject), default(object),
- BindingMode.OneWay, null, BindingContextPropertyChanged, null, null, BindingContextPropertyBindingChanging);
-
- readonly List<BindablePropertyContext> _properties = new List<BindablePropertyContext>(4);
-
- bool _applying;
- object _inheritedContext;
-
- /// <summary>
- /// Gets or sets object that contains the properties that will be targeted by the bound properties that belong to this BindableObject.
- /// </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 object BindingContext
- {
- get { return _inheritedContext ?? GetValue(BindingContextProperty); }
- set { SetValue(BindingContextProperty, value); }
- }
-
- void IDynamicResourceHandler.SetDynamicResource(BindableProperty property, string key)
- {
- SetDynamicResource(property, key, false);
- }
-
- /// <summary>
- /// Raised when a property has changed.
- /// </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 event PropertyChangedEventHandler PropertyChanged;
-
- /// <summary>
- /// Raised whenever the BindingContext property changes.
- /// </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 event EventHandler BindingContextChanged;
-
- internal void ClearValue(BindableProperty property, bool fromStyle)
- {
- ClearValue(property, fromStyle: fromStyle, checkAccess: true);
- }
-
- /// <summary>
- /// Clears any value set by Tizen.NUI.Xaml.BindableObject.SetValue.
- /// </summary>
- /// <param name="property">The BindableProperty to clear</param>
- internal void ClearValue(BindableProperty property)
- {
- ClearValue(property, fromStyle: false, checkAccess: true);
- }
-
- /// <summary>
- /// 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)
- {
- if (propertyKey == null)
- throw new ArgumentNullException("propertyKey");
-
- ClearValue(propertyKey.BindableProperty, fromStyle:false, checkAccess: false);
- }
-
- /// <summary>
- /// Return true if the target property exists and has been set.
- /// </summary>
- /// <param name="targetProperty">The target property</param>
- /// <returns>return true if the target property exists and has been set</returns>
- internal bool IsSet(BindableProperty targetProperty)
- {
- if (targetProperty == null)
- throw new ArgumentNullException(nameof(targetProperty));
-
- var bpcontext = GetContext(targetProperty);
- return bpcontext != null
- && (bpcontext.Attributes & BindableContextAttributes.IsDefaultValue) == 0;
- }
-
- /// <summary>
- /// Returns the value that is contained the BindableProperty.
- /// </summary>
- /// <param name="property">The BindableProperty for which to get the value.</param>
- /// <returns>The value that is contained the BindableProperty</returns>
- /// 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 object GetValue(BindableProperty property)
- {
- if (property == null)
- throw new ArgumentNullException("property");
-
- BindablePropertyContext context = property.DefaultValueCreator != null ? GetOrCreateContext(property) : GetContext(property);
-
- if (context == null)
- return property.DefaultValue;
-
- return context.Value;
- }
-
- /// <summary>
- /// Raised when a property is about to change.
- /// </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 event PropertyChangingEventHandler PropertyChanging;
-
- /// <summary>
- /// Removes a previously set binding.
- /// </summary>
- /// <param name="property">The BindableProperty from which to remove bindings.</param>
- internal void RemoveBinding(BindableProperty property)
- {
- if (property == null)
- throw new ArgumentNullException("property");
-
- BindablePropertyContext context = GetContext(property);
- if (context == null || context.Binding == null)
- return;
-
- RemoveBinding(property, context);
- }
-
- /// <summary>
- /// Assigns a binding to a property.
- /// </summary>
- /// <param name="targetProperty">The BindableProperty on which to set a binding.</param>
- /// <param name="binding">The binding to set.</param>
- internal void SetBinding(BindableProperty targetProperty, BindingBase binding)
- {
- SetBinding(targetProperty, binding, false);
- }
-
- private bool isCreateByXaml = false;
- internal virtual bool IsCreateByXaml
- {
- get
- {
- return isCreateByXaml;
- }
- set
- {
- isCreateByXaml = value;
- }
- }
-
- /// <summary>
- /// Sets the value of the specified property.
- /// </summary>
- /// <param name="property">The BindableProperty on which to assign a value.</param>
- /// <param name="value">The value to set.</param>
- /// 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 void SetValue(BindableProperty property, object value)
- {
- if (true == isCreateByXaml)
- {
- SetValue(property, value, false, true);
- }
- else
- {
- property.PropertyChanged?.Invoke(this, null, value);
- }
- }
-
- internal void SetValueAndForceSendChangeSignal(BindableProperty property, object value)
- {
- if (property == null)
- throw new ArgumentNullException("property");
-
- if (true == isCreateByXaml)
- {
- if (property.IsReadOnly)
- throw new InvalidOperationException(string.Format("The BindableProperty \"{0}\" is readonly.", property.PropertyName));
-
- SetValueCore(property, value, SetValueFlags.ClearOneWayBindings | SetValueFlags.ClearDynamicResource,
- SetValuePrivateFlags.ManuallySet | SetValuePrivateFlags.CheckAccess, true);
- }
- else
- {
- property.PropertyChanged?.Invoke(this, null, value);
- }
- }
-
- /// <summary>
- /// Sets the value of the propertyKey.
- /// </summary>
- /// <param name="propertyKey">The BindablePropertyKey on which to assign a value.</param>
- /// <param name="value">The value to set.</param>
- /// 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 void SetValue(BindablePropertyKey propertyKey, object value)
- {
- if (propertyKey == null)
- throw new ArgumentNullException("propertyKey");
-
- SetValue(propertyKey.BindableProperty, value, false, false);
- }
-
- /// <summary>
- /// Set the inherited context to a neated element.
- /// </summary>
- /// <param name="bindable">The object on which to set the inherited binding context.</param>
- /// <param name="value">The inherited context to set.</param>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static void SetInheritedBindingContext(BindableObject bindable, object value)
- {
- BindablePropertyContext bpContext = bindable.GetContext(BindingContextProperty);
- if (bpContext != null && ((bpContext.Attributes & BindableContextAttributes.IsManuallySet) != 0))
- return;
-
- object oldContext = bindable._inheritedContext;
-
- if (ReferenceEquals(oldContext, value))
- return;
-
- if (bpContext != null && oldContext == null)
- oldContext = bpContext.Value;
-
- if (bpContext != null && bpContext.Binding != null)
- {
- bpContext.Binding.Context = value;
- bindable._inheritedContext = null;
- }
- else
- {
- bindable._inheritedContext = value;
- }
-
- bindable.ApplyBindings(skipBindingContext:false, fromBindingContextChanged:true);
- bindable.OnBindingContextChanged();
- }
-
- /// <summary>
- /// Apply the bindings to BindingContext.
- /// </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)]
- protected void ApplyBindings()
- {
- ApplyBindings(skipBindingContext: false, fromBindingContextChanged: false);
- }
-
- /// <summary>
- /// Override this method to execute an action when the BindingContext changes.
- /// </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)]
- protected virtual void OnBindingContextChanged()
- {
- BindingContextChanged?.Invoke(this, EventArgs.Empty);
- }
-
- /// <summary>
- /// Call this method from a child class to notify that a change happened on a property.
- /// </summary>
- /// <param name="propertyName">The name of the property that changed.</param>
- /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
- protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
- => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
-
- /// <summary>
- /// Call this method from a child class to notify that a change is going to happen on a property.
- /// </summary>
- /// <param name="propertyName">The name of the property that is changing.</param>
- /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
- protected virtual void OnPropertyChanging([CallerMemberName] string propertyName = null)
- => PropertyChanging?.Invoke(this, new PropertyChangingEventArgs(propertyName));
-
- /// <summary>
- /// Unapplies all previously set bindings.
- /// </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)]
- protected void UnapplyBindings()
- {
- for (int i = 0, _propertiesCount = _properties.Count; i < _propertiesCount; i++) {
- BindablePropertyContext context = _properties [i];
- if (context.Binding == null)
- continue;
-
- context.Binding.Unapply();
- }
- }
-
- internal bool GetIsBound(BindableProperty targetProperty)
- {
- if (targetProperty == null)
- throw new ArgumentNullException("targetProperty");
-
- BindablePropertyContext bpcontext = GetContext(targetProperty);
- return bpcontext != null && bpcontext.Binding != null;
- }
-
- /// <summary>
- /// Returns the value that is contained the BindableProperty.
- /// </summary>
- /// <param name="property0">The BindableProperty instance.</param>
- /// <param name="property1">The BindableProperty instance.</param>
- /// <returns>The value that is contained the BindableProperty</returns>
- internal object[] GetValues(BindableProperty property0, BindableProperty property1)
- {
- var values = new object[2];
-
- for (var i = 0; i < _properties.Count; i++)
- {
- BindablePropertyContext context = _properties[i];
-
- if (ReferenceEquals(context.Property, property0))
- {
- values[0] = context.Value;
- property0 = null;
- }
- else if (ReferenceEquals(context.Property, property1))
- {
- values[1] = context.Value;
- property1 = null;
- }
-
- if (property0 == null && property1 == null)
- return values;
- }
-
- if (!ReferenceEquals(property0, null))
- values[0] = property0.DefaultValueCreator == null ? property0.DefaultValue : CreateAndAddContext(property0).Value;
- if (!ReferenceEquals(property1, null))
- values[1] = property1.DefaultValueCreator == null ? property1.DefaultValue : CreateAndAddContext(property1).Value;
-
- return values;
- }
-
- /// <summary>
- /// Returns the value that is contained the BindableProperty.
- /// </summary>
- /// <param name="property0">The BindableProperty instance.</param>
- /// <param name="property1">The BindableProperty instance.</param>
- /// <param name="property2">The BindableProperty instance.</param>
- /// <returns>The value that is contained the BindableProperty</returns>
- internal object[] GetValues(BindableProperty property0, BindableProperty property1, BindableProperty property2)
- {
- var values = new object[3];
-
- for (var i = 0; i < _properties.Count; i++)
- {
- BindablePropertyContext context = _properties[i];
-
- if (ReferenceEquals(context.Property, property0))
- {
- values[0] = context.Value;
- property0 = null;
- }
- else if (ReferenceEquals(context.Property, property1))
- {
- values[1] = context.Value;
- property1 = null;
- }
- else if (ReferenceEquals(context.Property, property2))
- {
- values[2] = context.Value;
- property2 = null;
- }
-
- if (property0 == null && property1 == null && property2 == null)
- return values;
- }
-
- if (!ReferenceEquals(property0, null))
- values[0] = property0.DefaultValueCreator == null ? property0.DefaultValue : CreateAndAddContext(property0).Value;
- if (!ReferenceEquals(property1, null))
- values[1] = property1.DefaultValueCreator == null ? property1.DefaultValue : CreateAndAddContext(property1).Value;
- if (!ReferenceEquals(property2, null))
- values[2] = property2.DefaultValueCreator == null ? property2.DefaultValue : CreateAndAddContext(property2).Value;
-
- return values;
- }
-
- /// <summary>
- /// Returns the value that is contained the BindableProperty.
- /// </summary>
- /// <param name="properties">The array of the BindableProperty instances</param>
- /// <returns>The values that is contained the BindableProperty instances.</returns>
- internal object[] GetValues(params BindableProperty[] properties)
- {
- var values = new object[properties.Length];
- for (var i = 0; i < _properties.Count; i++) {
- var context = _properties[i];
- var index = properties.IndexOf(context.Property);
- if (index < 0)
- continue;
- values[index] = context.Value;
- }
- for (var i = 0; i < values.Length; i++) {
- if (!ReferenceEquals(values[i], null))
- continue;
- values[i] = properties[i].DefaultValueCreator == null ? properties[i].DefaultValue : CreateAndAddContext(properties[i]).Value;
- }
- return values;
- }
-
- internal virtual void OnRemoveDynamicResource(BindableProperty property)
- {
- }
-
- internal virtual void OnSetDynamicResource(BindableProperty property, string key)
- {
- }
-
- internal void RemoveDynamicResource(BindableProperty property)
- {
- if (property == null)
- throw new ArgumentNullException("property");
-
- OnRemoveDynamicResource(property);
- BindablePropertyContext context = GetOrCreateContext(property);
- context.Attributes &= ~BindableContextAttributes.IsDynamicResource;
- }
-
- internal void SetBinding(BindableProperty targetProperty, BindingBase binding, bool fromStyle)
- {
- if (targetProperty == null)
- throw new ArgumentNullException("targetProperty");
- if (binding == null)
- throw new ArgumentNullException("binding");
-
- if (fromStyle && !CanBeSetFromStyle(targetProperty))
- return;
-
- var context = GetOrCreateContext(targetProperty);
- if (fromStyle)
- context.Attributes |= BindableContextAttributes.IsSetFromStyle;
- else
- context.Attributes &= ~BindableContextAttributes.IsSetFromStyle;
-
- if (context.Binding != null)
- context.Binding.Unapply();
-
- BindingBase oldBinding = context.Binding;
- context.Binding = binding;
-
- targetProperty.BindingChanging?.Invoke(this, oldBinding, binding);
-
- binding.Apply(BindingContext, this, targetProperty);
- }
-
- bool CanBeSetFromStyle(BindableProperty property)
- {
- var context = GetContext(property);
- if (context == null)
- return true;
- if ((context.Attributes & BindableContextAttributes.IsSetFromStyle) == BindableContextAttributes.IsSetFromStyle)
- return true;
- if ((context.Attributes & BindableContextAttributes.IsDefaultValue) == BindableContextAttributes.IsDefaultValue)
- return true;
- if ((context.Attributes & BindableContextAttributes.IsDefaultValueCreated) == BindableContextAttributes.IsDefaultValueCreated)
- return true;
- return false;
- }
-
- internal void SetDynamicResource(BindableProperty property, string key)
- {
- SetDynamicResource(property, key, false);
- }
-
- internal void SetDynamicResource(BindableProperty property, string key, bool fromStyle)
- {
- if (property == null)
- throw new ArgumentNullException(nameof(property));
- if (string.IsNullOrEmpty(key))
- throw new ArgumentNullException(nameof(key));
- if (fromStyle && !CanBeSetFromStyle(property))
- return;
-
- var context = GetOrCreateContext(property);
-
- context.Attributes |= BindableContextAttributes.IsDynamicResource;
- if (fromStyle)
- context.Attributes |= BindableContextAttributes.IsSetFromStyle;
- else
- context.Attributes &= ~BindableContextAttributes.IsSetFromStyle;
-
- OnSetDynamicResource(property, key);
- }
-
- internal void SetValue(BindableProperty property, object value, bool fromStyle)
- {
- SetValue(property, value, fromStyle, true);
- }
-
- internal void SetValueCore(BindablePropertyKey propertyKey, object value, SetValueFlags attributes = SetValueFlags.None)
- {
- SetValueCore(propertyKey.BindableProperty, value, attributes, SetValuePrivateFlags.None, false);
- }
-
- /// <summary>
- /// For internal use.
- /// </summary>
- /// <param name="property">The BindableProperty on which to assign a value.</param>
- /// <param name="value">The value to set</param>
- /// <param name="attributes">The set value flag</param>
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal void SetValueCore(BindableProperty property, object value, SetValueFlags attributes = SetValueFlags.None)
- {
- SetValueCore(property, value, attributes, SetValuePrivateFlags.Default, false);
- }
-
- internal void SetValueCore(BindableProperty property, object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, bool forceSendChangeSignal)
- {
- bool checkAccess = (privateAttributes & SetValuePrivateFlags.CheckAccess) != 0;
- bool manuallySet = (privateAttributes & SetValuePrivateFlags.ManuallySet) != 0;
- bool silent = (privateAttributes & SetValuePrivateFlags.Silent) != 0;
- bool fromStyle = (privateAttributes & SetValuePrivateFlags.FromStyle) != 0;
- bool converted = (privateAttributes & SetValuePrivateFlags.Converted) != 0;
-
- if (property == null)
- throw new ArgumentNullException("property");
- if (checkAccess && property.IsReadOnly)
- {
- Debug.WriteLine("Can not set the BindableProperty \"{0}\" because it is readonly.", property.PropertyName);
- return;
- }
-
- if (!converted && !property.TryConvert(ref value))
- {
- Console.WriteLine("SetValue", "Can not convert {0} to type '{1}'", value, property.ReturnType);
- return;
- }
-
- if (property.ValidateValue != null && !property.ValidateValue(this, value))
- throw new ArgumentException("Value was an invalid value for " + property.PropertyName, "value");
-
- if (property.CoerceValue != null)
- value = property.CoerceValue(this, value);
-
- BindablePropertyContext context = GetOrCreateContext(property);
- if (manuallySet) {
- context.Attributes |= BindableContextAttributes.IsManuallySet;
- context.Attributes &= ~BindableContextAttributes.IsSetFromStyle;
- } else
- context.Attributes &= ~BindableContextAttributes.IsManuallySet;
-
- if (fromStyle)
- context.Attributes |= BindableContextAttributes.IsSetFromStyle;
- // else omitted on purpose
-
- bool currentlyApplying = _applying;
-
- if ((context.Attributes & BindableContextAttributes.IsBeingSet) != 0)
- {
- Queue<SetValueArgs> delayQueue = context.DelayedSetters;
- if (delayQueue == null)
- context.DelayedSetters = delayQueue = new Queue<SetValueArgs>();
-
- delayQueue.Enqueue(new SetValueArgs(property, context, value, currentlyApplying, attributes));
- }
- else
- {
- context.Attributes |= BindableContextAttributes.IsBeingSet;
- SetValueActual(property, context, value, currentlyApplying, forceSendChangeSignal, attributes, silent);
-
- Queue<SetValueArgs> delayQueue = context.DelayedSetters;
- if (delayQueue != null)
- {
- while (delayQueue.Count > 0)
- {
- SetValueArgs s = delayQueue.Dequeue();
- SetValueActual(s.Property, s.Context, s.Value, s.CurrentlyApplying, forceSendChangeSignal, s.Attributes);
- }
-
- context.DelayedSetters = null;
- }
-
- context.Attributes &= ~BindableContextAttributes.IsBeingSet;
- }
- }
-
- internal void ApplyBindings(bool skipBindingContext, bool fromBindingContextChanged)
- {
- var prop = _properties.ToArray();
- for (int i = 0, propLength = prop.Length; i < propLength; i++) {
- BindablePropertyContext context = prop [i];
- BindingBase binding = context.Binding;
- if (binding == null)
- continue;
-
- if (skipBindingContext && ReferenceEquals(context.Property, BindingContextProperty))
- continue;
-
- binding.Unapply(fromBindingContextChanged: fromBindingContextChanged);
- binding.Apply(BindingContext, this, context.Property, fromBindingContextChanged: fromBindingContextChanged);
- }
- }
-
- static void BindingContextPropertyBindingChanging(BindableObject bindable, BindingBase oldBindingBase, BindingBase newBindingBase)
- {
- object context = bindable._inheritedContext;
- var oldBinding = oldBindingBase as Binding;
- var newBinding = newBindingBase as Binding;
-
- if (context == null && oldBinding != null)
- context = oldBinding.Context;
- if (context != null && newBinding != null)
- newBinding.Context = context;
- }
-
- static void BindingContextPropertyChanged(BindableObject bindable, object oldvalue, object newvalue)
- {
- bindable._inheritedContext = null;
- bindable.ApplyBindings(skipBindingContext: true, fromBindingContextChanged:true);
- bindable.OnBindingContextChanged();
- }
-
- void ClearValue(BindableProperty property, bool fromStyle, bool checkAccess)
- {
- if (property == null)
- throw new ArgumentNullException(nameof(property));
-
- if (checkAccess && property.IsReadOnly)
- throw new InvalidOperationException(string.Format("The BindableProperty \"{0}\" is readonly.", property.PropertyName));
-
- BindablePropertyContext bpcontext = GetContext(property);
- if (bpcontext == null)
- return;
-
- if (fromStyle && !CanBeSetFromStyle(property))
- return;
-
- object original = bpcontext.Value;
-
- object newValue = property.GetDefaultValue(this);
-
- bool same = Equals(original, newValue);
- if (!same)
- {
- property.PropertyChanging?.Invoke(this, original, newValue);
-
- OnPropertyChanging(property.PropertyName);
- }
-
- bpcontext.Attributes &= ~BindableContextAttributes.IsManuallySet;
- bpcontext.Value = newValue;
- if (property.DefaultValueCreator == null)
- bpcontext.Attributes |= BindableContextAttributes.IsDefaultValue;
- else
- bpcontext.Attributes |= BindableContextAttributes.IsDefaultValueCreated;
-
- if (!same)
- {
- OnPropertyChanged(property.PropertyName);
- property.PropertyChanged?.Invoke(this, original, newValue);
- }
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- BindablePropertyContext CreateAndAddContext(BindableProperty property)
- {
- var context = new BindablePropertyContext { Property = property, Value = property.DefaultValueCreator != null ? property.DefaultValueCreator(this) : property.DefaultValue };
-
- if (property.DefaultValueCreator == null)
- context.Attributes = BindableContextAttributes.IsDefaultValue;
- else
- context.Attributes = BindableContextAttributes.IsDefaultValueCreated;
-
- _properties.Add(context);
- return context;
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- BindablePropertyContext GetContext(BindableProperty property)
- {
- List<BindablePropertyContext> properties = _properties;
-
- for (var i = 0; i < properties.Count; i++)
- {
- BindablePropertyContext context = properties[i];
- if (ReferenceEquals(context.Property, property))
- return context;
- }
-
- return null;
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- BindablePropertyContext GetOrCreateContext(BindableProperty property)
- {
- BindablePropertyContext context = GetContext(property);
- if (context == null)
- {
- context = CreateAndAddContext(property);
- }
- else if (property.DefaultValueCreator != null )
- {
- context.Value = property.DefaultValueCreator(this); //Update Value from dali
- }//added by xb.teng
-
- return context;
- }
-
- void RemoveBinding(BindableProperty property, BindablePropertyContext context)
- {
- context.Binding.Unapply();
-
- property.BindingChanging?.Invoke(this, context.Binding, null);
-
- context.Binding = null;
- }
-
- void SetValue(BindableProperty property, object value, bool fromStyle, bool checkAccess)
- {
- if (property == null)
- throw new ArgumentNullException("property");
-
- if (checkAccess && property.IsReadOnly)
- throw new InvalidOperationException(string.Format("The BindableProperty \"{0}\" is readonly.", property.PropertyName));
-
- if (fromStyle && !CanBeSetFromStyle(property))
- return;
-
- SetValueCore(property, value, SetValueFlags.ClearOneWayBindings | SetValueFlags.ClearDynamicResource,
- (fromStyle ? SetValuePrivateFlags.FromStyle : SetValuePrivateFlags.ManuallySet) | (checkAccess ? SetValuePrivateFlags.CheckAccess : 0),
- false);
- }
-
- void SetValueActual(BindableProperty property, BindablePropertyContext context, object value, bool currentlyApplying, bool forceSendChangeSignal, SetValueFlags attributes, bool silent = false)
- {
- object original = context.Value;
- bool raiseOnEqual = (attributes & SetValueFlags.RaiseOnEqual) != 0;
- bool clearDynamicResources = (attributes & SetValueFlags.ClearDynamicResource) != 0;
- bool clearOneWayBindings = (attributes & SetValueFlags.ClearOneWayBindings) != 0;
- bool clearTwoWayBindings = (attributes & SetValueFlags.ClearTwoWayBindings) != 0;
-
- bool same = ReferenceEquals(context.Property, BindingContextProperty) ? ReferenceEquals(value, original) : Equals(value, original);
- if (!silent && (!same || raiseOnEqual))
- {
- property.PropertyChanging?.Invoke(this, original, value);
-
- OnPropertyChanging(property.PropertyName);
- }
-
- if (!same || raiseOnEqual)
- {
- context.Value = value;
- }
-
- context.Attributes &= ~BindableContextAttributes.IsDefaultValue;
- context.Attributes &= ~BindableContextAttributes.IsDefaultValueCreated;
-
- if ((context.Attributes & BindableContextAttributes.IsDynamicResource) != 0 && clearDynamicResources)
- RemoveDynamicResource(property);
-
- BindingBase binding = context.Binding;
- if (binding != null)
- {
- if (clearOneWayBindings && binding.GetRealizedMode(property) == BindingMode.OneWay || clearTwoWayBindings && binding.GetRealizedMode(property) == BindingMode.TwoWay)
- {
- RemoveBinding(property, context);
- binding = null;
- }
- }
-
- if (!silent)
- {
- if ((!same || raiseOnEqual))
- {
- property.PropertyChanged?.Invoke(this, original, value);
-
- if (binding != null && !currentlyApplying)
- {
- _applying = true;
- binding.Apply(true);
- _applying = false;
- }
-
- OnPropertyChanged(property.PropertyName);
- }
- else if (true == same && true == forceSendChangeSignal)
- {
- if (binding != null && !currentlyApplying)
- {
- _applying = true;
- binding.Apply(true);
- _applying = false;
- }
-
- OnPropertyChanged(property.PropertyName);
- }
- }
- }
-
- [Flags]
- enum BindableContextAttributes
- {
- IsManuallySet = 1 << 0,
- IsBeingSet = 1 << 1,
- IsDynamicResource = 1 << 2,
- IsSetFromStyle = 1 << 3,
- IsDefaultValue = 1 << 4,
- IsDefaultValueCreated = 1 << 5,
- }
-
- class BindablePropertyContext
- {
- public BindableContextAttributes Attributes;
- public BindingBase Binding;
- public Queue<SetValueArgs> DelayedSetters;
- public BindableProperty Property;
- public object Value;
- }
-
- [Flags]
- internal enum SetValuePrivateFlags
- {
- None = 0,
- CheckAccess = 1 << 0,
- Silent = 1 << 1,
- ManuallySet = 1 << 2,
- FromStyle = 1 << 3,
- Converted = 1 << 4,
- Default = CheckAccess
- }
-
- class SetValueArgs
- {
- public readonly SetValueFlags Attributes;
- public readonly BindablePropertyContext Context;
- public readonly bool CurrentlyApplying;
- public readonly BindableProperty Property;
- public readonly object Value;
-
- public SetValueArgs(BindableProperty property, BindablePropertyContext context, object value, bool currentlyApplying, SetValueFlags attributes)
- {
- Property = property;
- Context = context;
- Value = value;
- CurrentlyApplying = currentlyApplying;
- Attributes = attributes;
- }
- }
- }
-}
-
-namespace Tizen.NUI.Binding.Internals
-{
- /// <summary>
- /// SetValueFlags. For internal use.
- /// </summary>
- [Flags]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public enum SetValueFlags
- {
- /// <summary>
- /// None.
- /// </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)]
- None = 0,
-
- /// <summary>
- /// Clear OneWay bindings.
- /// </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)]
- ClearOneWayBindings = 1 << 0,
-
- /// <summary>
- /// Clear TwoWay bindings.
- /// </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)]
- ClearTwoWayBindings = 1 << 1,
-
- /// <summary>
- /// Clear dynamic resource.
- /// </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)]
- ClearDynamicResource = 1 << 2,
-
- /// <summary>
- /// Raise or equal.
- /// </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)]
- RaiseOnEqual = 1 << 3
- }
-}
+++ /dev/null
-using System;
-using System.Reflection;
-using System.Windows.Input;
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding
-{
- /// 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 sealed class Command<T> : Command
- {
- /// 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 Command(Action<T> execute)
- : base(o =>
- {
- if (IsValidParameter(o))
- {
- execute((T)o);
- }
- })
- {
- if (execute == null)
- {
- throw new ArgumentNullException(nameof(execute));
- }
- }
-
- /// 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 Command(Action<T> execute, Func<T, bool> canExecute)
- : base(o =>
- {
- if (IsValidParameter(o))
- {
- execute((T)o);
- }
- }, o => IsValidParameter(o) && canExecute((T)o))
- {
- if (execute == null)
- throw new ArgumentNullException(nameof(execute));
- if (canExecute == null)
- throw new ArgumentNullException(nameof(canExecute));
- }
-
- static bool IsValidParameter(object o)
- {
- if (o != null)
- {
- // The parameter isn't null, so we don't have to worry whether null is a valid option
- return o is T;
- }
-
- var t = typeof(T);
-
- // The parameter is null. Is T Nullable?
- if (Nullable.GetUnderlyingType(t) != null)
- {
- return true;
- }
-
- // Not a Nullable, if it's a value type then null is not valid
- return !t.GetTypeInfo().IsValueType;
- }
- }
-
- /// <summary>
- /// Defines an ICommand implementation that wraps a Action.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class Command : ICommand
- {
- readonly Func<object, bool> _canExecute;
- readonly Action<object> _execute;
-
- /// <summary>
- /// Initializes a new instance of the Command class.
- /// </summary>
- /// <param name="execute">An instance to execute when the Command is executed.</param>
- /// 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 Command(Action<object> execute)
- {
- if (execute == null)
- throw new ArgumentNullException(nameof(execute));
-
- _execute = execute;
- }
-
- /// <summary>
- /// Initializes a new instance of the Command class.
- /// </summary>
- /// <param name="execute">An Action to execute when the Command is executed.</param>
- /// 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 Command(Action execute) : this(o => execute())
- {
- if (execute == null)
- throw new ArgumentNullException(nameof(execute));
- }
-
- /// <summary>
- /// Initializes a new instance of the Command class.
- /// </summary>
- /// <param name="execute">An Action to execute when the Command is executed.</param>
- /// <param name="canExecute">A instance indicating if the Command can be executed.</param>
- /// 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 Command(Action<object> execute, Func<object, bool> canExecute) : this(execute)
- {
- if (canExecute == null)
- throw new ArgumentNullException(nameof(canExecute));
-
- _canExecute = canExecute;
- }
-
- /// <summary>
- /// Initializes a new instance of the Command class.
- /// </summary>
- /// <param name="execute">An Action to execute when the Command is executed.</param>
- /// <param name="canExecute">A instance indicating if the Command can be executed.</param>
- /// 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 Command(Action execute, Func<bool> canExecute) : this(o => execute(), o => canExecute())
- {
- if (execute == null)
- throw new ArgumentNullException(nameof(execute));
- if (canExecute == null)
- throw new ArgumentNullException(nameof(canExecute));
- }
-
- /// <summary>
- /// Returns a Boolean indicating if the Command can be exectued with the given parameter.
- /// </summary>
- /// <param name="parameter">An Object used as parameter to determine if the Command can be executed.</param>
- /// <returns>true if the Command can be executed, false otherwise.</returns>
- /// 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 bool CanExecute(object parameter)
- {
- if (_canExecute != null)
- return _canExecute(parameter);
-
- return true;
- }
-
- /// <summary>
- /// Occurs when the target of the Command should reevaluate whether or not the Command can be executed.
- /// </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 event EventHandler CanExecuteChanged;
-
- /// <summary>
- /// Invokes the execute Action.
- /// </summary>
- /// <param name="parameter">An Object used as parameter for the execute Action.</param>
- /// 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 void Execute(object parameter)
- {
- _execute(parameter);
- }
-
- /// <summary>
- /// Send a CanExecuteChanged.
- /// </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 void ChangeCanExecute()
- {
- EventHandler changed = CanExecuteChanged;
- changed?.Invoke(this, EventArgs.Empty);
- }
- }
-}
+++ /dev/null
-/*
- * 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-using System;
-using System.ComponentModel;
-using Tizen.NUI.Binding;
-using Tizen.NUI.BaseComponents;
-using Tizen.NUI.Xaml;
-using System.Collections.Generic;
-using System.IO;
-
-namespace Tizen.NUI
-{
- /// <summary>
- /// The ContentPage class.
- /// </summary>
- [ContentProperty("Content")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class ContentPage : TemplatedPage
- {
- /// 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 View Root {get; internal set;}
-
- /// <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 = (ContentPage)bindable;
- if (newValue != null)
- {
- self.Root.Add((View)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 View Content
- {
- get { return (View)GetValue(ContentProperty); }
- set { SetValue(ContentProperty, value); }
- }
-
- /// <summary>
- /// Method that is called when the binding content changes.
- /// </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)]
- protected override void OnBindingContextChanged()
- {
- base.OnBindingContextChanged();
-
- View content = Content;
- ControlTemplate controlTemplate = ControlTemplate;
- if (content != null && controlTemplate != null)
- {
- SetInheritedBindingContext(content, BindingContext);
- }
- }
-
- internal override void OnControlTemplateChanged(ControlTemplate oldValue, ControlTemplate newValue)
- {
- if (oldValue == null)
- return;
-
- base.OnControlTemplateChanged(oldValue, newValue);
- View content = Content;
- ControlTemplate controlTemplate = ControlTemplate;
- if (content != null && controlTemplate != null)
- {
- SetInheritedBindingContext(content, BindingContext);
- }
- }
-
- /// <summary>
- /// The constructor.
- /// </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 ContentPage(Window win)
- {
- IsCreateByXaml = true;
-
- Root = new View();
- Root.WidthResizePolicy = ResizePolicyType.FillToParent;
- Root.HeightResizePolicy = ResizePolicyType.FillToParent;
-
- win.Add(Root);
- }
-
- /// <summary>
- /// The Resources property.
- /// </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 ResourceDictionary XamlResources
- {
- get
- {
- return Application.Current.XamlResources;
- }
-
- set
- {
- Application.Current.XamlResources = value;
- }
- }
-
- /// <summary>
- /// To make the ContentPage instance be disposed.
- /// </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)]
- 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.
- }
-
- //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(Root != null)
- {
- Window.Instance.Remove(Root);
- Root.Dispose();
- Root = null;
- }
- base.Dispose(type);
- }
-
- /// <summary>
- /// Check whether the content is empty.
- /// </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 bool IsEmpty
- {
- get
- {
- return ( Root.ChildCount == 0 ) ? true : false;
- }
- }
-
- /// <summary>
- /// Clear all contents from this ContentPage.
- /// </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 void ClearContent()
- {
- if ( Root != null )
- {
- //Remove it from the window
- Window.Instance.Remove(Root);
- Root.Dispose();
- Root = null;
-
- //Readd to window
- Root = new View();
- Root.WidthResizePolicy = ResizePolicyType.FillToParent;
- Root.HeightResizePolicy = ResizePolicyType.FillToParent;
- Window.Instance.Add(Root);
-
- ClearHandler();
- }
- }
-
- private EventHandler _clearEventHandler;
-
- /// <summary>
- /// Clear event.
- /// </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 event EventHandler ClearEvent
- {
- add
- {
- _clearEventHandler += value;
- }
- remove
- {
- _clearEventHandler -= value;
- }
- }
-
- private void ClearHandler()
- {
- if (_clearEventHandler != null)
- {
- _clearEventHandler(this, null);
- }
- }
-
- /// <summary>
- /// Users can set focus logic codes here.
- /// </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 virtual void SetFocus() { }
-
- private Dictionary<string, Transition> transDictionary = new Dictionary<string, Transition>();
-
- /// 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 Transition GetTransition(string transitionName)
- {
- Transition trans = null;
- transDictionary.TryGetValue(transitionName, out trans);
- return trans;
- }
-
- private void LoadTransitions()
- {
- foreach (string str in transitionNames)
- {
- string resourceName = str + ".xaml";
- Transition trans = null;
-
- string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
-
- string likelyResourcePath = resource + "animation/" + resourceName;
-
- if (File.Exists(likelyResourcePath))
- {
- trans = Extensions.LoadObject<Transition>(likelyResourcePath);
- }
- if (trans)
- {
- transDictionary.Add(trans.Name, trans);
- }
- }
- }
-
- 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[] TransitionNames
- {
- get
- {
- return transitionNames;
- }
- set
- {
- transitionNames = value;
- LoadTransitions();
- }
- }
- }
-}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Collections.Specialized;
-using System.ComponentModel;
-using System.Runtime.CompilerServices;
-using System.Xml;
-using Tizen.NUI.Binding.Internals;
-
-namespace Tizen.NUI.Binding
-{
- /// <summary>
- /// Provides the base class for all Tizen.NUI.Binding hierarchal elements. This class contains all the methods and properties required to represent an element in the Tizen.NUI.Binding hierarchy.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public abstract partial class Element : BindableObject, IElement, INameScope, IElementController
- {
-
- // public static readonly BindableProperty MenuProperty = BindableProperty.CreateAttached(nameof(Menu), typeof(Menu), typeof(Element), null);
-
- // public static Menu GetMenu(BindableObject bindable)
- // {
- // return (Menu)bindable.GetValue(MenuProperty);
- // }
-
- // public static void SetMenu(BindableObject bindable, Menu menu)
- // {
- // bindable.SetValue(MenuProperty, menu);
- // }
-
- internal static readonly ReadOnlyCollection<Element> EmptyChildren = new ReadOnlyCollection<Element>(new Element[0]);
-
- /// <summary>
- /// Identifies the ClassId bindable property.
- /// </summary>
- internal static readonly BindableProperty ClassIdProperty = BindableProperty.Create("ClassId", typeof(string), typeof(Tizen.NUI.BaseComponents.View), null);
-
- string _automationId;
-
- IList<BindableObject> _bindableResources;
-
- List<Action<object, ResourcesChangedEventArgs>> _changeHandlers;
-
- Dictionary<BindableProperty, string> _dynamicResources;
-
- IEffectControlProvider _effectControlProvider;
-
- TrackableCollection<Effect> _effects;
-
- Guid? _id;
-
- Element _parentOverride;
-
- IPlatform _platform;
-
- string _styleId;
-
- /// <summary>
- /// Gets or sets a value that allows the automation framework to find and interact with this element.
- /// </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 string AutomationId
- {
- get { return _automationId; }
- set
- {
- if (_automationId != null)
- throw new InvalidOperationException("AutomationId may only be set one time");
- _automationId = value;
- }
- }
-
- /// <summary>
- /// Gets or sets a value used to identify a collection of semantically similar elements.
- /// </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 string ClassId
- {
- get { return (string)GetValue(ClassIdProperty); }
- set { SetValue(ClassIdProperty, value); }
- }
-
- internal IList<Effect> Effects
- {
- get
- {
- if (_effects == null)
- {
- _effects = new TrackableCollection<Effect>();
- _effects.CollectionChanged += EffectsOnCollectionChanged;
- _effects.Clearing += EffectsOnClearing;
- }
- return _effects;
- }
- }
-
- /// <summary>
- /// Gets a value that can be used to uniquely identify an element through the run of an application.
- /// </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 Guid Id
- {
- get
- {
- if (!_id.HasValue)
- _id = Guid.NewGuid();
- return _id.Value;
- }
- }
-
- /// <summary>
- /// Gets the element which is the closest ancestor of this element that is a BaseHandle.
- /// </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)]
- [Obsolete("ParentView is obsolete as of version 2.1.0. Please use Parent instead.")]
- public BaseHandle ParentView
- {
- get
- {
- Element parent = Parent;
- while (parent != null)
- {
- var parentView = parent as BaseHandle;
- if (parentView != null)
- return parentView;
- parent = parent.RealParent;
- }
- return null;
- }
- }
-
- /// <summary>
- /// Gets or sets a user defined value to uniquely identify the element.
- /// </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 string StyleId
- {
- get { return _styleId; }
- set
- {
- if (_styleId == value)
- return;
-
- OnPropertyChanging();
- _styleId = value;
- OnPropertyChanged();
- }
- }
-
- internal virtual ReadOnlyCollection<Element> LogicalChildrenInternal => EmptyChildren;
-
- /// <summary>
- /// For internal use.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public ReadOnlyCollection<Element> LogicalChildren => LogicalChildrenInternal;
-
- internal bool Owned { get; set; }
-
- internal Element ParentOverride
- {
- get { return _parentOverride; }
- set
- {
- if (_parentOverride == value)
- return;
-
- bool emitChange = Parent != value;
-
- if (emitChange)
- OnPropertyChanging(nameof(Parent));
-
- _parentOverride = value;
-
- if (emitChange)
- OnPropertyChanged(nameof(Parent));
- }
- }
-
- /// <summary>
- /// For internal use.
- /// </summary>
- internal IPlatform Platform
- {
- get
- {
- if (_platform == null && RealParent != null)
- return RealParent.Platform;
- return _platform;
- }
- set
- {
- if (_platform == value)
- return;
- _platform = value;
- PlatformSet?.Invoke(this, EventArgs.Empty);
- foreach (Element descendant in Descendants())
- {
- descendant._platform = _platform;
- descendant.PlatformSet?.Invoke(this, EventArgs.Empty);
- }
- }
- }
-
- /// <summary>
- /// For internal use.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public Element RealParent { get; private set; }
-
- Dictionary<BindableProperty, string> DynamicResources
- {
- get { return _dynamicResources ?? (_dynamicResources = new Dictionary<BindableProperty, string>()); }
- }
-
- void IElement.AddResourcesChangedListener(Action<object, ResourcesChangedEventArgs> onchanged)
- {
- _changeHandlers = _changeHandlers ?? new List<Action<object, ResourcesChangedEventArgs>>(2);
- _changeHandlers.Add(onchanged);
- }
-
- /// <summary>
- /// Gets or sets the parent element of the element.
- /// </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 Element Parent
- {
- get { return _parentOverride ?? RealParent; }
- set
- {
- if (RealParent == value)
- return;
-
- OnPropertyChanging();
-
- if (RealParent != null)
- ((IElement)RealParent).RemoveResourcesChangedListener(OnParentResourcesChanged);
- RealParent = value;
- if (RealParent != null)
- {
- OnParentResourcesChanged(RealParent?.GetMergedResources());
- ((IElement)RealParent).AddResourcesChangedListener(OnParentResourcesChanged);
- }
-
- object context = value != null ? value.BindingContext : null;
- if (value != null)
- {
- value.SetChildInheritedBindingContext(this, context);
- }
- else
- {
- SetInheritedBindingContext(this, null);
- }
-
- OnParentSet();
-
- if (RealParent != null)
- {
- IPlatform platform = RealParent.Platform;
- if (platform != null)
- Platform = platform;
- }
-
- OnPropertyChanged();
- }
- }
-
- void IElement.RemoveResourcesChangedListener(Action<object, ResourcesChangedEventArgs> onchanged)
- {
- if (_changeHandlers == null)
- return;
- _changeHandlers.Remove(onchanged);
- }
-
- /// <summary>
- /// For internal use.
- /// </summary>
- internal IEffectControlProvider EffectControlProvider
- {
- get { return _effectControlProvider; }
- set
- {
- if (_effectControlProvider == value)
- return;
- if (_effectControlProvider != null && _effects != null)
- {
- foreach (Effect effect in _effects)
- effect?.SendDetached();
- }
- _effectControlProvider = value;
- if (_effectControlProvider != null && _effects != null)
- {
- foreach (Effect effect in _effects)
- {
- if (effect != null)
- AttachEffect(effect);
- }
- }
- }
- }
-
- //void IElementController.SetValueFromRenderer(BindableProperty property, object value) => SetValueFromRenderer(property, value);
-
- /// <summary>
- /// Sets the value of the specified property.
- /// </summary>
- /// <param name="property">The BindableProperty on which to assign a value.</param>
- /// <param name="value">The value to set.</param>
- internal void SetValueFromRenderer(BindableProperty property, object value)
- {
- SetValueCore(property, value);
- }
-
- /// <summary>
- /// Sets the value of the propertyKey.
- /// </summary>
- /// <param name="property">The BindablePropertyKey on which to assign a value.</param>
- /// <param name="value">The value to set.</param>
- internal void SetValueFromRenderer(BindablePropertyKey property, object value)
- {
- SetValueCore(property, value);
- }
-
- /// <summary>
- /// For internal use.
- /// </summary>
- /// <param name="name">The nameof the effect</param>
- /// <returns>true if attached</returns>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public bool EffectIsAttached(string name)
- {
- foreach (var effect in Effects)
- {
- if (effect.ResolveId == name)
- return true;
- }
- return false;
- }
-
- object INameScope.FindByName(string name)
- {
- INameScope namescope = GetNameScope();
- if (namescope == null)
- {
- return null;
- }
- else
- {
- return namescope.FindByName(name);
- }
- }
-
- void INameScope.RegisterName(string name, object scopedElement)
- {
- INameScope namescope = GetNameScope();
- if (namescope == null)
- throw new InvalidOperationException("this element is not in a namescope");
- namescope.RegisterName(name, scopedElement);
- }
-
- [Obsolete]
- void INameScope.RegisterName(string name, object scopedElement, IXmlLineInfo xmlLineInfo)
- {
- INameScope namescope = GetNameScope();
- if (namescope == null)
- throw new InvalidOperationException("this element is not in a namescope");
- namescope.RegisterName(name, scopedElement, xmlLineInfo);
- }
-
- void INameScope.UnregisterName(string name)
- {
- INameScope namescope = GetNameScope();
- if (namescope == null)
- throw new InvalidOperationException("this element is not in a namescope");
- namescope.UnregisterName(name);
- }
-
- internal event EventHandler<ElementEventArgs> ChildAdded;
-
- internal event EventHandler<ElementEventArgs> ChildRemoved;
-
- internal event EventHandler<ElementEventArgs> DescendantAdded;
-
- internal event EventHandler<ElementEventArgs> DescendantRemoved;
-
- /// <summary>
- /// Removes a previously set dynamic resource.
- /// </summary>
- /// <param name="property">The BindableProperty from which to remove the DynamicResource.</param>
- internal new void RemoveDynamicResource(BindableProperty property)
- {
- base.RemoveDynamicResource(property);
- }
-
- /// <summary>
- /// Sets the BindableProperty property of this element to be updated via the DynamicResource with the provided key.
- /// </summary>
- /// <param name="property">The BindableProperty.</param>
- /// <param name="key">The key of the DynamicResource</param>
- internal new void SetDynamicResource(BindableProperty property, string key)
- {
- base.SetDynamicResource(property, key);
- }
-
- /// <summary>
- /// Invoked whenever the binding context of the element changes. Implement this method to add class handling for this event.
- /// </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)]
- protected override void OnBindingContextChanged()
- {
- var gotBindingContext = false;
- object bc = null;
-
- for (var index = 0; index < LogicalChildrenInternal.Count; index++)
- {
- Element child = LogicalChildrenInternal[index];
-
- if (!gotBindingContext)
- {
- bc = BindingContext;
- gotBindingContext = true;
- }
-
- SetChildInheritedBindingContext(child, bc);
- }
-
- if (_bindableResources != null)
- foreach (BindableObject item in _bindableResources)
- {
- SetInheritedBindingContext(item, BindingContext);
- }
-
- base.OnBindingContextChanged();
- }
-
- /// <summary>
- /// Invoked whenever the ChildAdded event needs to be emitted.Implement this method to add class handling for this event.
- /// </summary>
- /// <param name="child">The element that was added.</param>
- /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
- protected virtual void OnChildAdded(Element child)
- {
- child.Parent = this;
- if (Platform != null)
- child.Platform = Platform;
-
- child.ApplyBindings(skipBindingContext: false, fromBindingContextChanged:true);
-
- ChildAdded?.Invoke(this, new ElementEventArgs(child));
-
- OnDescendantAdded(child);
- foreach (Element element in child.Descendants())
- OnDescendantAdded(element);
- }
-
- /// <summary>
- /// Invoked whenever the ChildRemoved event needs to be emitted.Implement this method to add class handling for this event.
- /// </summary>
- /// <param name="child">The element that was removed.</param>
- /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
- protected virtual void OnChildRemoved(Element child)
- {
- child.Parent = null;
-
- ChildRemoved?.Invoke(child, new ElementEventArgs(child));
-
- OnDescendantRemoved(child);
- foreach (Element element in child.Descendants())
- OnDescendantRemoved(element);
- }
-
- /// <summary>
- /// Invoked whenever the Parent of an element is set.Implement this method in order to add behavior when the element is added to a parent.
- /// </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)]
- protected virtual void OnParentSet()
- {
- ParentSet?.Invoke(this, EventArgs.Empty);
- // ApplyStyleSheetsOnParentSet();
- }
-
- /// <summary>
- /// Method that is called when a bound property is changed.
- /// </summary>
- /// <param name="propertyName">The name of the bound property that changed.</param>
- /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
- protected override void OnPropertyChanged([CallerMemberName] string propertyName = null)
- {
- base.OnPropertyChanged(propertyName);
-
- if (_effects == null || _effects.Count == 0)
- return;
-
- var args = new PropertyChangedEventArgs(propertyName);
- foreach (Effect effect in _effects)
- {
- effect?.SendOnElementPropertyChanged(args);
- }
- }
-
- /// <summary>
- /// For internal use.
- /// </summary>
- /// <returns>the elements</returns>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public IEnumerable<Element> Descendants()
- {
- var queue = new Queue<Element>(16);
- queue.Enqueue(this);
-
- while (queue.Count > 0)
- {
- ReadOnlyCollection<Element> children = queue.Dequeue().LogicalChildrenInternal;
- for (var i = 0; i < children.Count; i++)
- {
- Element child = children[i];
- yield return child;
- queue.Enqueue(child);
- }
- }
- }
-
- internal virtual void OnParentResourcesChanged(object sender, ResourcesChangedEventArgs e)
- {
- // if (e == ResourcesChangedEventArgs.StyleSheets)
- // // ApplyStyleSheetsOnParentSet();
- // else
- // OnParentResourcesChanged(e.Values);
- }
-
- internal virtual void OnParentResourcesChanged(IEnumerable<KeyValuePair<string, object>> values)
- {
- OnResourcesChanged(values);
- }
-
- internal override void OnRemoveDynamicResource(BindableProperty property)
- {
- DynamicResources.Remove(property);
-
- if (DynamicResources.Count == 0)
- _dynamicResources = null;
- base.OnRemoveDynamicResource(property);
- }
-
- internal virtual void OnResourcesChanged(object sender, ResourcesChangedEventArgs e)
- {
- OnResourcesChanged(e.Values);
- }
-
- internal void OnResourcesChanged(IEnumerable<KeyValuePair<string, object>> values)
- {
- if (values == null)
- return;
- if (_changeHandlers != null)
- foreach (Action<object, ResourcesChangedEventArgs> handler in _changeHandlers)
- handler(this, new ResourcesChangedEventArgs(values));
- if (_dynamicResources == null)
- return;
- if (_bindableResources == null)
- _bindableResources = new List<BindableObject>();
- foreach (KeyValuePair<string, object> value in values)
- {
- List<BindableProperty> changedResources = null;
- foreach (KeyValuePair<BindableProperty, string> dynR in DynamicResources)
- {
- // when the DynamicResource bound to a BindableProperty is
- // changing then the BindableProperty needs to be refreshed;
- // The .Value is the name of DynamicResouce to which the BindableProperty is bound.
- // The .Key is the name of the DynamicResource whose value is changing.
- if (dynR.Value != value.Key)
- continue;
- changedResources = changedResources ?? new List<BindableProperty>();
- changedResources.Add(dynR.Key);
- }
- if (changedResources == null)
- continue;
- foreach (BindableProperty changedResource in changedResources)
- OnResourceChanged(changedResource, value.Value);
-
- var bindableObject = value.Value as BindableObject;
- if (bindableObject != null && (bindableObject as Element)?.Parent == null)
- {
- if (!_bindableResources.Contains(bindableObject))
- _bindableResources.Add(bindableObject);
- SetInheritedBindingContext(bindableObject, BindingContext);
- }
- }
- }
-
- internal override void OnSetDynamicResource(BindableProperty property, string key)
- {
- base.OnSetDynamicResource(property, key);
- DynamicResources[property] = key;
- object value;
- if (this.TryGetResource(key, out value))
- OnResourceChanged(property, value);
-
- Tizen.NUI.Application.AddResourceChangedCallback(this, (this as Element).OnResourcesChanged);
- }
-
- internal event EventHandler ParentSet;
-
- internal static void SetFlowDirectionFromParent(Element child)
- {
- }
-
- /// <summary>
- /// For internal use.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public event EventHandler PlatformSet;
-
- internal virtual void SetChildInheritedBindingContext(Element child, object context)
- {
- SetInheritedBindingContext(child, context);
- }
-
- internal IEnumerable<Element> VisibleDescendants()
- {
- var queue = new Queue<Element>(16);
- queue.Enqueue(this);
-
- while (queue.Count > 0)
- {
- ReadOnlyCollection<Element> children = queue.Dequeue().LogicalChildrenInternal;
- for (var i = 0; i < children.Count; i++)
- {
- var child = children[i] as BaseHandle;
- if (child == null)
- {
- continue;
- }
- yield return child;
- queue.Enqueue(child);
- }
- }
- }
-
- void AttachEffect(Effect effect)
- {
- if (_effectControlProvider == null)
- return;
- if (effect.IsAttached)
- throw new InvalidOperationException("Cannot attach Effect to multiple sources");
-
- Effect effectToRegister = effect;
- if (effect is RoutingEffect)
- effectToRegister = ((RoutingEffect)effect).Inner;
- _effectControlProvider.RegisterEffect(effectToRegister);
- effectToRegister.Element = this;
- effect.SendAttached();
- }
-
- void EffectsOnClearing(object sender, EventArgs eventArgs)
- {
- foreach (Effect effect in _effects)
- {
- effect?.ClearEffect();
- }
- }
-
- void EffectsOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
- {
- switch (e.Action)
- {
- case NotifyCollectionChangedAction.Add:
- foreach (Effect effect in e.NewItems)
- {
- AttachEffect(effect);
- }
- break;
- case NotifyCollectionChangedAction.Move:
- break;
- case NotifyCollectionChangedAction.Remove:
- foreach (Effect effect in e.OldItems)
- {
- effect.ClearEffect();
- }
- break;
- case NotifyCollectionChangedAction.Replace:
- foreach (Effect effect in e.NewItems)
- {
- AttachEffect(effect);
- }
- foreach (Effect effect in e.OldItems)
- {
- effect.ClearEffect();
- }
- break;
- case NotifyCollectionChangedAction.Reset:
- if (e.NewItems != null)
- {
- foreach (Effect effect in e.NewItems)
- {
- AttachEffect(effect);
- }
- }
- if (e.OldItems != null)
- {
- foreach (Effect effect in e.OldItems)
- {
- effect.ClearEffect();
- }
- }
- break;
- default:
- throw new ArgumentOutOfRangeException();
- }
- }
-
- INameScope GetNameScope()
- {
- INameScope namescope = NameScope.GetNameScope(this);
- Element p = RealParent;
- while (namescope == null && p != null)
- {
- namescope = NameScope.GetNameScope(p);
- p = p.RealParent;
- }
- return namescope;
- }
-
- void OnDescendantAdded(Element child)
- {
- DescendantAdded?.Invoke(this, new ElementEventArgs(child));
-
- if (RealParent != null)
- RealParent.OnDescendantAdded(child);
- }
-
- void OnDescendantRemoved(Element child)
- {
- DescendantRemoved?.Invoke(this, new ElementEventArgs(child));
-
- if (RealParent != null)
- RealParent.OnDescendantRemoved(child);
- }
-
- void OnResourceChanged(BindableProperty property, object value)
- {
- SetValueCore(property, value, SetValueFlags.ClearOneWayBindings | SetValueFlags.ClearTwoWayBindings);
- }
- }
-}
+++ /dev/null
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding
-{
- /// 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 interface IResourcesProvider
- {
- /// <summary>
- /// Check if resources created.
- /// </summary>
- bool IsResourcesCreated { get; }
-
- /// <summary>
- /// Saved xaml resources.
- /// </summary>
- ResourceDictionary XamlResources { get; set; }
- }
-}
+++ /dev/null
-using System;
-using System.Globalization;
-using System.ComponentModel;
-
-namespace Tizen.NUI.Binding
-{
- /// 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 interface IValueConverter
- {
- /// <summary>
- /// Converts a value.
- /// </summary>
- /// <param name="value">The value produced by the binding source.</param>
- /// <param name="targetType">The type of the binding target property.</param>
- /// <param name="parameter">The converter parameter to use.</param>
- /// <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>
- /// <param name="value">The value that is produced by the binding target.</param>
- /// <param name="targetType">The type to convert to.</param>
- /// <param name="parameter">The converter parameter to use.</param>
- /// <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 ConvertBack(object value, Type targetType, object parameter, CultureInfo culture);
- }
-}
+++ /dev/null
-using System.Collections.Generic;
-using System.ComponentModel;
-using Tizen.NUI.Binding.Internals;
-
-namespace Tizen.NUI.Binding
-{
- /// 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 class NameScopeExtensions
- {
- /// 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 FindByName<T>(this Element element, string name)
- {
- return ((INameScope)element).FindByName<T>(name);
- }
-
- internal static T FindByName<T>(this INameScope namescope, string name)
- {
- 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
+++ /dev/null
-/*
- * 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Collections.Specialized;
-using System.ComponentModel;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-using Tizen.NUI.Binding.Internals;
-using Tizen.NUI.Binding;
-
-namespace Tizen.NUI
-{
- /// <summary>
- /// A BaseHandle that occupies the entire screen.
- /// </summary>
- // [RenderWith(typeof(_PageRenderer))]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class Page : /*VisualElement*/BaseHandle, ILayout, IPageController, IElementConfiguration<Page>, IPaddingElement
- {
- /// <summary>
- /// For internal use.
- /// </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 const string BusySetSignalName = "NUI.BusySet";
-
- /// <summary>
- /// For internal use.
- /// </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 const string AlertSignalName = "NUI.SendAlert";
-
- /// <summary>
- /// For internal use.
- /// </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 const string ActionSheetSignalName = "NUI.ShowActionSheet";
-
- internal static readonly BindableProperty IgnoresContainerAreaProperty = BindableProperty.Create("IgnoresContainerArea", typeof(bool), typeof(Page), false);
-
- /// <summary>
- /// Identifies the BackgroundImage property.
- /// </summary>
- internal static readonly BindableProperty BackgroundImageProperty = BindableProperty.Create("BackgroundImage", typeof(string), typeof(Page), default(string));
-
- /// <summary>
- /// Identifies the IsBusy property.
- /// </summary>
- internal static readonly BindableProperty IsBusyProperty = BindableProperty.Create("IsBusy", typeof(bool), typeof(Page), false, propertyChanged: (bo, o, n) => ((Page)bo).OnPageBusyChanged());
-
- /// <summary>
- /// Identifies the Padding property.
- /// </summary>
- internal static readonly BindableProperty PaddingProperty = PaddingElement.PaddingProperty;
-
- /// <summary>
- /// Identifies the Title property.
- /// </summary>
- internal static readonly BindableProperty TitleProperty = BindableProperty.Create("Title", typeof(string), typeof(Page), null);
-
- /// <summary>
- /// Identifies the Icon property.
- /// </summary>
- internal static readonly BindableProperty IconProperty = BindableProperty.Create("Icon", typeof(FileImageSource), typeof(Page), default(FileImageSource));
-
- readonly Lazy<PlatformConfigurationRegistry<Page>> _platformConfigurationRegistry;
-
- Rectangle _containerArea;
-
- bool _containerAreaSet;
-
- bool _hasAppeared;
-
- ReadOnlyCollection<Element> _logicalChildren;
-
- /// <summary>
- /// Creates a new Page element with default values.
- /// </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 Page()
- {
- var toolbarItems = new ObservableCollection<ToolbarItem>();
- toolbarItems.CollectionChanged += OnToolbarItemsCollectionChanged;
- // ToolbarItems = toolbarItems;
- InternalChildren.CollectionChanged += InternalChildrenOnCollectionChanged;
- _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<Page>>(() => new PlatformConfigurationRegistry<Page>(this));
- }
-
- /// <summary>
- /// Identifies the image used as a background for the Page.
- /// </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 string BackgroundImage
- {
- get { return (string)GetValue(BackgroundImageProperty); }
- set { SetValue(BackgroundImageProperty, value); }
- }
-
- internal FileImageSource Icon
- {
- get { return (FileImageSource)GetValue(IconProperty); }
- set { SetValue(IconProperty, value); }
- }
-
- /// <summary>
- /// Marks the Page as busy. This will cause the platform specific global activity indicator to show a busy state.
- /// </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 bool IsBusy
- {
- get { return (bool)GetValue(IsBusyProperty); }
- set { SetValue(IsBusyProperty, value); }
- }
-
- /// <summary>
- /// The space between the content of the Page and it's border.
- /// </summary>
- internal Thickness Padding
- {
- get { return (Thickness)GetValue(PaddingElement.PaddingProperty); }
- set { SetValue(PaddingElement.PaddingProperty, value); }
- }
-
- Thickness IPaddingElement.PaddingDefaultValueCreator()
- {
- return default(Thickness);
- }
-
- void IPaddingElement.OnPaddingPropertyChanged(Thickness oldValue, Thickness newValue)
- {
- UpdateChildrenLayout();
- }
-
- /// <summary>
- /// The Page's title.
- /// </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 string Title
- {
- get { return (string)GetValue(TitleProperty); }
- set { SetValue(TitleProperty, value); }
- }
-
- internal IList<ToolbarItem> ToolbarItems { get;/* internal set;*/ }
-
- /// <summary>
- /// For internal use.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public Rectangle ContainerArea
- {
- get { return _containerArea; }
- set
- {
- if (_containerArea == value)
- return;
- _containerAreaSet = true;
- _containerArea = value;
- ForceLayout();
- }
- }
-
- /// <summary>
- /// For internal use.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public bool IgnoresContainerArea
- {
- get { return (bool)GetValue(IgnoresContainerAreaProperty); }
- set { SetValue(IgnoresContainerAreaProperty, value); }
- }
-
- /// <summary>
- /// For internal use.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public ObservableCollection<Element> InternalChildren { get; } = new ObservableCollection<Element>();
-
- internal override ReadOnlyCollection<Element> LogicalChildrenInternal =>
- _logicalChildren ?? (_logicalChildren = new ReadOnlyCollection<Element>(InternalChildren));
-
- /// <summary>
- /// Raised when the layout of the Page has changed.
- /// </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 event EventHandler LayoutChanged;
-
- /// <summary>
- /// ndicates that the Page is about to appear.
- /// </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 event EventHandler Appearing;
-
- /// <summary>
- /// Indicates that the Page is about to cease displaying.
- /// </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 event EventHandler Disappearing;
-
- /// <summary>
- /// Displays a native platform action sheet, allowing the application user to choose from several buttons.
- /// </summary>
- /// <param name="title">Title of the displayed action sheet. Must not be null.</param>
- /// <param name="cancel">Text to be displayed in the 'Cancel' button. Can be null to hide the cancel action.</param>
- /// <param name="destruction">Text to be displayed in the 'Destruct' button. Can be null to hide the destructive option.</param>
- /// <param name="buttons">Text labels for additional buttons. Must not be null.</param>
- /// <returns>An awaitable Task that displays an action sheet and returns the Text of the button pressed by the user.</returns>
- /// 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 Task<string> DisplayActionSheet(string title, string cancel, string destruction, params string[] buttons)
- {
- var args = new ActionSheetArguments(title, cancel, destruction, buttons);
- MessagingCenter.Send(this, ActionSheetSignalName, args);
- return args.Result.Task;
- }
-
- /// <summary>
- /// Presents an alert dialog to the application user with a single cancel button.
- /// </summary>
- /// <param name="title">The title of the alert dialog.</param>
- /// <param name="message">The body text of the alert dialog.</param>
- /// <param name="cancel">Text to be displayed on the 'Cancel' button.</param>
- /// <returns></returns>
- /// 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 Task DisplayAlert(string title, string message, string cancel)
- {
- return DisplayAlert(title, message, null, cancel);
- }
-
- /// <summary>
- /// resents an alert dialog to the application user with an accept and a cancel button.
- /// </summary>
- /// <param name="title">The title of the alert dialog.</param>
- /// <param name="message">The body text of the alert dialog.</param>
- /// <param name="accept">Text to be displayed on the 'Accept' button.</param>
- /// <param name="cancel">Text to be displayed on the 'Cancel' button.</param>
- /// <returns></returns>
- /// 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 Task<bool> DisplayAlert(string title, string message, string accept, string cancel)
- {
- if (string.IsNullOrEmpty(cancel))
- throw new ArgumentNullException("cancel");
-
- var args = new AlertArguments(title, message, accept, cancel);
- MessagingCenter.Send(this, AlertSignalName, args);
- return args.Result.Task;
- }
-
- /// <summary>
- /// Forces the Page to perform a layout pass.
- /// </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 void ForceLayout()
- {
- }
-
- /// <summary>
- /// Calls OnBackButtonPressed().
- /// </summary>
- /// <returns></returns>
- /// 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 bool SendBackButtonPressed()
- {
- return OnBackButtonPressed();
- }
-
- /// <summary>
- /// Lays out children Elements into the specified area.
- /// </summary>
- /// <param name="x">Left-hand side of layout area.</param>
- /// <param name="y">Top of layout area.</param>
- /// <param name="width">Width of layout area.</param>
- /// <param name="height">Height of layout area.</param>
- /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
- protected virtual void LayoutChildren(double x, double y, double width, double height)
- {
- var area = new Rectangle((int)x, (int)y, (int)width, (int)height);
- Rectangle originalArea = area;
- if (_containerAreaSet)
- {
- area = ContainerArea;
- area.X += (int)Padding.Left;
- area.Y += (int)Padding.Right;
- area.Width -= (int)Padding.HorizontalThickness;
- area.Height -= (int)Padding.VerticalThickness;
- area.Width = Math.Max(0, area.Width);
- area.Height = Math.Max(0, area.Height);
- }
- }
-
- /// <summary>
- /// When overridden, allows application developers to customize behavior immediately prior to the Page becoming visible.
- /// </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)]
- protected virtual void OnAppearing()
- {
- }
-
- /// <summary>
- /// Application developers can override this method to provide behavior when the back button is pressed.
- /// </summary>
- /// <returns>true if consumed</returns>
- /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
- protected virtual bool OnBackButtonPressed()
- {
- var application = RealParent as Application;
-
- var canceled = false;
- EventHandler handler = (sender, args) => { canceled = true; };
- Navigation.PopModalAsync().ContinueWith(t => { throw t.Exception; }, CancellationToken.None, TaskContinuationOptions.OnlyOnFaulted, TaskScheduler.FromCurrentSynchronizationContext());
-
- return !canceled;
- }
-
- /// <summary>
- /// Invoked whenever the binding context of the Page changes. Override this method to add class handling for this event.
- /// </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)]
- protected override void OnBindingContextChanged()
- {
- base.OnBindingContextChanged();
- }
-
- /// <summary>
- /// Indicates that the preferred size of a child Element has changed.
- /// </summary>
- /// <param name="sender">The object that raised the event.</param>
- /// <param name="e">The event arguments.</param>
- /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
- protected virtual void OnChildMeasureInvalidated(object sender, EventArgs e)
- {
- InvalidationTrigger trigger = (e as InvalidationEventArgs)?.Trigger ?? InvalidationTrigger.Undefined;
- OnChildMeasureInvalidated((BaseHandle)sender, trigger);
- }
-
- /// <summary>
- /// When overridden, allows the application developer to customize behavior as the Page disappears.
- /// </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)]
- protected virtual void OnDisappearing()
- {
- }
-
- /// <summary>
- /// Called when the Page's Parent property has changed.
- /// </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)]
- protected override void OnParentSet()
- {
- base.OnParentSet();
- }
-
- /// <summary>
- /// Requests that the children Elements of the Page update their layouts.
- /// </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)]
- protected void UpdateChildrenLayout()
- {
- if (!ShouldLayoutChildren())
- return;
-
- double x = Padding.Left;
- double y = Padding.Top;
-
- for (var i = 0; i < LogicalChildren.Count; i++)
- {
- LayoutChanged?.Invoke(this, EventArgs.Empty);
- }
- }
-
- internal virtual void OnChildMeasureInvalidated(BaseHandle child, InvalidationTrigger trigger)
- {
- var container = this as IPageContainer<Page>;
- if (container != null)
- {
- Page page = container.CurrentPage;
- if (page != null)
- {
- return;
- }
- }
- else
- {
- for (var i = 0; i < LogicalChildren.Count; i++)
- {
- var v = LogicalChildren[i] as BaseHandle;
- if (v != null)
- {
- return;
- }
- }
- }
- }
-
- /// <summary>
- /// For intarnal use.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public void SendAppearing()
- {
- if (_hasAppeared)
- return;
-
- _hasAppeared = true;
-
- if (IsBusy)
- MessagingCenter.Send(this, BusySetSignalName, true);
-
- OnAppearing();
- Appearing?.Invoke(this, EventArgs.Empty);
-
- var pageContainer = this as IPageContainer<Page>;
- pageContainer?.CurrentPage?.SendAppearing();
- }
-
- /// <summary>
- /// For intarnal use.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public void SendDisappearing()
- {
- if (!_hasAppeared)
- return;
-
- _hasAppeared = false;
-
- if (IsBusy)
- MessagingCenter.Send(this, BusySetSignalName, false);
-
- var pageContainer = this as IPageContainer<Page>;
- pageContainer?.CurrentPage?.SendDisappearing();
-
- OnDisappearing();
- Disappearing?.Invoke(this, EventArgs.Empty);
- }
-
- Application FindApplication(Element element)
- {
- if (element == null)
- return null;
-
- return (element.Parent is Application app) ? app : FindApplication(element.Parent);
- }
-
- void InternalChildrenOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
- {
- if (e.OldItems != null)
- {
- foreach (BaseHandle item in e.OldItems.OfType<BaseHandle>())
- {
- OnInternalRemoved(item);
- }
- }
-
- if (e.NewItems != null)
- {
- foreach (BaseHandle item in e.NewItems.OfType<BaseHandle>())
- {
- OnInternalAdded(item);
- }
- }
- }
-
- private void OnInternalAdded(BaseHandle view)
- {
- OnChildAdded(view);
- }
-
- private void OnInternalRemoved(BaseHandle view)
- {
- OnChildRemoved(view);
- }
-
- void OnPageBusyChanged()
- {
- if (!_hasAppeared)
- return;
-
- MessagingCenter.Send(this, BusySetSignalName, IsBusy);
- }
-
- void OnToolbarItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs args)
- {
- if (args.Action != NotifyCollectionChangedAction.Add)
- return;
- foreach (IElement item in args.NewItems)
- item.Parent = this;
- }
-
- bool ShouldLayoutChildren()
- {
- if (!LogicalChildren.Any())
- {
- return false;
- }
-
- var container = this as IPageContainer<Page>;
- if (container?.CurrentPage != null)
- {
- return true;
- }
-
- var any = false;
- for (var i = 0; i < LogicalChildren.Count; i++)
- {
- var v = LogicalChildren[i] as BaseHandle;
- if (v != null)
- {
- any = true;
- break;
- }
- }
- return !any;
- }
-
- /// <summary>
- /// Returns the platform-specific instance of this Page, on which a platform-specific method may be called.
- /// </summary>
- /// <typeparam name="T">The platform for which to return an instance.</typeparam>
- /// <returns>The platform-specific instance of this Page</returns>
- internal IPlatformElementConfiguration<T, Page> On<T>() where T : IConfigPlatform
- {
- return _platformConfigurationRegistry.Value.On<T>();
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Collections.Specialized;
-using System.ComponentModel;
-using System.Globalization;
-using System.Linq;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-using Tizen.NUI.Binding.Internals;
-using Tizen.NUI.Xaml;
-
-namespace Tizen.NUI.Binding
-{
- /// 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 ResourceDictionary : IResourceDictionary, IDictionary<string, object>
- {
- static ConditionalWeakTable<Type, ResourceDictionary> s_instances = new ConditionalWeakTable<Type, ResourceDictionary>();
- readonly Dictionary<string, object> _innerDictionary = new Dictionary<string, object>();
- ResourceDictionary _mergedInstance;
- Type _mergedWith;
- Uri _source;
-
- /// 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 ResourceDictionary()
- {
- DependencyService.Register<IResourcesLoader, ResourcesLoader>();
- }
-
- /// <summary>
- /// Gets or sets the type of object with which the resource dictionary is merged.
- /// </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)]
- [TypeConverter(typeof(TypeTypeConverter))]
- [Obsolete("Use Source")]
- public Type MergedWith {
- get { return _mergedWith; }
- set {
- if (_mergedWith == value)
- return;
-
- if (_source != null)
- throw new ArgumentException("MergedWith can not be used with Source");
-
- if (!typeof(ResourceDictionary).GetTypeInfo().IsAssignableFrom(value.GetTypeInfo()))
- throw new ArgumentException("MergedWith should inherit from ResourceDictionary");
-
- _mergedWith = value;
- if (_mergedWith == null)
- return;
-
- _mergedInstance = s_instances.GetValue(_mergedWith, (key) => (ResourceDictionary)Activator.CreateInstance(key));
- OnValuesChanged(_mergedInstance.ToArray());
- }
- }
-
- /// <summary>
- /// Gets or sets the URI of the merged resource dictionary.
- /// </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)]
- [TypeConverter(typeof(RDSourceTypeConverter))]
- public Uri Source {
- get { return _source; }
- set {
- if (_source == value)
- return;
- throw new InvalidOperationException("Source can only be set from XAML."); //through the RDSourceTypeConverter
- }
- }
-
- /// <summary>
- /// To set and load source.
- /// </summary>
- /// <param name="value">The source.</param>
- /// <param name="resourcePath">The resource path.</param>
- /// <param name="assembly">The assembly.</param>
- /// <param name="lineInfo">The xml line info.</param>
- /// Used by the XamlC compiled converter.
- [EditorBrowsable(EditorBrowsableState.Never)]
- public void SetAndLoadSource(Uri value, string resourcePath, Assembly assembly, System.Xml.IXmlLineInfo lineInfo)
- {
- _source = value;
- if (_mergedWith != null)
- throw new ArgumentException("Source can not be used with MergedWith");
-
- //this will return a type if the RD as an x:Class element, and codebehind
- var type = XamlResourceIdAttribute.GetTypeForPath(assembly, resourcePath);
- if (type != null)
- _mergedInstance = s_instances.GetValue(type, (key) => (ResourceDictionary)Activator.CreateInstance(key));
- else
- _mergedInstance = DependencyService.Get<IResourcesLoader>()?.CreateFromResource<ResourceDictionary>(resourcePath, assembly, lineInfo);
- OnValuesChanged(_mergedInstance.ToArray());
- }
-
- ICollection<ResourceDictionary> _mergedDictionaries;
-
- /// 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 ICollection<ResourceDictionary> MergedDictionaries {
- get {
- if (_mergedDictionaries == null) {
- var col = new ObservableCollection<ResourceDictionary>();
- col.CollectionChanged += MergedDictionaries_CollectionChanged;
- _mergedDictionaries = col;
- }
- return _mergedDictionaries;
- }
- }
-
- internal IList<StyleSheets.StyleSheet> StyleSheets { get; set; }
-
- void StyleSheetsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
- {
- switch (e.Action) {
- case NotifyCollectionChangedAction.Add:
- ValuesChanged?.Invoke(this, ResourcesChangedEventArgs.StyleSheets);
- break;
- }
- }
- IList<ResourceDictionary> _collectionTrack;
-
- void MergedDictionaries_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
- {
- // Move() isn't exposed by ICollection
- if (e.Action == NotifyCollectionChangedAction.Move)
- return;
-
- _collectionTrack = _collectionTrack ?? new List<ResourceDictionary>();
- // Collection has been cleared
- if (e.Action == NotifyCollectionChangedAction.Reset) {
- foreach (var dictionary in _collectionTrack)
- dictionary.ValuesChanged -= Item_ValuesChanged;
-
- _collectionTrack.Clear();
- return;
- }
-
- // New Items
- if (e.NewItems != null)
- {
- foreach (var item in e.NewItems)
- {
- var rd = (ResourceDictionary)item;
- _collectionTrack.Add(rd);
- rd.ValuesChanged += Item_ValuesChanged;
- OnValuesChanged(rd.ToArray());
- }
- }
-
- // Old Items
- if (e.OldItems != null)
- {
- foreach (var item in e.OldItems)
- {
- var rd = (ResourceDictionary)item;
- rd.ValuesChanged -= Item_ValuesChanged;
- _collectionTrack.Remove(rd);
- }
- }
- }
-
- void Item_ValuesChanged(object sender, ResourcesChangedEventArgs e)
- {
- OnValuesChanged(e.Values.ToArray());
- }
-
- void ICollection<KeyValuePair<string, object>>.Add(KeyValuePair<string, object> item)
- {
- ((ICollection<KeyValuePair<string, object>>)_innerDictionary).Add(item);
- OnValuesChanged(item);
- }
-
- /// 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 void Clear()
- {
- _innerDictionary.Clear();
- }
-
- bool ICollection<KeyValuePair<string, object>>.Contains(KeyValuePair<string, object> item)
- {
- return ((ICollection<KeyValuePair<string, object>>)_innerDictionary).Contains(item)
- || (_mergedInstance != null && _mergedInstance.Contains(item));
- }
-
- void ICollection<KeyValuePair<string, object>>.CopyTo(KeyValuePair<string, object>[] array, int arrayIndex)
- {
- ((ICollection<KeyValuePair<string, object>>)_innerDictionary).CopyTo(array, arrayIndex);
- }
-
- /// 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 Count
- {
- get { return _innerDictionary.Count; }
- }
-
- bool ICollection<KeyValuePair<string, object>>.IsReadOnly
- {
- get { return ((ICollection<KeyValuePair<string, object>>)_innerDictionary).IsReadOnly; }
- }
-
- bool ICollection<KeyValuePair<string, object>>.Remove(KeyValuePair<string, object> item)
- {
- return ((ICollection<KeyValuePair<string, object>>)_innerDictionary).Remove(item);
- }
-
- /// 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 void Add(string key, object value)
- {
- if (ContainsKey(key))
- throw new ArgumentException($"A resource with the key '{key}' is already present in the ResourceDictionary.");
- _innerDictionary.Add(key, value);
- OnValueChanged(key, value);
- }
-
- /// 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 bool ContainsKey(string key)
- {
- return _innerDictionary.ContainsKey(key);
- }
-
- /// <summary>
- /// Gets or sets the value according to index.
- /// </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)]
- [IndexerName("Item")]
- public object this[string index]
- {
- get
- {
- if (_innerDictionary.ContainsKey(index))
- return _innerDictionary[index];
- if (_mergedInstance != null && _mergedInstance.ContainsKey(index))
- return _mergedInstance[index];
- if (MergedDictionaries != null)
- foreach (var dict in MergedDictionaries.Reverse())
- if (dict.ContainsKey(index))
- return dict[index];
- throw new KeyNotFoundException($"The resource '{index}' is not present in the dictionary.");
- }
- set
- {
- _innerDictionary[index] = value;
- OnValueChanged(index, value);
- }
- }
-
- /// 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 ICollection<string> Keys
- {
- get { return _innerDictionary.Keys; }
- }
-
- /// 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 bool Remove(string key)
- {
- return _innerDictionary.Remove(key);
- }
-
- /// 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 ICollection<object> Values
- {
- get { return _innerDictionary.Values; }
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
-
- /// 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 IEnumerator<KeyValuePair<string, object>> GetEnumerator()
- {
- return _innerDictionary.GetEnumerator();
- }
-
- internal IEnumerable<KeyValuePair<string, object>> MergedResources {
- get {
- if (MergedDictionaries != null)
- foreach (var r in MergedDictionaries.Reverse().SelectMany(x => x.MergedResources))
- yield return r;
- if (_mergedInstance != null)
- foreach (var r in _mergedInstance.MergedResources)
- yield return r;
- foreach (var r in _innerDictionary)
- yield return r;
- }
- }
-
- /// 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 bool TryGetValue(string key, out object value)
- {
- return _innerDictionary.TryGetValue(key, out value)
- || (_mergedInstance != null && _mergedInstance.TryGetValue(key, out value))
- || (MergedDictionaries != null && TryGetMergedDictionaryValue(key, out value));
- }
-
- bool TryGetMergedDictionaryValue(string key, out object value)
- {
- foreach (var dictionary in MergedDictionaries.Reverse())
- if (dictionary.TryGetValue(key, out value))
- return true;
-
- value = null;
- return false;
- }
-
- event EventHandler<ResourcesChangedEventArgs> IResourceDictionary.ValuesChanged
- {
- add { ValuesChanged += value; }
- remove { ValuesChanged -= value; }
- }
-
- internal void Add(Style style)
- {
- if (string.IsNullOrEmpty(style.Class))
- Add(style.TargetType.FullName, style);
- else
- {
- IList<Style> classes;
- object outclasses;
- if (!TryGetValue(Style.StyleClassPrefix + style.Class, out outclasses) || (classes = outclasses as IList<Style>) == null)
- classes = new List<Style>();
- classes.Add(style);
- this[Style.StyleClassPrefix + style.Class] = classes;
- }
- }
-
- /// 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 void Add(ResourceDictionary mergedResourceDictionary)
- {
- MergedDictionaries.Add(mergedResourceDictionary);
- }
-
- internal void Add(StyleSheets.StyleSheet styleSheet)
- {
- StyleSheets = StyleSheets ?? new List<StyleSheets.StyleSheet>(2);
- StyleSheets.Add(styleSheet);
- ValuesChanged?.Invoke(this, ResourcesChangedEventArgs.StyleSheets);
- }
-
- void OnValueChanged(string key, object value)
- {
- OnValuesChanged(new KeyValuePair<string, object>(key, value));
- }
-
- void OnValuesChanged(params KeyValuePair<string, object>[] values)
- {
- if (values == null || values.Length == 0)
- return;
- ValuesChanged?.Invoke(this, new ResourcesChangedEventArgs(values));
- }
-
- event EventHandler<ResourcesChangedEventArgs> ValuesChanged;
-
- [Xaml.ProvideCompiled("Tizen.NUI.Xaml.Core.XamlC.RDSourceTypeConverter")]
- internal class RDSourceTypeConverter : TypeConverter, IExtendedTypeConverter
- {
- object IExtendedTypeConverter.ConvertFromInvariantString(string value, IServiceProvider serviceProvider)
- {
- if (serviceProvider == null)
- throw new ArgumentNullException(nameof(serviceProvider));
-
- var targetRD = (serviceProvider.GetService(typeof(Xaml.IProvideValueTarget)) as Xaml.IProvideValueTarget)?.TargetObject as ResourceDictionary;
- if (targetRD == null)
- return null;
-
- var rootObjectType = (serviceProvider.GetService(typeof(Xaml.IRootObjectProvider)) as Xaml.IRootObjectProvider)?.RootObject.GetType();
- if (rootObjectType == null)
- return null;
-
- var lineInfo = (serviceProvider.GetService(typeof(Xaml.IXmlLineInfoProvider)) as Xaml.IXmlLineInfoProvider)?.XmlLineInfo;
- var rootTargetPath = XamlResourceIdAttribute.GetPathForType(rootObjectType);
- var uri = new Uri(value, UriKind.Relative); //we don't want file:// uris, even if they start with '/'
- var resourcePath = GetResourcePath(uri, rootTargetPath);
-
- targetRD.SetAndLoadSource(uri, resourcePath, rootObjectType.GetTypeInfo().Assembly, lineInfo);
- return uri;
- }
-
- internal static string GetResourcePath(Uri uri, string rootTargetPath)
- {
- //need a fake scheme so it's not seen as file:// uri, and the forward slashes are valid on all plats
- var resourceUri = uri.OriginalString.StartsWith("/", StringComparison.Ordinal)
- ? new Uri($"pack://{uri.OriginalString}", UriKind.Absolute)
- : new Uri($"pack:///{rootTargetPath}/../{uri.OriginalString}", UriKind.Absolute);
-
- //drop the leading '/'
- return resourceUri.AbsolutePath.Substring(1);
- }
-
- object IExtendedTypeConverter.ConvertFrom(CultureInfo culture, object value, IServiceProvider serviceProvider)
- {
- throw new NotImplementedException();
- }
-
- public override object ConvertFromInvariantString(string value)
- {
- throw new NotImplementedException();
- }
- }
- }
-}
+++ /dev/null
-using System.Collections.Generic;
-using System.ComponentModel;
-using Tizen.NUI.Binding;
-
-namespace Tizen.NUI
-{
- /// <summary>
- /// A page that displays full-screen content with a control template, and the base class for ContentPage.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class TemplatedPage : Page, IControlTemplated
- {
- /// <summary>
- /// Backing store for the ControlTemplate property.
- /// </summary>
- internal static readonly BindableProperty ControlTemplateProperty = BindableProperty.Create(nameof(ControlTemplate), typeof(ControlTemplate), typeof(TemplatedPage), null,
- propertyChanged: TemplateUtilities.OnControlTemplateChanged);
-
- /// <summary>
- /// Gets or sets the control template that is used to display content.
- /// </summary>
- internal ControlTemplate ControlTemplate
- {
- get { return (ControlTemplate)GetValue(ControlTemplateProperty); }
- set { SetValue(ControlTemplateProperty, value); }
- }
-
- IList<Element> IControlTemplated.InternalChildren => InternalChildren;
-
- // internal override void ComputeConstraintForView(View view)
- // {
- // LayoutOptions vOptions = view.VerticalOptions;
- // LayoutOptions hOptions = view.HorizontalOptions;
-
- // var result = LayoutConstraint.None;
- // if (vOptions.Alignment == LayoutAlignment.Fill)
- // result |= LayoutConstraint.VerticallyFixed;
- // if (hOptions.Alignment == LayoutAlignment.Fill)
- // result |= LayoutConstraint.HorizontallyFixed;
-
- // view.ComputedConstraint = result;
- // }
-
- internal override void SetChildInheritedBindingContext(Element child, object context)
- {
- if (ControlTemplate == null)
- base.SetChildInheritedBindingContext(child, context);
- }
-
- void IControlTemplated.OnControlTemplateChanged(ControlTemplate oldValue, ControlTemplate newValue)
- {
- OnControlTemplateChanged(oldValue, newValue);
- }
-
- internal virtual void OnControlTemplateChanged(ControlTemplate oldValue, ControlTemplate newValue)
- {
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-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 AnimationBehavior
- {
- 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 Key
- {
- get
- {
- return _key;
- }
- set
- {
- _key = value;
- }
- }
-
- 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 string Property
- {
- get
- {
- return _property;
- }
- set
- {
- _property = 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 string DestValue
- {
- get
- {
- return _destValue;
- }
- set
- {
- _destValue = value;
- }
- }
-
- 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 int StartTime
- {
- get
- {
- return _startTime;
- }
- set
- {
- _startTime = value;
- }
- }
-
- 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 int EndTime
- {
- get
- {
- return _endTime;
- }
- set
- {
- _endTime = value;
- }
- }
- }
-
- /// <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 Name
- {
- get
- {
- return name;
- }
- set
- {
- name = value;
- }
- }
-
- 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 AnimationBehavior[] Behaviors
- {
- set
- {
- if (null != value)
- {
- foreach (AnimationBehavior behavior in value)
- {
- behaviors.Add(behavior.Key, behavior);
- }
- }
- }
- }
-
- /// <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 void AnimateTo(View instance, string behaviorKey)
- {
- AnimationBehavior behavior = null;
- behaviors.TryGetValue(behaviorKey, out behavior);
-
- if (null != behavior)
- {
- 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);
- }
- }
- }
- }
- else
- {
- 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 void AnimateBy(View instance, string behaviorKey)
- {
- AnimationBehavior behavior = null;
- behaviors.TryGetValue(behaviorKey, out behavior);
-
- if (null != behavior)
- {
- 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)
- {
- 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
+++ /dev/null
-using System;
-using System.Diagnostics;
-using System.ComponentModel;
-
-namespace Tizen.NUI
-{
- /// <summary>
- /// Specifies a mapping on a per-assembly basis between a XAML namespace and a CLR namespace,<br />
- /// which is then used for type resolution by a XAML object writer or XAML schema context.
- /// </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)]
- [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
- [DebuggerDisplay("{XmlNamespace}, {ClrNamespace}, {AssemblyName}")]
- public sealed class XmlnsDefinitionAttribute : Attribute
- {
- /// 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 XmlNamespace { get; }
-
- /// 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 ClrNamespace { get; }
-
- /// 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 AssemblyName { get; set; }
-
- /// 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 XmlnsDefinitionAttribute(string xmlNamespace, string clrNamespace)
- {
- if (xmlNamespace == null)
- throw new ArgumentNullException(nameof(xmlNamespace));
- if (clrNamespace == null)
- throw new ArgumentNullException(nameof(clrNamespace));
-
- ClrNamespace = clrNamespace;
- XmlNamespace = xmlNamespace;
- }
- }
-}
\ No newline at end of file