From: Jiyun Yang Date: Tue, 25 May 2021 08:26:10 +0000 (+0900) Subject: [NUI] Fix BindableObject.SetValue to allow Selector types flexibly X-Git-Tag: accepted/tizen/unified/20231205.024657~1850 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=67a529a433fb101189bec31e537c7364724b1127;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [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 --- 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;