From 67a529a433fb101189bec31e537c7364724b1127 Mon Sep 17 00:00:00 2001 From: Jiyun Yang Date: Tue, 25 May 2021 17:26:10 +0900 Subject: [PATCH] [NUI] Fix BindableObject.SetValue to allow Selector types flexibly When the flag isCreateByXaml is true, the BindableObject.SetValue is comparing types strictly. But some bindable properties, such as BackgroundColor, are designed to allow both types: Color and Selector. Hence this patch allows BindableObject.SetValue to take both types. Signed-off-by: Jiyun Yang --- src/Tizen.NUI/src/public/XamlBinding/BindableProperty.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Tizen.NUI/src/public/XamlBinding/BindableProperty.cs b/src/Tizen.NUI/src/public/XamlBinding/BindableProperty.cs index 896f1bf..5129ec6 100755 --- a/src/Tizen.NUI/src/public/XamlBinding/BindableProperty.cs +++ b/src/Tizen.NUI/src/public/XamlBinding/BindableProperty.cs @@ -622,6 +622,12 @@ namespace Tizen.NUI.Binding Type valueType = value.GetType(); Type type = ReturnType; + // TODO This is temporary fix before deleting CreateByXaml flag in BindableProperty. + if (valueType.IsGenericType && valueType.GetGenericTypeDefinition() == typeof(Tizen.NUI.BaseComponents.Selector<>) && valueType.GetGenericArguments()[0] == ReturnType) + { + return true; + } + // Dont support arbitrary IConvertible by limiting which types can use this Type[] convertableTo; TypeConverter typeConverterTo; -- 2.7.4