From 79a1154bb9e9abea021f8eddefdb701a6b5fd418 Mon Sep 17 00:00:00 2001 From: Fang Xiaohui Date: Mon, 23 Aug 2021 14:39:12 +0800 Subject: [PATCH] [Xaml] Modify by HQ's feedback --- .../src/internal/Xaml/ApplyPropertiesVisitor.cs | 17 +++++------------ .../internal/Xaml/VisualState/VisualStateManager.cs | 12 ++++++------ .../public/XamlBinding/BindablePropertyConverter.cs | 2 +- src/Tizen.NUI/src/public/XamlBinding/XamlStyle.cs | 18 +----------------- 4 files changed, 13 insertions(+), 36 deletions(-) diff --git a/src/Tizen.NUI/src/internal/Xaml/ApplyPropertiesVisitor.cs b/src/Tizen.NUI/src/internal/Xaml/ApplyPropertiesVisitor.cs index f2ffb5d..0ca6d91 100755 --- a/src/Tizen.NUI/src/internal/Xaml/ApplyPropertiesVisitor.cs +++ b/src/Tizen.NUI/src/internal/Xaml/ApplyPropertiesVisitor.cs @@ -632,21 +632,14 @@ namespace Tizen.NUI.Xaml static private object GetConvertedValue(Type valueType, object value, Func minfoRetriever, XamlServiceProvider serviceProvider) { - try - { - object convertedValue = value.ConvertTo(valueType, minfoRetriever, serviceProvider); - - if (convertedValue != null && !valueType.IsInstanceOfType(convertedValue)) - { - return null; - } + object convertedValue = value.ConvertTo(valueType, minfoRetriever, serviceProvider); - return convertedValue; - } - catch + if (convertedValue != null && !valueType.IsInstanceOfType(convertedValue)) { - return null; + convertedValue = null; } + + return convertedValue; } static bool TryGetProperty(object element, string localName, out object value, HydrationContext context, out Exception exception, out object targetProperty) diff --git a/src/Tizen.NUI/src/internal/Xaml/VisualState/VisualStateManager.cs b/src/Tizen.NUI/src/internal/Xaml/VisualState/VisualStateManager.cs index 11d571d..1f0c8d3 100755 --- a/src/Tizen.NUI/src/internal/Xaml/VisualState/VisualStateManager.cs +++ b/src/Tizen.NUI/src/internal/Xaml/VisualState/VisualStateManager.cs @@ -35,7 +35,7 @@ namespace Tizen.NUI.Xaml private static VisualStateGroupList visualStateGroups; public static readonly BindableProperty VisualStateGroupsProperty = - BindableProperty.CreateAttached("VisualStateGroups", typeof(VisualStateGroupList), typeof(/*VisualElement*/BaseHandle), + BindableProperty.CreateAttached("VisualStateGroups", typeof(VisualStateGroupList), typeof(BaseHandle), defaultValue: null, propertyChanged: VisualStateGroupsPropertyChanged, defaultValueCreator: (BindableObject obj)=> { @@ -49,20 +49,20 @@ namespace Tizen.NUI.Xaml static void VisualStateGroupsPropertyChanged(BindableObject bindable, object oldValue, object newValue) { - GoToState((/*VisualElement*/BaseHandle)bindable, CommonStates.Normal); + GoToState((BaseHandle)bindable, CommonStates.Normal); } - public static IList GetVisualStateGroups(/*VisualElement*/BaseHandle visualElement) + public static IList GetVisualStateGroups(BaseHandle visualElement) { return (IList)visualElement.GetValue(VisualStateGroupsProperty); } - public static void SetVisualStateGroups(/*VisualElement*/BaseHandle visualElement, VisualStateGroupList value) + public static void SetVisualStateGroups(BaseHandle visualElement, VisualStateGroupList value) { visualElement.SetValue(VisualStateGroupsProperty, value); } - public static bool GoToState(/*VisualElement*/BaseHandle visualElement, string name) + public static bool GoToState(BaseHandle visualElement, string name) { if (!visualElement.IsSet(VisualStateGroupsProperty)) { @@ -110,7 +110,7 @@ namespace Tizen.NUI.Xaml return false; } - public static bool HasVisualStateGroups(this /*VisualElement*/BaseHandle element) + public static bool HasVisualStateGroups(this BaseHandle element) { return element.IsSet(VisualStateGroupsProperty); } diff --git a/src/Tizen.NUI/src/public/XamlBinding/BindablePropertyConverter.cs b/src/Tizen.NUI/src/public/XamlBinding/BindablePropertyConverter.cs index 58e2d7e..8cbff47 100755 --- a/src/Tizen.NUI/src/public/XamlBinding/BindablePropertyConverter.cs +++ b/src/Tizen.NUI/src/public/XamlBinding/BindablePropertyConverter.cs @@ -141,7 +141,7 @@ namespace Tizen.NUI.Binding var vsTarget = parents[3]; // Are these Visual States directly on a VisualElement? - if (vsTarget is /*VisualElement*/BaseHandle) + if (vsTarget is BaseHandle) { return vsTarget.GetType(); } diff --git a/src/Tizen.NUI/src/public/XamlBinding/XamlStyle.cs b/src/Tizen.NUI/src/public/XamlBinding/XamlStyle.cs index c8f0fad..6f9b768 100755 --- a/src/Tizen.NUI/src/public/XamlBinding/XamlStyle.cs +++ b/src/Tizen.NUI/src/public/XamlBinding/XamlStyle.cs @@ -6,8 +6,6 @@ using System.ComponentModel; namespace Tizen.NUI.Binding { - /// 6 - /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] [ContentProperty("Setters")] public sealed class XamlStyle : IStyle @@ -27,8 +25,6 @@ namespace Tizen.NUI.Binding IList _triggers; - /// 6 - /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public XamlStyle([TypeConverter(typeof(TypeTypeConverter))][Parameter("TargetType")] Type targetType) { @@ -39,13 +35,9 @@ namespace Tizen.NUI.Binding Setters = new List(); } - /// 6 - /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public bool ApplyToDerivedTypes { get; set; } - /// 6 - /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public XamlStyle BasedOn { @@ -64,8 +56,6 @@ namespace Tizen.NUI.Binding } } - /// 6 - /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public string BaseResourceKey { @@ -95,19 +85,15 @@ namespace Tizen.NUI.Binding get { return _behaviors ?? (_behaviors = new AttachedCollection()); } } - /// This will be public opened in tizen_6.0 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_6.0 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_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public IList 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 Triggers { @@ -122,8 +108,6 @@ namespace Tizen.NUI.Binding ApplyCore(bindable, BasedOn ?? GetBasedOnResource(bindable)); } - /// 6 - /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public Type TargetType { get; } @@ -184,7 +168,7 @@ namespace Tizen.NUI.Binding static void OnBasedOnResourceChanged(BindableObject bindable, object oldValue, object newValue) { - // Style style = (bindable as /*VisualElement*/BaseHandle).Style; + // Style style = (bindable as BaseHandle).Style; // if (style == null) // return; // style.UnApplyCore(bindable, (Style)oldValue); -- 2.7.4