diff --git a/src/Tizen.NUI.Components/Controls/Tab.cs b/src/Tizen.NUI.Components/Controls/Tab.cs index 42ea67655c2..42c9a33ce4a 100755 --- a/src/Tizen.NUI.Components/Controls/Tab.cs +++ b/src/Tizen.NUI.Components/Controls/Tab.cs @@ -18,6 +18,7 @@ using System.Collections.Generic; using Tizen.NUI.BaseComponents; using System.ComponentModel; +using Tizen.NUI.Binding; namespace Tizen.NUI.Components { @@ -38,7 +39,34 @@ public partial class Tab : Control private Extents space; private TabStyle tabStyle => ViewStyle as TabStyle; - static Tab() { } + static Tab() + { + if (NUIApplication.IsUsingXaml) + { + SelectedItemIndexProperty = BindableProperty.Create(nameof(SelectedItemIndex), typeof(int), typeof(Tab), default(int), + propertyChanged: SetInternalSelectedItemIndexProperty, defaultValueCreator: GetInternalSelectedItemIndexProperty); + UseTextNaturalSizeProperty = BindableProperty.Create(nameof(UseTextNaturalSize), typeof(bool), typeof(Tab), default(bool), + propertyChanged: SetInternalUseTextNaturalSizeProperty, defaultValueCreator: GetInternalUseTextNaturalSizeProperty); + ItemSpaceProperty = BindableProperty.Create(nameof(ItemSpace), typeof(int), typeof(Tab), default(int), + propertyChanged: SetInternalItemSpaceProperty, defaultValueCreator: GetInternalItemSpaceProperty); + SpaceProperty = BindableProperty.Create(nameof(Space), typeof(Extents), typeof(Tab), null, + propertyChanged: SetInternalSpaceProperty, defaultValueCreator: GetInternalSpaceProperty); + ItemPaddingProperty = BindableProperty.Create(nameof(ItemPadding), typeof(Extents), typeof(Tab), null, + propertyChanged: SetInternalItemPaddingProperty, defaultValueCreator: GetInternalItemPaddingProperty); + UnderLineSizeProperty = BindableProperty.Create(nameof(UnderLineSize), typeof(Size), typeof(Tab), null, + propertyChanged: SetInternalUnderLineSizeProperty, defaultValueCreator: GetInternalUnderLineSizeProperty); + UnderLineBackgroundColorProperty = BindableProperty.Create(nameof(UnderLineBackgroundColor), typeof(Color), typeof(Tab), null, + propertyChanged: SetInternalUnderLineBackgroundColorProperty, defaultValueCreator: GetInternalUnderLineBackgroundColorProperty); + PointSizeProperty = BindableProperty.Create(nameof(PointSize), typeof(float), typeof(Tab), default(float), + propertyChanged: SetInternalPointSizeProperty, defaultValueCreator: GetInternalPointSizeProperty); + FontFamilyProperty = BindableProperty.Create(nameof(FontFamily), typeof(string), typeof(Tab), default(string), + propertyChanged: SetInternalFontFamilyProperty, defaultValueCreator: GetInternalFontFamilyProperty); + TextColorProperty = BindableProperty.Create(nameof(TextColor), typeof(Color), typeof(Tab), null, + propertyChanged: SetInternalTextColorProperty, defaultValueCreator: GetInternalTextColorProperty); + TextColorSelectorProperty = BindableProperty.Create(nameof(TextColorSelector), typeof(ColorSelector), typeof(Tab), null, + propertyChanged: SetInternalTextColorSelectorProperty, defaultValueCreator: GetInternalTextColorSelectorProperty); + } + } /// /// Creates a new instance of a Tab. @@ -121,11 +149,25 @@ public int SelectedItemIndex { get { - return (int)GetValue(SelectedItemIndexProperty); + if (NUIApplication.IsUsingXaml) + { + return (int)GetValue(SelectedItemIndexProperty); + } + else + { + return (int)GetInternalSelectedItemIndexProperty(this); + } } set { - SetValue(SelectedItemIndexProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(SelectedItemIndexProperty, value); + } + else + { + SetInternalSelectedItemIndexProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -154,11 +196,25 @@ public bool UseTextNaturalSize { get { - return (bool)GetValue(UseTextNaturalSizeProperty); + if (NUIApplication.IsUsingXaml) + { + return (bool)GetValue(UseTextNaturalSizeProperty); + } + else + { + return (bool)GetInternalUseTextNaturalSizeProperty(this); + } } set { - SetValue(UseTextNaturalSizeProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(UseTextNaturalSizeProperty, value); + } + else + { + SetInternalUseTextNaturalSizeProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -187,11 +243,25 @@ public int ItemSpace { get { - return (int)GetValue(ItemSpaceProperty); + if (NUIApplication.IsUsingXaml) + { + return (int)GetValue(ItemSpaceProperty); + } + else + { + return (int)GetInternalItemSpaceProperty(this); + } } set { - SetValue(ItemSpaceProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(ItemSpaceProperty, value); + } + else + { + SetInternalItemSpaceProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -220,11 +290,25 @@ public Extents Space { get { - return GetValue(SpaceProperty) as Extents; + if (NUIApplication.IsUsingXaml) + { + return GetValue(SpaceProperty) as Extents; + } + else + { + return GetInternalSpaceProperty(this) as Extents; + } } set { - SetValue(SpaceProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(SpaceProperty, value); + } + else + { + SetInternalSpaceProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -250,11 +334,25 @@ public Extents ItemPadding { get { - return GetValue(ItemPaddingProperty) as Extents; + if (NUIApplication.IsUsingXaml) + { + return GetValue(ItemPaddingProperty) as Extents; + } + else + { + return GetInternalItemPaddingProperty(this) as Extents; + } } set { - SetValue(ItemPaddingProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(ItemPaddingProperty, value); + } + else + { + SetInternalItemPaddingProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -300,11 +398,25 @@ public Size UnderLineSize { get { - return GetValue(UnderLineSizeProperty) as Size; + if (NUIApplication.IsUsingXaml) + { + return GetValue(UnderLineSizeProperty) as Size; + } + else + { + return GetInternalUnderLineSizeProperty(this) as Size; + } } set { - SetValue(UnderLineSizeProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(UnderLineSizeProperty, value); + } + else + { + SetInternalUnderLineSizeProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -333,11 +445,25 @@ public Color UnderLineBackgroundColor { get { - return GetValue(UnderLineBackgroundColorProperty) as Color; + if (NUIApplication.IsUsingXaml) + { + return GetValue(UnderLineBackgroundColorProperty) as Color; + } + else + { + return GetInternalUnderLineBackgroundColorProperty(this) as Color; + } } set { - SetValue(UnderLineBackgroundColorProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(UnderLineBackgroundColorProperty, value); + } + else + { + SetInternalUnderLineBackgroundColorProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -366,11 +492,25 @@ public float PointSize { get { - return (float)GetValue(PointSizeProperty); + if (NUIApplication.IsUsingXaml) + { + return (float)GetValue(PointSizeProperty); + } + else + { + return (float)GetInternalPointSizeProperty(this); + } } set { - SetValue(PointSizeProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(PointSizeProperty, value); + } + else + { + SetInternalPointSizeProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -399,11 +539,25 @@ public string FontFamily { get { - return GetValue(FontFamilyProperty) as string; + if (NUIApplication.IsUsingXaml) + { + return GetValue(FontFamilyProperty) as string; + } + else + { + return GetInternalFontFamilyProperty(this) as string; + } } set { - SetValue(FontFamilyProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(FontFamilyProperty, value); + } + else + { + SetInternalFontFamilyProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -432,11 +586,25 @@ public Color TextColor { get { - return GetValue(TextColorProperty) as Color; + if (NUIApplication.IsUsingXaml) + { + return GetValue(TextColorProperty) as Color; + } + else + { + return GetInternalTextColorProperty(this) as Color; + } } set { - SetValue(TextColorProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(TextColorProperty, value); + } + else + { + SetInternalTextColorProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -466,11 +634,25 @@ public ColorSelector TextColorSelector { get { - return GetValue(TextColorSelectorProperty) as ColorSelector; + if (NUIApplication.IsUsingXaml) + { + return GetValue(TextColorSelectorProperty) as ColorSelector; + } + else + { + return GetInternalTextColorSelectorProperty(this) as ColorSelector; + } } set { - SetValue(TextColorSelectorProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(TextColorSelectorProperty, value); + } + else + { + SetInternalTextColorSelectorProperty(this, null, value); + } NotifyPropertyChanged(); } } diff --git a/src/Tizen.NUI.Components/Controls/TabBindableProperty.cs b/src/Tizen.NUI.Components/Controls/TabBindableProperty.cs index 89af4388e25..3ecb7e0459c 100755 --- a/src/Tizen.NUI.Components/Controls/TabBindableProperty.cs +++ b/src/Tizen.NUI.Components/Controls/TabBindableProperty.cs @@ -9,199 +9,209 @@ public partial class Tab /// SelectedItemIndexProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty SelectedItemIndexProperty = BindableProperty.Create(nameof(SelectedItemIndex), typeof(int), typeof(Tab), default(int), propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty SelectedItemIndexProperty = null; + internal static void SetInternalSelectedItemIndexProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Tab)bindable; if (newValue != null) { instance.InternalSelectedItemIndex = (int)newValue; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalSelectedItemIndexProperty(BindableObject bindable) { var instance = (Tab)bindable; return instance.InternalSelectedItemIndex; - }); + } /// /// UseTextNaturalSizeProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty UseTextNaturalSizeProperty = BindableProperty.Create(nameof(UseTextNaturalSize), typeof(bool), typeof(Tab), default(bool), propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty UseTextNaturalSizeProperty = null; + internal static void SetInternalUseTextNaturalSizeProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Tab)bindable; if (newValue != null) { instance.InternalUseTextNaturalSize = (bool)newValue; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalUseTextNaturalSizeProperty(BindableObject bindable) { var instance = (Tab)bindable; return instance.InternalUseTextNaturalSize; - }); + } /// /// ItemSpaceProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty ItemSpaceProperty = BindableProperty.Create(nameof(ItemSpace), typeof(int), typeof(Tab), default(int), propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty ItemSpaceProperty = null; + internal static void SetInternalItemSpaceProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Tab)bindable; if (newValue != null) { instance.InternalItemSpace = (int)newValue; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalItemSpaceProperty(BindableObject bindable) { var instance = (Tab)bindable; return instance.InternalItemSpace; - }); + } /// /// SpaceProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty SpaceProperty = BindableProperty.Create(nameof(Space), typeof(Extents), typeof(Tab), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty SpaceProperty = null; + internal static void SetInternalSpaceProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Tab)bindable; if (newValue != null) { instance.InternalSpace = newValue as Extents; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalSpaceProperty(BindableObject bindable) { var instance = (Tab)bindable; return instance.InternalSpace; - }); + } /// /// ItemPaddingProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty ItemPaddingProperty = BindableProperty.Create(nameof(ItemPadding), typeof(Extents), typeof(Tab), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty ItemPaddingProperty = null; + internal static void SetInternalItemPaddingProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Tab)bindable; if (newValue != null) { instance.InternalItemPadding = newValue as Extents; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalItemPaddingProperty(BindableObject bindable) { var instance = (Tab)bindable; return instance.InternalItemPadding; - }); + } /// /// UnderLineSizeProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty UnderLineSizeProperty = BindableProperty.Create(nameof(UnderLineSize), typeof(Size), typeof(Tab), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty UnderLineSizeProperty = null; + internal static void SetInternalUnderLineSizeProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Tab)bindable; if (newValue != null) { instance.InternalUnderLineSize = newValue as Size; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalUnderLineSizeProperty(BindableObject bindable) { var instance = (Tab)bindable; return instance.InternalUnderLineSize; - }); + } /// /// UnderLineBackgroundColorProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty UnderLineBackgroundColorProperty = BindableProperty.Create(nameof(UnderLineBackgroundColor), typeof(Color), typeof(Tab), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty UnderLineBackgroundColorProperty = null; + internal static void SetInternalUnderLineBackgroundColorProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Tab)bindable; if (newValue != null) { instance.InternalUnderLineBackgroundColor = newValue as Color; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalUnderLineBackgroundColorProperty(BindableObject bindable) { var instance = (Tab)bindable; return instance.InternalUnderLineBackgroundColor; - }); + } /// /// PointSizeProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty PointSizeProperty = BindableProperty.Create(nameof(PointSize), typeof(float), typeof(Tab), default(float), propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty PointSizeProperty = null; + internal static void SetInternalPointSizeProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Tab)bindable; if (newValue != null) { instance.InternalPointSize = (float)newValue; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalPointSizeProperty(BindableObject bindable) { var instance = (Tab)bindable; return instance.InternalPointSize; - }); + } /// /// FontFamilyProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty FontFamilyProperty = BindableProperty.Create(nameof(FontFamily), typeof(string), typeof(Tab), default(string), propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty FontFamilyProperty = null; + internal static void SetInternalFontFamilyProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Tab)bindable; if (newValue != null) { instance.InternalFontFamily = newValue as string; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalFontFamilyProperty(BindableObject bindable) { var instance = (Tab)bindable; return instance.InternalFontFamily; - }); + } /// /// TextColorProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty TextColorProperty = BindableProperty.Create(nameof(TextColor), typeof(Color), typeof(Tab), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty TextColorProperty = null; + internal static void SetInternalTextColorProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Tab)bindable; if (newValue != null) { instance.InternalTextColor = newValue as Color; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalTextColorProperty(BindableObject bindable) { var instance = (Tab)bindable; return instance.InternalTextColor; - }); + } /// /// TextColorSelectorProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty TextColorSelectorProperty = BindableProperty.Create(nameof(TextColorSelector), typeof(ColorSelector), typeof(Tab), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty TextColorSelectorProperty = null; + internal static void SetInternalTextColorSelectorProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Tab)bindable; if (newValue != null) { instance.InternalTextColorSelector = newValue as ColorSelector; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalTextColorSelectorProperty(BindableObject bindable) { var instance = (Tab)bindable; return instance.InternalTextColorSelector; - }); - + } } } diff --git a/src/Tizen.NUI.Components/Controls/TimePicker.cs b/src/Tizen.NUI.Components/Controls/TimePicker.cs index ffa7deb62ff..7f3f290095f 100755 --- a/src/Tizen.NUI.Components/Controls/TimePicker.cs +++ b/src/Tizen.NUI.Components/Controls/TimePicker.cs @@ -60,37 +60,39 @@ public class TimePicker : Control /// TimeProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty TimeProperty = BindableProperty.Create(nameof(Time), typeof(DateTime), typeof(TimePicker), default(DateTime), propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty TimeProperty = null; + internal static void SetInternalTimeProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (TimePicker)bindable; if (newValue != null) { instance.InternalTime = (DateTime)newValue; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalTimeProperty(BindableObject bindable) { var instance = (TimePicker)bindable; return instance.InternalTime; - }); + } /// /// Is24HourViewProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty Is24HourViewProperty = BindableProperty.Create(nameof(Is24HourView), typeof(bool), typeof(TimePicker), default(bool), propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty Is24HourViewProperty = null; + internal static void SetInternalIs24HourViewProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (TimePicker)bindable; if (newValue != null) { instance.InternalIs24HourView = (bool)newValue; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalIs24HourViewProperty(BindableObject bindable) { var instance = (TimePicker)bindable; return instance.InternalIs24HourView; - }); + } private bool isAm; private bool is24HourView; @@ -100,6 +102,17 @@ public class TimePicker : Control private Picker minutePicker; private Picker ampmPicker; + static TimePicker() + { + if (NUIApplication.IsUsingXaml) + { + TimeProperty = BindableProperty.Create(nameof(Time), typeof(DateTime), typeof(TimePicker), default(DateTime), + propertyChanged: SetInternalTimeProperty, defaultValueCreator: GetInternalTimeProperty); + Is24HourViewProperty = BindableProperty.Create(nameof(Is24HourView), typeof(bool), typeof(TimePicker), default(bool), + propertyChanged: SetInternalIs24HourViewProperty, defaultValueCreator: GetInternalIs24HourViewProperty); + } + } + /// /// Creates a new instance of TimePicker. /// @@ -171,11 +184,25 @@ public DateTime Time { get { - return (DateTime)GetValue(TimeProperty); + if (NUIApplication.IsUsingXaml) + { + return (DateTime)GetValue(TimeProperty); + } + else + { + return (DateTime)GetInternalTimeProperty(this); + } } set { - SetValue(TimeProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(TimeProperty, value); + } + else + { + SetInternalTimeProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -219,11 +246,25 @@ public bool Is24HourView { get { - return (bool)GetValue(Is24HourViewProperty); + if (NUIApplication.IsUsingXaml) + { + return (bool)GetValue(Is24HourViewProperty); + } + else + { + return (bool)GetInternalIs24HourViewProperty(this); + } } set { - SetValue(Is24HourViewProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(Is24HourViewProperty, value); + } + else + { + SetInternalIs24HourViewProperty(this, null, value); + } NotifyPropertyChanged(); } } diff --git a/src/Tizen.NUI.Components/Controls/Toast.cs b/src/Tizen.NUI.Components/Controls/Toast.cs index d9fb74c8dd2..aeec637e470 100755 --- a/src/Tizen.NUI.Components/Controls/Toast.cs +++ b/src/Tizen.NUI.Components/Controls/Toast.cs @@ -33,7 +33,8 @@ public partial class Toast : Control { /// 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 static readonly BindableProperty MessageProperty = BindableProperty.Create(nameof(Message), typeof(string), typeof(Toast), string.Empty, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty MessageProperty = null; + internal static void SetInternalMessageProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Toast)bindable; if (newValue != null) @@ -44,16 +45,17 @@ public partial class Toast : Control instance.textLabel.Text = instance.strText; } } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalMessageProperty(BindableObject bindable) { var instance = (Toast)bindable; return instance.strText; - }); + } /// 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 static readonly BindableProperty DurationProperty = BindableProperty.Create(nameof(Duration), typeof(uint), typeof(Toast), default(uint), propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty DurationProperty = null; + internal static void SetInternalDurationProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Toast)bindable; if (newValue != null) @@ -64,12 +66,12 @@ public partial class Toast : Control } instance.timer.Interval = (uint)newValue; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalDurationProperty(BindableObject bindable) { var instance = (Toast)bindable; return instance.timer == null ? instance.duration : instance.timer.Interval; - }); + } /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] @@ -89,7 +91,32 @@ public static Toast FromText(string text, uint duration) private Timer timer = null; private readonly uint duration = 3000; - static Toast() { } + static Toast() + { + if (NUIApplication.IsUsingXaml) + { + MessageProperty = BindableProperty.Create(nameof(Message), typeof(string), typeof(Toast), string.Empty, + propertyChanged: SetInternalMessageProperty, defaultValueCreator: GetInternalMessageProperty); + DurationProperty = BindableProperty.Create(nameof(Duration), typeof(uint), typeof(Toast), default(uint), + propertyChanged: SetInternalDurationProperty, defaultValueCreator: GetInternalDurationProperty); + TextArrayProperty = BindableProperty.Create(nameof(TextArray), typeof(string[]), typeof(Toast), null, + propertyChanged: SetInternalTextArrayProperty, defaultValueCreator: GetInternalTextArrayProperty); + PointSizeProperty = BindableProperty.Create(nameof(PointSize), typeof(float), typeof(Toast), default(float), + propertyChanged: SetInternalPointSizeProperty, defaultValueCreator: GetInternalPointSizeProperty); + FontFamilyProperty = BindableProperty.Create(nameof(FontFamily), typeof(string), typeof(Toast), default(string), + propertyChanged: SetInternalFontFamilyProperty, defaultValueCreator: GetInternalFontFamilyProperty); + TextColorProperty = BindableProperty.Create(nameof(TextColor), typeof(Color), typeof(Toast), null, + propertyChanged: SetInternalTextColorProperty, defaultValueCreator: GetInternalTextColorProperty); + TextAlignmentProperty = BindableProperty.Create(nameof(TextAlignment), typeof(HorizontalAlignment), typeof(Toast), default(HorizontalAlignment), + propertyChanged: SetInternalTextAlignmentProperty, defaultValueCreator: GetInternalTextAlignmentProperty); + TextPaddingProperty = BindableProperty.Create(nameof(TextPadding), typeof(Extents), typeof(Toast), null, + propertyChanged: SetInternalTextPaddingProperty, defaultValueCreator: GetInternalTextPaddingProperty); + TextLineHeightProperty = BindableProperty.Create(nameof(TextLineHeight), typeof(uint), typeof(Toast), default(uint), + propertyChanged: SetInternalTextLineHeightProperty, defaultValueCreator: GetInternalTextLineHeightProperty); + TextLineSpaceProperty = BindableProperty.Create(nameof(TextLineSpace), typeof(uint), typeof(Toast), default(uint), + propertyChanged: SetInternalTextLineSpaceProperty, defaultValueCreator: GetInternalTextLineSpaceProperty); + } + } /// /// Construct Toast with null. @@ -129,11 +156,25 @@ public string[] TextArray { get { - return GetValue(TextArrayProperty) as string[]; + if (NUIApplication.IsUsingXaml) + { + return GetValue(TextArrayProperty) as string[]; + } + else + { + return GetInternalTextArrayProperty(this) as string[]; + } } set { - SetValue(TextArrayProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(TextArrayProperty, value); + } + else + { + SetInternalTextArrayProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -152,11 +193,25 @@ public float PointSize { get { - return (float)GetValue(PointSizeProperty); + if (NUIApplication.IsUsingXaml) + { + return (float)GetValue(PointSizeProperty); + } + else + { + return (float)GetInternalPointSizeProperty(this); + } } set { - SetValue(PointSizeProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(PointSizeProperty, value); + } + else + { + SetInternalPointSizeProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -184,11 +239,25 @@ public string FontFamily { get { - return GetValue(FontFamilyProperty) as string; + if (NUIApplication.IsUsingXaml) + { + return GetValue(FontFamilyProperty) as string; + } + else + { + return GetInternalFontFamilyProperty(this) as string; + } } set { - SetValue(FontFamilyProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(FontFamilyProperty, value); + } + else + { + SetInternalFontFamilyProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -216,11 +285,25 @@ public Color TextColor { get { - return GetValue(TextColorProperty) as Color; + if (NUIApplication.IsUsingXaml) + { + return GetValue(TextColorProperty) as Color; + } + else + { + return GetInternalTextColorProperty(this) as Color; + } } set { - SetValue(TextColorProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(TextColorProperty, value); + } + else + { + SetInternalTextColorProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -248,11 +331,25 @@ public HorizontalAlignment TextAlignment { get { - return (HorizontalAlignment)GetValue(TextAlignmentProperty); + if (NUIApplication.IsUsingXaml) + { + return (HorizontalAlignment)GetValue(TextAlignmentProperty); + } + else + { + return (HorizontalAlignment)GetInternalTextAlignmentProperty(this); + } } set { - SetValue(TextAlignmentProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(TextAlignmentProperty, value); + } + else + { + SetInternalTextAlignmentProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -292,11 +389,25 @@ public string Message { get { - return (string)GetValue(MessageProperty); + if (NUIApplication.IsUsingXaml) + { + return (string)GetValue(MessageProperty); + } + else + { + return (string)GetInternalMessageProperty(this); + } } set { - SetValue(MessageProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(MessageProperty, value); + } + else + { + SetInternalMessageProperty(this, null, value); + } } } @@ -309,11 +420,25 @@ public Extents TextPadding { get { - return GetValue(TextPaddingProperty) as Extents; + if (NUIApplication.IsUsingXaml) + { + return GetValue(TextPaddingProperty) as Extents; + } + else + { + return GetInternalTextPaddingProperty(this) as Extents; + } } set { - SetValue(TextPaddingProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(TextPaddingProperty, value); + } + else + { + SetInternalTextPaddingProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -341,11 +466,25 @@ public uint TextLineHeight { get { - return (UInt32)GetValue(TextLineHeightProperty); + if (NUIApplication.IsUsingXaml) + { + return (UInt32)GetValue(TextLineHeightProperty); + } + else + { + return (uint)GetInternalTextLineHeightProperty(this); + } } set { - SetValue(TextLineHeightProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(TextLineHeightProperty, value); + } + else + { + SetInternalTextLineHeightProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -360,11 +499,25 @@ public uint TextLineSpace { get { - return (uint)GetValue(TextLineSpaceProperty); + if (NUIApplication.IsUsingXaml) + { + return (uint)GetValue(TextLineSpaceProperty); + } + else + { + return (uint)GetInternalTextLineSpaceProperty(this); + } } set { - SetValue(TextLineSpaceProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(TextLineSpaceProperty, value); + } + else + { + SetInternalTextLineSpaceProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -379,11 +532,25 @@ public uint Duration { get { - return (uint)GetValue(DurationProperty); + if (NUIApplication.IsUsingXaml) + { + return (uint)GetValue(DurationProperty); + } + else + { + return (uint)GetInternalDurationProperty(this); + } } set { - SetValue(DurationProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(DurationProperty, value); + } + else + { + SetInternalDurationProperty(this, null, value); + } } } diff --git a/src/Tizen.NUI.Components/Controls/ToastBindableProperty.cs b/src/Tizen.NUI.Components/Controls/ToastBindableProperty.cs index 7eb0e80ad54..0c105696828 100755 --- a/src/Tizen.NUI.Components/Controls/ToastBindableProperty.cs +++ b/src/Tizen.NUI.Components/Controls/ToastBindableProperty.cs @@ -9,145 +9,152 @@ public partial class Toast /// TextArrayProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty TextArrayProperty = BindableProperty.Create(nameof(TextArray), typeof(string[]), typeof(Toast), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty TextArrayProperty = null; + internal static void SetInternalTextArrayProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Toast)bindable; if (newValue != null) { instance.InternalTextArray = newValue as string[]; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalTextArrayProperty(BindableObject bindable) { var instance = (Toast)bindable; return instance.InternalTextArray; - }); + } /// /// PointSizeProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty PointSizeProperty = BindableProperty.Create(nameof(PointSize), typeof(float), typeof(Toast), default(float), propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty PointSizeProperty = null; + internal static void SetInternalPointSizeProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Toast)bindable; if (newValue != null) { instance.InternalPointSize = (float)newValue; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalPointSizeProperty(BindableObject bindable) { var instance = (Toast)bindable; return instance.InternalPointSize; - }); + } /// /// FontFamilyProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty FontFamilyProperty = BindableProperty.Create(nameof(FontFamily), typeof(string), typeof(Toast), default(string), propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty FontFamilyProperty = null; + internal static void SetInternalFontFamilyProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Toast)bindable; if (newValue != null) { instance.InternalFontFamily = newValue as string; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalFontFamilyProperty(BindableObject bindable) { var instance = (Toast)bindable; return instance.InternalFontFamily; - }); + } /// /// TextColorProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty TextColorProperty = BindableProperty.Create(nameof(TextColor), typeof(Color), typeof(Toast), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty TextColorProperty = null; + internal static void SetInternalTextColorProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Toast)bindable; if (newValue != null) { instance.InternalTextColor = newValue as Color; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalTextColorProperty(BindableObject bindable) { var instance = (Toast)bindable; return instance.InternalTextColor; - }); + } /// /// TextAlignmentProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty TextAlignmentProperty = BindableProperty.Create(nameof(TextAlignment), typeof(HorizontalAlignment), typeof(Toast), default(HorizontalAlignment), propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty TextAlignmentProperty = null; + internal static void SetInternalTextAlignmentProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Toast)bindable; if (newValue != null) { instance.InternalTextAlignment = (HorizontalAlignment)newValue; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalTextAlignmentProperty(BindableObject bindable) { var instance = (Toast)bindable; return instance.InternalTextAlignment; - }); + } /// /// TextPaddingProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty TextPaddingProperty = BindableProperty.Create(nameof(TextPadding), typeof(Extents), typeof(Toast), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty TextPaddingProperty = null; + internal static void SetInternalTextPaddingProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Toast)bindable; if (newValue != null) { instance.InternalTextPadding = newValue as Extents; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalTextPaddingProperty(BindableObject bindable) { var instance = (Toast)bindable; return instance.InternalTextPadding; - }); + } /// /// TextLineHeightProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty TextLineHeightProperty = BindableProperty.Create(nameof(TextLineHeight), typeof(uint), typeof(Toast), default(uint), propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty TextLineHeightProperty = null; + internal static void SetInternalTextLineHeightProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Toast)bindable; if (newValue != null) { instance.InternalTextLineHeight = (uint)newValue; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalTextLineHeightProperty(BindableObject bindable) { var instance = (Toast)bindable; return instance.InternalTextLineHeight; - }); + } /// /// TextLineSpaceProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty TextLineSpaceProperty = BindableProperty.Create(nameof(TextLineSpace), typeof(uint), typeof(Toast), default(uint), propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty TextLineSpaceProperty = null; + internal static void SetInternalTextLineSpaceProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Toast)bindable; if (newValue != null) { instance.InternalTextLineSpace = (uint)newValue; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalTextLineSpaceProperty(BindableObject bindable) { var instance = (Toast)bindable; return instance.InternalTextLineSpace; - }); - + } } } diff --git a/src/Tizen.NUI.Components/Style/ButtonStyle.cs b/src/Tizen.NUI.Components/Style/ButtonStyle.cs index a8dca5199da..ec59328c669 100755 --- a/src/Tizen.NUI.Components/Style/ButtonStyle.cs +++ b/src/Tizen.NUI.Components/Style/ButtonStyle.cs @@ -29,66 +29,76 @@ public class ButtonStyle : ControlStyle { /// 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 static readonly BindableProperty IsSelectableProperty = BindableProperty.Create(nameof(IsSelectable), typeof(bool?), typeof(ButtonStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty IsSelectableProperty = null; + internal static void SetInternalIsSelectableProperty(BindableObject bindable, object oldValue, object newValue) { var buttonStyle = (ButtonStyle)bindable; buttonStyle.isSelectable = (bool?)newValue; - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalIsSelectableProperty(BindableObject bindable) { var buttonStyle = (ButtonStyle)bindable; return buttonStyle.isSelectable; - }); + } + /// 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 static readonly BindableProperty IsSelectedProperty = BindableProperty.Create(nameof(IsSelected), typeof(bool?), typeof(ButtonStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty IsSelectedProperty = null; + internal static void SetInternalIsSelectedProperty(BindableObject bindable, object oldValue, object newValue) { var buttonStyle = (ButtonStyle)bindable; buttonStyle.isSelected = (bool?)newValue; - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalIsSelectedProperty(BindableObject bindable) { var buttonStyle = (ButtonStyle)bindable; return buttonStyle.isSelected; - }); + } + /// 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 static readonly BindableProperty IconRelativeOrientationProperty = BindableProperty.Create(nameof(IconRelativeOrientation), typeof(Button.IconOrientation?), typeof(ButtonStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty IconRelativeOrientationProperty = null; + internal static void SetInternalIconRelativeOrientationProperty(BindableObject bindable, object oldValue, object newValue) { var buttonStyle = (ButtonStyle)bindable; buttonStyle.iconRelativeOrientation = (Button.IconOrientation?)newValue; - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalIconRelativeOrientationProperty(BindableObject bindable) { var buttonStyle = (ButtonStyle)bindable; return buttonStyle.iconRelativeOrientation; - }); + } + /// 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 static readonly BindableProperty IconPaddingProperty = BindableProperty.Create(nameof(IconPadding), typeof(Extents), typeof(ButtonStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty IconPaddingProperty = null; + internal static void SetInternalIconPaddingProperty(BindableObject bindable, object oldValue, object newValue) { ((ButtonStyle)bindable).iconPadding = null == newValue ? null : new Extents((Extents)newValue); - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalIconPaddingProperty(BindableObject bindable) { var buttonStyle = (ButtonStyle)bindable; return buttonStyle.iconPadding; - }); + } + /// 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 static readonly BindableProperty TextPaddingProperty = BindableProperty.Create(nameof(TextPadding), typeof(Extents), typeof(ButtonStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty TextPaddingProperty = null; + internal static void SetInternalTextPaddingProperty(BindableObject bindable, object oldValue, object newValue) { ((ButtonStyle)bindable).textPadding = null == newValue ? null : new Extents((Extents)newValue); - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalTextPaddingProperty(BindableObject bindable) { var buttonStyle = (ButtonStyle)bindable; return buttonStyle.textPadding; - }); + } /// The bindable property of ItemAlignment. [EditorBrowsable(EditorBrowsableState.Never)] - internal static readonly BindableProperty ItemAlignmentProperty = BindableProperty.Create(nameof(ItemAlignment), typeof(LinearLayout.Alignment?), typeof(ButtonStyle), null, propertyChanged: (bindable, oldValue, newValue) => + internal static readonly BindableProperty ItemAlignmentProperty = null; + internal static void SetInternalItemAlignmentProperty(BindableObject bindable, object oldValue, object newValue) { ((ButtonStyle)bindable).itemAlignment = (LinearLayout.Alignment?)newValue; @@ -119,32 +129,47 @@ public class ButtonStyle : ControlStyle default: break; } - }, - defaultValueCreator: (bindable) => ((ButtonStyle)bindable).itemAlignment); + } + internal static object GetInternalItemAlignmentProperty(BindableObject bindable) + { + return ((ButtonStyle)bindable).itemAlignment; + } /// The bindable property of ItemHorizontalAlignment. [EditorBrowsable(EditorBrowsableState.Never)] - internal static readonly BindableProperty ItemHorizontalAlignmentProperty = BindableProperty.Create(nameof(ItemHorizontalAlignment), typeof(HorizontalAlignment?), typeof(ButtonStyle), null, propertyChanged: (bindable, oldValue, newValue) => + internal static readonly BindableProperty ItemHorizontalAlignmentProperty = null; + internal static void SetInternalItemHorizontalAlignmentProperty(BindableObject bindable, object oldValue, object newValue) { ((ButtonStyle)bindable).itemHorizontalAlignment = (HorizontalAlignment?)newValue; - }, - defaultValueCreator: (bindable) => ((ButtonStyle)bindable).itemHorizontalAlignment); + } + internal static object GetInternalItemHorizontalAlignmentProperty(BindableObject bindable) + { + return ((ButtonStyle)bindable).itemHorizontalAlignment; + } /// The bindable property of ItemVerticalAlignment. [EditorBrowsable(EditorBrowsableState.Never)] - internal static readonly BindableProperty ItemVerticalAlignmentProperty = BindableProperty.Create(nameof(ItemVerticalAlignment), typeof(VerticalAlignment?), typeof(ButtonStyle), null, propertyChanged: (bindable, oldValue, newValue) => + internal static readonly BindableProperty ItemVerticalAlignmentProperty = null; + internal static void SetInternalItemVerticalAlignmentProperty(BindableObject bindable, object oldValue, object newValue) { ((ButtonStyle)bindable).itemVerticalAlignment = (VerticalAlignment?)newValue; - }, - defaultValueCreator: (bindable) => ((ButtonStyle)bindable).itemVerticalAlignment); + } + internal static object GetInternalItemVerticalAlignmentProperty(BindableObject bindable) + { + return ((ButtonStyle)bindable).itemVerticalAlignment; + } /// The bindable property of ItemSpacing. [EditorBrowsable(EditorBrowsableState.Never)] - internal static readonly BindableProperty ItemSpacingProperty = BindableProperty.Create(nameof(ItemSpacing), typeof(Size2D), typeof(ButtonStyle), null, propertyChanged: (bindable, oldValue, newValue) => + internal static readonly BindableProperty ItemSpacingProperty = null; + internal static void SetInternalItemSpacingProperty(BindableObject bindable, object oldValue, object newValue) { ((ButtonStyle)bindable).itemSpacing = (Size2D)newValue; - }, - defaultValueCreator: (bindable) => ((ButtonStyle)bindable).itemSpacing); + } + internal static object GetInternalItemSpacingProperty(BindableObject bindable) + { + return ((ButtonStyle)bindable).itemSpacing; + } private bool? isSelectable; private bool? isSelected; @@ -156,7 +181,30 @@ public class ButtonStyle : ControlStyle private HorizontalAlignment? itemHorizontalAlignment; private VerticalAlignment? itemVerticalAlignment; - static ButtonStyle() { } + static ButtonStyle() + { + if (NUIApplication.IsUsingXaml) + { + IsSelectableProperty = BindableProperty.Create(nameof(IsSelectable), typeof(bool?), typeof(ButtonStyle), null, + propertyChanged: SetInternalIsSelectableProperty, defaultValueCreator: GetInternalIsSelectableProperty); + IsSelectedProperty = BindableProperty.Create(nameof(IsSelected), typeof(bool?), typeof(ButtonStyle), null, + propertyChanged: SetInternalIsSelectedProperty, defaultValueCreator: GetInternalIsSelectedProperty); + IconRelativeOrientationProperty = BindableProperty.Create(nameof(IconRelativeOrientation), typeof(Button.IconOrientation?), typeof(ButtonStyle), null, + propertyChanged: SetInternalIconRelativeOrientationProperty, defaultValueCreator: GetInternalIconRelativeOrientationProperty); + IconPaddingProperty = BindableProperty.Create(nameof(IconPadding), typeof(Extents), typeof(ButtonStyle), null, + propertyChanged: SetInternalIconPaddingProperty, defaultValueCreator: GetInternalIconPaddingProperty); + TextPaddingProperty = BindableProperty.Create(nameof(TextPadding), typeof(Extents), typeof(ButtonStyle), null, + propertyChanged: SetInternalTextPaddingProperty, defaultValueCreator: GetInternalTextPaddingProperty); + ItemAlignmentProperty = BindableProperty.Create(nameof(ItemAlignment), typeof(LinearLayout.Alignment?), typeof(ButtonStyle), null, + propertyChanged: SetInternalItemAlignmentProperty, defaultValueCreator: GetInternalItemAlignmentProperty); + ItemHorizontalAlignmentProperty = BindableProperty.Create(nameof(ItemHorizontalAlignment), typeof(HorizontalAlignment?), typeof(ButtonStyle), null, + propertyChanged: SetInternalItemHorizontalAlignmentProperty, defaultValueCreator: GetInternalItemHorizontalAlignmentProperty); + ItemVerticalAlignmentProperty = BindableProperty.Create(nameof(ItemVerticalAlignment), typeof(VerticalAlignment?), typeof(ButtonStyle), null, + propertyChanged: SetInternalItemVerticalAlignmentProperty, defaultValueCreator: GetInternalItemVerticalAlignmentProperty); + ItemSpacingProperty = BindableProperty.Create(nameof(ItemSpacing), typeof(Size2D), typeof(ButtonStyle), null, + propertyChanged: SetInternalItemSpacingProperty, defaultValueCreator: GetInternalItemSpacingProperty); + } + } /// /// Creates a new instance of a ButtonStyle. @@ -199,8 +247,28 @@ public ButtonStyle(ButtonStyle style) : base(style) /// 8 public bool? IsSelectable { - get => (bool?)GetValue(IsSelectableProperty); - set => SetValue(IsSelectableProperty, value); + get + { + if (NUIApplication.IsUsingXaml) + { + return (bool?)GetValue(IsSelectableProperty); + } + else + { + return (bool)GetInternalIsSelectableProperty(this); + } + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(IsSelectableProperty, value); + } + else + { + SetInternalIsSelectableProperty(this, null, value); + } + } } /// @@ -209,8 +277,28 @@ public bool? IsSelectable /// 8 public bool? IsSelected { - get => (bool?)GetValue(IsSelectedProperty); - set => SetValue(IsSelectedProperty, value); + get + { + if (NUIApplication.IsUsingXaml) + { + return (bool?)GetValue(IsSelectedProperty); + } + else + { + return (bool?)GetInternalIsSelectedProperty(this); + } + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(IsSelectedProperty, value); + } + else + { + SetInternalIsSelectedProperty(this, null, value); + } + } } /// @@ -232,8 +320,28 @@ public bool? IsSelected /// 8 public Button.IconOrientation? IconRelativeOrientation { - get => (Button.IconOrientation?)GetValue(IconRelativeOrientationProperty); - set => SetValue(IconRelativeOrientationProperty, value); + get + { + if (NUIApplication.IsUsingXaml) + { + return (Button.IconOrientation?)GetValue(IconRelativeOrientationProperty); + } + else + { + return (Button.IconOrientation?)GetInternalIconRelativeOrientationProperty(this); + } + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(IconRelativeOrientationProperty, value); + } + else + { + SetInternalIconRelativeOrientationProperty(this, null, value); + } + } } /// @@ -244,8 +352,28 @@ public Extents IconPadding { // TODO Fixme // When there are icon and text, the linear layout does not count padding. - get => ((Extents)GetValue(IconPaddingProperty)) ?? (iconPadding = new Extents()); - set => SetValue(IconPaddingProperty, value); + get + { + if (NUIApplication.IsUsingXaml) + { + return ((Extents)GetValue(IconPaddingProperty)) ?? (iconPadding = new Extents()); + } + else + { + return (Extents)GetInternalIconPaddingProperty(this); + } + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(IconPaddingProperty, value); + } + else + { + SetInternalIconPaddingProperty(this, null, value); + } + } } /// @@ -254,8 +382,28 @@ public Extents IconPadding /// 8 public Extents TextPadding { - get => ((Extents)GetValue(TextPaddingProperty)) ?? (textPadding = new Extents()); - set => SetValue(TextPaddingProperty, value); + get + { + if (NUIApplication.IsUsingXaml) + { + return ((Extents)GetValue(TextPaddingProperty)) ?? (textPadding = new Extents()); + } + else + { + return ((Extents)GetInternalTextPaddingProperty(this)) ?? (textPadding = new Extents()); + } + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(TextPaddingProperty, value); + } + else + { + SetInternalTextPaddingProperty(this, null, value); + } + } } /// @@ -264,8 +412,28 @@ public Extents TextPadding [EditorBrowsable(EditorBrowsableState.Never)] public LinearLayout.Alignment? ItemAlignment { - get => (LinearLayout.Alignment?)GetValue(ItemAlignmentProperty); - set => SetValue(ItemAlignmentProperty, value); + get + { + if (NUIApplication.IsUsingXaml) + { + return (LinearLayout.Alignment?)GetValue(ItemAlignmentProperty); + } + else + { + return (LinearLayout.Alignment)GetInternalItemAlignmentProperty(this); + } + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(ItemAlignmentProperty, value); + } + else + { + SetInternalItemAlignmentProperty(this, null, value); + } + } } /// @@ -274,8 +442,28 @@ public LinearLayout.Alignment? ItemAlignment [EditorBrowsable(EditorBrowsableState.Never)] public HorizontalAlignment? ItemHorizontalAlignment { - get => (HorizontalAlignment?)GetValue(ItemHorizontalAlignmentProperty); - set => SetValue(ItemHorizontalAlignmentProperty, value); + get + { + if (NUIApplication.IsUsingXaml) + { + return (HorizontalAlignment?)GetValue(ItemHorizontalAlignmentProperty); + } + else + { + return (HorizontalAlignment?)GetInternalItemHorizontalAlignmentProperty(this); + } + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(ItemHorizontalAlignmentProperty, value); + } + else + { + SetInternalItemHorizontalAlignmentProperty(this, null, value); + } + } } /// @@ -284,8 +472,28 @@ public HorizontalAlignment? ItemHorizontalAlignment [EditorBrowsable(EditorBrowsableState.Never)] public VerticalAlignment? ItemVerticalAlignment { - get => (VerticalAlignment?)GetValue(ItemVerticalAlignmentProperty); - set => SetValue(ItemVerticalAlignmentProperty, value); + get + { + if (NUIApplication.IsUsingXaml) + { + return (VerticalAlignment?)GetValue(ItemVerticalAlignmentProperty); + } + else + { + return (VerticalAlignment?)GetInternalItemVerticalAlignmentProperty(this); + } + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(ItemVerticalAlignmentProperty, value); + } + else + { + SetInternalItemVerticalAlignmentProperty(this, null, value); + } + } } /// @@ -296,8 +504,28 @@ public VerticalAlignment? ItemVerticalAlignment [EditorBrowsable(EditorBrowsableState.Never)] public Size2D ItemSpacing { - get => (Size2D)GetValue(ItemSpacingProperty); - set => SetValue(ItemSpacingProperty, value); + get + { + if (NUIApplication.IsUsingXaml) + { + return (Size2D)GetValue(ItemSpacingProperty); + } + else + { + return (Size2D)GetInternalItemSpacingProperty(this); + } + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(ItemSpacingProperty, value); + } + else + { + SetInternalItemSpacingProperty(this, null, value); + } + } } /// diff --git a/src/Tizen.NUI.Components/Style/LoadingStyle.cs b/src/Tizen.NUI.Components/Style/LoadingStyle.cs index 7cbe9daef94..2281e265f33 100755 --- a/src/Tizen.NUI.Components/Style/LoadingStyle.cs +++ b/src/Tizen.NUI.Components/Style/LoadingStyle.cs @@ -29,58 +29,84 @@ public class LoadingStyle : ControlStyle { /// The FrameRateSelector bindable property. [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty FrameRateSelectorProperty = BindableProperty.Create("FrameRateSelector", typeof(Selector), typeof(LoadingStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty FrameRateSelectorProperty = null; + internal static void SetInternalFrameRateSelectorProperty(BindableObject bindable, object oldValue, object newValue) { ((LoadingStyle)bindable).frameRate = ((Selector)newValue)?.Clone(); - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalFrameRateSelectorProperty(BindableObject bindable) { return ((LoadingStyle)bindable).frameRate; - }); + } /// The LoadingSize bindable property. [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty LoadingSizeProperty = BindableProperty.Create(nameof(LoadingSize), typeof(Size), typeof(LoadingStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty LoadingSizeProperty = null; + internal static void SetInternalLoadingSizeProperty(BindableObject bindable, object oldValue, object newValue) { ((LoadingStyle)bindable).Size = (Size)newValue; - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalLoadingSizeProperty(BindableObject bindable) { return ((LoadingStyle)bindable).Size; - }); + } /// The Images bindable property. [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty ImagesProperty = BindableProperty.Create(nameof(Images), typeof(string[]), typeof(LoadingStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty ImagesProperty = null; + internal static void SetInternalImagesProperty(BindableObject bindable, object oldValue, object newValue) { ((LoadingStyle)bindable).images = newValue == null ? null : new List((string[])newValue); - }, - defaultValueCreator: (bindable) => ((LoadingStyle)bindable).images?.ToArray() - ); + } + internal static object GetInternalImagesProperty(BindableObject bindable) + { + return ((LoadingStyle)bindable).images?.ToArray(); + } /// The Images bindable property. [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty ImageListProperty = BindableProperty.Create(nameof(ImageList), typeof(IList), typeof(LoadingStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty ImageListProperty = null; + internal static void SetInternalImageListProperty(BindableObject bindable, object oldValue, object newValue) { ((LoadingStyle)bindable).images = newValue == null ? null : newValue as List; - }, - defaultValueCreator: (bindable) => ((LoadingStyle)bindable).images - ); + } + internal static object GetInternalImageListProperty(BindableObject bindable) + { + return ((LoadingStyle)bindable).images; + } /// The lottie resource url bindable property. [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty LottieResourceUrlProperty = BindableProperty.Create(nameof(LottieResourceUrl), typeof(string), typeof(LoadingStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty LottieResourceUrlProperty = null; + internal static void SetInternalLottieResourceUrlProperty(BindableObject bindable, object oldValue, object newValue) { ((LoadingStyle)bindable).lottieResourceUrl = newValue as string; - }, - defaultValueCreator: (bindable) => ((LoadingStyle)bindable).lottieResourceUrl - ); + } + internal static object GetInternalLottieResourceUrlProperty(BindableObject bindable) + { + return ((LoadingStyle)bindable).lottieResourceUrl; + } private Selector frameRate; private List images; private string lottieResourceUrl; - static LoadingStyle() { } + static LoadingStyle() + { + if (NUIApplication.IsUsingXaml) + { + FrameRateSelectorProperty = BindableProperty.Create("FrameRateSelector", typeof(Selector), typeof(LoadingStyle), null, + propertyChanged: SetInternalFrameRateSelectorProperty, defaultValueCreator: GetInternalFrameRateSelectorProperty); + LoadingSizeProperty = BindableProperty.Create(nameof(LoadingSize), typeof(Size), typeof(LoadingStyle), null, + propertyChanged: SetInternalLoadingSizeProperty, defaultValueCreator: GetInternalLoadingSizeProperty); + ImagesProperty = BindableProperty.Create(nameof(Images), typeof(string[]), typeof(LoadingStyle), null, + propertyChanged: SetInternalImagesProperty, defaultValueCreator: GetInternalImagesProperty); + ImageListProperty = BindableProperty.Create(nameof(ImageList), typeof(IList), typeof(LoadingStyle), null, + propertyChanged: SetInternalImageListProperty, defaultValueCreator: GetInternalImageListProperty); + LottieResourceUrlProperty = BindableProperty.Create(nameof(LottieResourceUrl), typeof(string), typeof(LoadingStyle), null, + propertyChanged: SetInternalLottieResourceUrlProperty, defaultValueCreator: GetInternalLottieResourceUrlProperty); + } + } /// /// Creates a new instance of a LoadingStyle. @@ -103,8 +129,21 @@ public LoadingStyle(LoadingStyle style) : base(style) /// 8 public string[] Images { - get => (ImageList as List)?.ToArray(); - set => SetValue(ImagesProperty, value); + get + { + return (ImageList as List)?.ToArray(); + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(ImagesProperty, value); + } + else + { + SetInternalImagesProperty(this, null, value); + } + } } /// @@ -115,9 +154,26 @@ public IList ImageList { get { - return GetValue(ImageListProperty) as List; + if (NUIApplication.IsUsingXaml) + { + return GetValue(ImageListProperty) as List; + } + else + { + return GetInternalImageListProperty(this) as IList; + } + } + internal set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(ImageListProperty, value); + } + else + { + SetInternalImageListProperty(this, null, value); + } } - internal set => SetValue(ImageListProperty, value); } /// @@ -127,8 +183,28 @@ public IList ImageList [EditorBrowsable(EditorBrowsableState.Never)] public string LottieResourceUrl { - get => GetValue(LottieResourceUrlProperty) as string; - set => SetValue(LottieResourceUrlProperty, value); + get + { + if (NUIApplication.IsUsingXaml) + { + return GetValue(LottieResourceUrlProperty) as string; + } + else + { + return GetInternalLottieResourceUrlProperty(this) as string; + } + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(LottieResourceUrlProperty, value); + } + else + { + SetInternalLottieResourceUrlProperty(this, null, value); + } + } } /// @@ -137,8 +213,28 @@ public string LottieResourceUrl /// 8 public Size LoadingSize { - get => (Size)GetValue(LoadingSizeProperty); - set => SetValue(LoadingSizeProperty, value); + get + { + if (NUIApplication.IsUsingXaml) + { + return (Size)GetValue(LoadingSizeProperty); + } + else + { + return (Size)GetInternalLoadingSizeProperty(this); + } + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(LoadingSizeProperty, value); + } + else + { + SetInternalLoadingSizeProperty(this, null, value); + } + } } /// @@ -147,8 +243,28 @@ public Size LoadingSize /// 8 public Selector FrameRate { - get => (Selector)GetValue(FrameRateSelectorProperty); - set => SetValue(FrameRateSelectorProperty, value); + get + { + if (NUIApplication.IsUsingXaml) + { + return (Selector)GetValue(FrameRateSelectorProperty); + } + else + { + return (Selector)GetInternalFrameRateSelectorProperty(this); + } + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(FrameRateSelectorProperty, value); + } + else + { + SetInternalFrameRateSelectorProperty(this, null, value); + } + } } /// diff --git a/src/Tizen.NUI.Components/Style/PaginationStyle.cs b/src/Tizen.NUI.Components/Style/PaginationStyle.cs index f1503f4036d..d172a3c3765 100755 --- a/src/Tizen.NUI.Components/Style/PaginationStyle.cs +++ b/src/Tizen.NUI.Components/Style/PaginationStyle.cs @@ -28,42 +28,56 @@ public class PaginationStyle : ControlStyle { /// The IndicatorSize bindable property. [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty IndicatorSizeProperty = BindableProperty.Create(nameof(IndicatorSize), typeof(Size), typeof(PaginationStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty IndicatorSizeProperty = null; + internal static void SetInternalIndicatorSizeProperty(BindableObject bindable, object oldValue, object newValue) { ((PaginationStyle)bindable).indicatorSize = newValue == null ? null : new Size((Size)newValue); - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalIndicatorSizeProperty(BindableObject bindable) { return ((PaginationStyle)bindable).indicatorSize; - }); + } /// The IndicatorImageUrlSelector bindable property. [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty IndicatorImageUrlSelectorProperty = BindableProperty.Create("IndicatorImageUrl", typeof(Selector), typeof(PaginationStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty IndicatorImageUrlSelectorProperty = null; + internal static void SetInternalIndicatorImageUrlSelectorProperty(BindableObject bindable, object oldValue, object newValue) { ((PaginationStyle)bindable).indicatorImageUrl = (Selector)newValue; - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalIndicatorImageUrlSelectorProperty(BindableObject bindable) { return ((PaginationStyle)bindable).indicatorImageUrl; - }); + } /// The IndicatorSpacing bindable property. [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty IndicatorSpacingProperty = BindableProperty.Create(nameof(IndicatorSpacing), typeof(int?), typeof(PaginationStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty IndicatorSpacingProperty = null; + internal static void SetInternalIndicatorSpacingProperty(BindableObject bindable, object oldValue, object newValue) { ((PaginationStyle)bindable).indicatorSpacing = (int?)newValue; - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalIndicatorSpacingProperty(BindableObject bindable) { return ((PaginationStyle)bindable).indicatorSpacing; - }); + } private Size indicatorSize; private Selector indicatorImageUrl; private int? indicatorSpacing; - static PaginationStyle() { } + static PaginationStyle() + { + if (NUIApplication.IsUsingXaml) + { + IndicatorSizeProperty = BindableProperty.Create(nameof(IndicatorSize), typeof(Size), typeof(PaginationStyle), null, + propertyChanged: SetInternalIndicatorSizeProperty, defaultValueCreator: GetInternalIndicatorSizeProperty); + IndicatorImageUrlSelectorProperty = BindableProperty.Create("IndicatorImageUrl", typeof(Selector), typeof(PaginationStyle), null, + propertyChanged: SetInternalIndicatorImageUrlSelectorProperty, defaultValueCreator: GetInternalIndicatorImageUrlSelectorProperty); + IndicatorSpacingProperty = BindableProperty.Create(nameof(IndicatorSpacing), typeof(int?), typeof(PaginationStyle), null, + propertyChanged: SetInternalIndicatorSpacingProperty, defaultValueCreator: GetInternalIndicatorSpacingProperty); + } + } /// /// Creates a new instance of a PaginationStyle. @@ -86,8 +100,28 @@ public PaginationStyle(PaginationStyle style) : base(style) /// 8 public Size IndicatorSize { - get => (Size)GetValue(IndicatorSizeProperty); - set => SetValue(IndicatorSizeProperty, value); + get + { + if (NUIApplication.IsUsingXaml) + { + return (Size)GetValue(IndicatorSizeProperty); + } + else + { + return (Size)GetInternalIndicatorSizeProperty(this); + } + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(IndicatorSizeProperty, value); + } + else + { + SetInternalIndicatorSizeProperty(this, null, value); + } + } } /// @@ -96,8 +130,28 @@ public Size IndicatorSize /// 8 public Selector IndicatorImageUrl { - get => (Selector)GetValue(IndicatorImageUrlSelectorProperty); - set => SetValue(IndicatorImageUrlSelectorProperty, value); + get + { + if (NUIApplication.IsUsingXaml) + { + return (Selector)GetValue(IndicatorImageUrlSelectorProperty); + } + else + { + return (Selector)GetInternalIndicatorImageUrlSelectorProperty(this); + } + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(IndicatorImageUrlSelectorProperty, value); + } + else + { + SetInternalIndicatorImageUrlSelectorProperty(this, null, value); + } + } } /// @@ -106,8 +160,28 @@ public Selector IndicatorImageUrl /// 8 public int IndicatorSpacing { - get => ((int?)GetValue(IndicatorSpacingProperty)) ?? 0; - set => SetValue(IndicatorSpacingProperty, value); + get + { + if (NUIApplication.IsUsingXaml) + { + return ((int?)GetValue(IndicatorSpacingProperty)) ?? 0; + } + else + { + return ((int?)GetInternalIndicatorSpacingProperty(this)) ?? 0; + } + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(IndicatorSpacingProperty, value); + } + else + { + SetInternalIndicatorSpacingProperty(this, null, value); + } + } } /// diff --git a/src/Tizen.NUI.Components/Style/RecyclerViewItemStyle.cs b/src/Tizen.NUI.Components/Style/RecyclerViewItemStyle.cs index 7d79b8f763b..c598ed1b487 100755 --- a/src/Tizen.NUI.Components/Style/RecyclerViewItemStyle.cs +++ b/src/Tizen.NUI.Components/Style/RecyclerViewItemStyle.cs @@ -30,33 +30,45 @@ public class RecyclerViewItemStyle : ControlStyle { /// 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 static readonly BindableProperty IsSelectableProperty = BindableProperty.Create(nameof(IsSelectable), typeof(bool?), typeof(RecyclerViewItemStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty IsSelectableProperty = null; + internal static void SetInternalIsSelectableProperty(BindableObject bindable, object oldValue, object newValue) { var RecyclerViewItemStyle = (RecyclerViewItemStyle)bindable; RecyclerViewItemStyle.isSelectable = (bool?)newValue; - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalIsSelectableProperty(BindableObject bindable) { var RecyclerViewItemStyle = (RecyclerViewItemStyle)bindable; return RecyclerViewItemStyle.isSelectable; - }); + } + /// 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 static readonly BindableProperty IsSelectedProperty = BindableProperty.Create(nameof(IsSelected), typeof(bool?), typeof(RecyclerViewItemStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty IsSelectedProperty = null; + internal static void SetInternalIsSelectedProperty(BindableObject bindable, object oldValue, object newValue) { var RecyclerViewItemStyle = (RecyclerViewItemStyle)bindable; RecyclerViewItemStyle.isSelected = (bool?)newValue; - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalIsSelectedProperty(BindableObject bindable) { var RecyclerViewItemStyle = (RecyclerViewItemStyle)bindable; return RecyclerViewItemStyle.isSelected; - }); + } private bool? isSelectable; private bool? isSelected; - static RecyclerViewItemStyle() { } + static RecyclerViewItemStyle() + { + if (NUIApplication.IsUsingXaml) + { + IsSelectableProperty = BindableProperty.Create(nameof(IsSelectable), typeof(bool?), typeof(RecyclerViewItemStyle), null, + propertyChanged: SetInternalIsSelectableProperty, defaultValueCreator: GetInternalIsSelectableProperty); + IsSelectedProperty = BindableProperty.Create(nameof(IsSelected), typeof(bool?), typeof(RecyclerViewItemStyle), null, + propertyChanged: SetInternalIsSelectedProperty, defaultValueCreator: GetInternalIsSelectedProperty); + } + } /// /// Creates a new instance of a RecyclerViewItemStyle. @@ -81,8 +93,28 @@ public RecyclerViewItemStyle(RecyclerViewItemStyle style) : base(style) [EditorBrowsable(EditorBrowsableState.Never)] public bool? IsSelectable { - get => (bool?)GetValue(IsSelectableProperty); - set => SetValue(IsSelectableProperty, value); + get + { + if (NUIApplication.IsUsingXaml) + { + return (bool?)GetValue(IsSelectableProperty); + } + else + { + return (bool?)GetInternalIsSelectableProperty(this); + } + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(IsSelectableProperty, value); + } + else + { + SetInternalIsSelectableProperty(this, null, value); + } + } } /// @@ -91,8 +123,28 @@ public bool? IsSelectable [EditorBrowsable(EditorBrowsableState.Never)] public bool? IsSelected { - get => (bool?)GetValue(IsSelectedProperty); - set => SetValue(IsSelectedProperty, value); + get + { + if (NUIApplication.IsUsingXaml) + { + return (bool?)GetValue(IsSelectedProperty); + } + else + { + return (bool?)GetInternalIsSelectedProperty(this); + } + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(IsSelectedProperty, value); + } + else + { + SetInternalIsSelectedProperty(this, null, value); + } + } } /// diff --git a/src/Tizen.NUI.Components/Style/ScrollbarStyle.cs b/src/Tizen.NUI.Components/Style/ScrollbarStyle.cs index efd8a180372..97129cd3b47 100644 --- a/src/Tizen.NUI.Components/Style/ScrollbarStyle.cs +++ b/src/Tizen.NUI.Components/Style/ScrollbarStyle.cs @@ -30,80 +30,87 @@ public class ScrollbarStyle : ControlStyle /// Bindable property of TrackThickness [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty TrackThicknessProperty = BindableProperty.Create(nameof(TrackThickness), typeof(float?), typeof(ScrollbarStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty TrackThicknessProperty = null; + internal static void SetInternalTrackThicknessProperty(BindableObject bindable, object oldValue, object newValue) { ((ScrollbarStyle)bindable).trackThickness = (float?)newValue; - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalTrackThicknessProperty(BindableObject bindable) { return ((ScrollbarStyle)bindable).trackThickness; - }); + } /// Bindable property of ThumbThickness [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty ThumbThicknessProperty = BindableProperty.Create(nameof(ThumbThickness), typeof(float?), typeof(ScrollbarStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty ThumbThicknessProperty = null; + internal static void SetInternalThumbThicknessProperty(BindableObject bindable, object oldValue, object newValue) { ((ScrollbarStyle)bindable).thumbThickness = (float?)newValue; - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalThumbThicknessProperty(BindableObject bindable) { return ((ScrollbarStyle)bindable).thumbThickness; - }); + } /// Bindable property of TrackColor [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty TrackColorProperty = BindableProperty.Create(nameof(TrackColor), typeof(Color), typeof(ScrollbarStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty TrackColorProperty = null; + internal static void SetInternalTrackColorProperty(BindableObject bindable, object oldValue, object newValue) { ((ScrollbarStyle)bindable).trackColor = new Color((Color)newValue); - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalTrackColorProperty(BindableObject bindable) { return ((ScrollbarStyle)bindable).trackColor; - }); + } /// Bindable property of ThumbColor [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty ThumbColorProperty = BindableProperty.Create(nameof(ThumbColor), typeof(Color), typeof(ScrollbarStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty ThumbColorProperty = null; + internal static void SetInternalThumbColorProperty(BindableObject bindable, object oldValue, object newValue) { ((ScrollbarStyle)bindable).thumbColor = new Color((Color)newValue); - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalThumbColorProperty(BindableObject bindable) { return ((ScrollbarStyle)bindable).thumbColor; - }); + } /// Bindable property of TrackPadding [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty TrackPaddingProperty = BindableProperty.Create(nameof(TrackPadding), typeof(Extents), typeof(ScrollbarStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty TrackPaddingProperty = null; + internal static void SetInternalTrackPaddingProperty(BindableObject bindable, object oldValue, object newValue) { ((ScrollbarStyle)bindable).trackPadding = new Extents((Extents)newValue); - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalTrackPaddingProperty(BindableObject bindable) { return ((ScrollbarStyle)bindable).trackPadding; - }); + } /// Bindable property of ThumbBackgroundImageVertical [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty ThumbVerticalImageUrlProperty = BindableProperty.Create(nameof(ThumbVerticalImageUrl), typeof(string), typeof(ScrollbarStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty ThumbVerticalImageUrlProperty = null; + internal static void SetInternalThumbVerticalImageUrlProperty(BindableObject bindable, object oldValue, object newValue) { ((ScrollbarStyle)bindable).thumbVerticalImageUrl = ((string)newValue); - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalThumbVerticalImageUrlProperty(BindableObject bindable) { return ((ScrollbarStyle)bindable).thumbVerticalImageUrl; - }); + } /// Bindable property of ThumbBackgroundImageUrl [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty ThumbHorizontalImageUrlProperty = BindableProperty.Create(nameof(ThumbHorizontalImageUrl), typeof(string), typeof(ScrollbarStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty ThumbHorizontalImageUrlProperty = null; + internal static void SetInternalThumbHorizontalImageUrlProperty(BindableObject bindable, object oldValue, object newValue) { ((ScrollbarStyle)bindable).thumbHorizontalImageUrl = ((string)newValue); - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalThumbHorizontalImageUrlProperty(BindableObject bindable) { return ((ScrollbarStyle)bindable).thumbHorizontalImageUrl; - }); + } private float? trackThickness; private float? thumbThickness; @@ -117,7 +124,6 @@ public class ScrollbarStyle : ControlStyle #region Constructors - /// /// Creates a new instance of a ScrollbarStyle. /// @@ -140,6 +146,23 @@ public ScrollbarStyle(ScrollbarStyle style) : base(style) /// static ScrollbarStyle() { + if (NUIApplication.IsUsingXaml) + { + TrackThicknessProperty = BindableProperty.Create(nameof(TrackThickness), typeof(float?), typeof(ScrollbarStyle), null, + propertyChanged: SetInternalTrackThicknessProperty, defaultValueCreator: GetInternalTrackThicknessProperty); + ThumbThicknessProperty = BindableProperty.Create(nameof(ThumbThickness), typeof(float?), typeof(ScrollbarStyle), null, + propertyChanged: SetInternalThumbThicknessProperty, defaultValueCreator: GetInternalThumbThicknessProperty); + TrackColorProperty = BindableProperty.Create(nameof(TrackColor), typeof(Color), typeof(ScrollbarStyle), null, + propertyChanged: SetInternalTrackColorProperty, defaultValueCreator: GetInternalTrackColorProperty); + ThumbColorProperty = BindableProperty.Create(nameof(ThumbColor), typeof(Color), typeof(ScrollbarStyle), null, + propertyChanged: SetInternalThumbColorProperty, defaultValueCreator: GetInternalThumbColorProperty); + TrackPaddingProperty = BindableProperty.Create(nameof(TrackPadding), typeof(Extents), typeof(ScrollbarStyle), null, + propertyChanged: SetInternalTrackPaddingProperty, defaultValueCreator: GetInternalTrackPaddingProperty); + ThumbVerticalImageUrlProperty = BindableProperty.Create(nameof(ThumbVerticalImageUrl), typeof(string), typeof(ScrollbarStyle), null, + propertyChanged: SetInternalThumbVerticalImageUrlProperty, defaultValueCreator: GetInternalThumbVerticalImageUrlProperty); + ThumbHorizontalImageUrlProperty = BindableProperty.Create(nameof(ThumbHorizontalImageUrl), typeof(string), typeof(ScrollbarStyle), null, + propertyChanged: SetInternalThumbHorizontalImageUrlProperty, defaultValueCreator: GetInternalThumbHorizontalImageUrlProperty); + } } #endregion Constructors @@ -153,8 +176,28 @@ static ScrollbarStyle() [EditorBrowsable(EditorBrowsableState.Never)] public float? TrackThickness { - get => (float?)GetValue(TrackThicknessProperty); - set => SetValue(TrackThicknessProperty, value); + get + { + if (NUIApplication.IsUsingXaml) + { + return (float?)GetValue(TrackThicknessProperty); + } + else + { + return (float?)GetInternalTrackThicknessProperty(this); + } + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(TrackThicknessProperty, value); + } + else + { + SetInternalTrackThicknessProperty(this, null, value); + } + } } /// @@ -163,8 +206,28 @@ public float? TrackThickness [EditorBrowsable(EditorBrowsableState.Never)] public float? ThumbThickness { - get => (float?)GetValue(ThumbThicknessProperty); - set => SetValue(ThumbThicknessProperty, value); + get + { + if (NUIApplication.IsUsingXaml) + { + return (float?)GetValue(ThumbThicknessProperty); + } + else + { + return (float?)GetInternalThumbThicknessProperty(this); + } + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(ThumbThicknessProperty, value); + } + else + { + SetInternalThumbThicknessProperty(this, null, value); + } + } } /// @@ -173,8 +236,28 @@ public float? ThumbThickness [EditorBrowsable(EditorBrowsableState.Never)] public Color TrackColor { - get => (Color)GetValue(TrackColorProperty); - set => SetValue(TrackColorProperty, value); + get + { + if (NUIApplication.IsUsingXaml) + { + return (Color)GetValue(TrackColorProperty); + } + else + { + return (Color)GetInternalTrackColorProperty(this); + } + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(TrackColorProperty, value); + } + else + { + SetInternalTrackColorProperty(this, null, value); + } + } } /// @@ -183,8 +266,28 @@ public Color TrackColor [EditorBrowsable(EditorBrowsableState.Never)] public Color ThumbColor { - get => (Color)GetValue(ThumbColorProperty); - set => SetValue(ThumbColorProperty, value); + get + { + if (NUIApplication.IsUsingXaml) + { + return (Color)GetValue(ThumbColorProperty); + } + else + { + return (Color)GetInternalThumbColorProperty(this); + } + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(ThumbColorProperty, value); + } + else + { + SetInternalThumbColorProperty(this, null, value); + } + } } /// @@ -193,8 +296,28 @@ public Color ThumbColor [EditorBrowsable(EditorBrowsableState.Never)] public Extents TrackPadding { - get => (Extents)GetValue(TrackPaddingProperty); - set => SetValue(TrackPaddingProperty, value); + get + { + if (NUIApplication.IsUsingXaml) + { + return (Extents)GetValue(TrackPaddingProperty); + } + else + { + return (Extents)GetInternalTrackPaddingProperty(this); + } + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(TrackPaddingProperty, value); + } + else + { + SetInternalTrackPaddingProperty(this, null, value); + } + } } /// @@ -203,8 +326,28 @@ public Extents TrackPadding [EditorBrowsable(EditorBrowsableState.Never)] public string ThumbVerticalImageUrl { - get => (string)GetValue(ThumbVerticalImageUrlProperty); - set => SetValue(ThumbVerticalImageUrlProperty, value); + get + { + if (NUIApplication.IsUsingXaml) + { + return (string)GetValue(ThumbVerticalImageUrlProperty); + } + else + { + return (string)GetInternalThumbVerticalImageUrlProperty(this); + } + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(ThumbVerticalImageUrlProperty, value); + } + else + { + SetInternalThumbVerticalImageUrlProperty(this, null, value); + } + } } /// @@ -213,8 +356,28 @@ public string ThumbVerticalImageUrl [EditorBrowsable(EditorBrowsableState.Never)] public string ThumbHorizontalImageUrl { - get => (string)GetValue(ThumbHorizontalImageUrlProperty); - set => SetValue(ThumbHorizontalImageUrlProperty, value); + get + { + if (NUIApplication.IsUsingXaml) + { + return (string)GetValue(ThumbHorizontalImageUrlProperty); + } + else + { + return (string)GetInternalThumbHorizontalImageUrlProperty(this); + } + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(ThumbHorizontalImageUrlProperty, value); + } + else + { + SetInternalThumbHorizontalImageUrlProperty(this, null, value); + } + } } /// diff --git a/src/Tizen.NUI.Components/Style/SliderStyle.cs b/src/Tizen.NUI.Components/Style/SliderStyle.cs index 023cbdc30ff..bbeb235fea5 100755 --- a/src/Tizen.NUI.Components/Style/SliderStyle.cs +++ b/src/Tizen.NUI.Components/Style/SliderStyle.cs @@ -31,76 +31,93 @@ public class SliderStyle : ControlStyle /// IndicatorTypeProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty IndicatorTypeProperty = BindableProperty.Create(nameof(IndicatorType), typeof(IndicatorType?), typeof(SliderStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty IndicatorTypeProperty = null; + internal static void SetInternalIndicatorTypeProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (SliderStyle)bindable; if (newValue != null) { instance.privateIndicatorType = (IndicatorType)newValue; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalIndicatorTypeProperty(BindableObject bindable) { var instance = (SliderStyle)bindable; return instance.privateIndicatorType; - }); + } /// /// SpaceBetweenTrackAndIndicatorProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty SpaceBetweenTrackAndIndicatorProperty = BindableProperty.Create(nameof(SpaceBetweenTrackAndIndicator), typeof(uint?), typeof(SliderStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty SpaceBetweenTrackAndIndicatorProperty = null; + internal static void SetInternalSpaceBetweenTrackAndIndicatorProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (SliderStyle)bindable; if (newValue != null) { instance.privateSpaceBetweenTrackAndIndicator = (uint?)newValue; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalSpaceBetweenTrackAndIndicatorProperty(BindableObject bindable) { var instance = (SliderStyle)bindable; return instance.privateSpaceBetweenTrackAndIndicator; - }); + } /// /// TrackThicknessProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty TrackThicknessProperty = BindableProperty.Create(nameof(TrackThickness), typeof(uint?), typeof(SliderStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty TrackThicknessProperty = null; + internal static void SetInternalTrackThicknessProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (SliderStyle)bindable; if (newValue != null) { instance.privateTrackThickness = (uint?)newValue; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalTrackThicknessProperty(BindableObject bindable) { var instance = (SliderStyle)bindable; return instance.privateTrackThickness; - }); + } /// /// TrackPaddingProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty TrackPaddingProperty = BindableProperty.Create(nameof(TrackPadding), typeof(Extents), typeof(SliderStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty TrackPaddingProperty = null; + internal static void SetInternalTrackPaddingProperty(BindableObject bindable, object oldValue, object newValue) { ((SliderStyle)bindable).trackPadding = newValue == null ? null : new Extents((Extents)newValue); - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalTrackPaddingProperty(BindableObject bindable) { var instance = (SliderStyle)bindable; return instance.trackPadding; - }); + } private IndicatorType? privateIndicatorType = Slider.IndicatorType.None; private uint? privateTrackThickness; private uint? privateSpaceBetweenTrackAndIndicator; private Extents trackPadding; - static SliderStyle() { } + static SliderStyle() + { + if (NUIApplication.IsUsingXaml) + { + IndicatorTypeProperty = BindableProperty.Create(nameof(IndicatorType), typeof(IndicatorType?), typeof(SliderStyle), null, + propertyChanged: SetInternalIndicatorTypeProperty, defaultValueCreator: GetInternalIndicatorTypeProperty); + SpaceBetweenTrackAndIndicatorProperty = BindableProperty.Create(nameof(SpaceBetweenTrackAndIndicator), typeof(uint?), typeof(SliderStyle), null, + propertyChanged: SetInternalSpaceBetweenTrackAndIndicatorProperty, defaultValueCreator: GetInternalSpaceBetweenTrackAndIndicatorProperty); + TrackThicknessProperty = BindableProperty.Create(nameof(TrackThickness), typeof(uint?), typeof(SliderStyle), null, + propertyChanged: SetInternalTrackThicknessProperty, defaultValueCreator: GetInternalTrackThicknessProperty); + TrackPaddingProperty = BindableProperty.Create(nameof(TrackPadding), typeof(Extents), typeof(SliderStyle), null, + propertyChanged: SetInternalTrackPaddingProperty, defaultValueCreator: GetInternalTrackPaddingProperty); + } + } /// /// Creates a new instance of a SliderStyle. @@ -193,8 +210,28 @@ public SliderStyle(SliderStyle style) : base(style) /// 8 public IndicatorType? IndicatorType { - get => (IndicatorType?)GetValue(IndicatorTypeProperty); - set => SetValue(IndicatorTypeProperty, value); + get + { + if (NUIApplication.IsUsingXaml) + { + return (IndicatorType?)GetValue(IndicatorTypeProperty); + } + else + { + return (IndicatorType)GetInternalIndicatorTypeProperty(this); + } + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(IndicatorTypeProperty, value); + } + else + { + SetInternalIndicatorTypeProperty(this, null, value); + } + } } /// @@ -203,8 +240,28 @@ public IndicatorType? IndicatorType /// 8 public uint? TrackThickness { - get => (uint?)GetValue(TrackThicknessProperty); - set => SetValue(TrackThicknessProperty, value); + get + { + if (NUIApplication.IsUsingXaml) + { + return (uint?)GetValue(TrackThicknessProperty); + } + else + { + return (uint?)GetInternalTrackThicknessProperty(this); + } + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(TrackThicknessProperty, value); + } + else + { + SetInternalTrackThicknessProperty(this, null, value); + } + } } /// @@ -213,8 +270,28 @@ public uint? TrackThickness /// 8 public uint? SpaceBetweenTrackAndIndicator { - get => (uint?)GetValue(SpaceBetweenTrackAndIndicatorProperty); - set => SetValue(SpaceBetweenTrackAndIndicatorProperty, value); + get + { + if (NUIApplication.IsUsingXaml) + { + return (uint?)GetValue(SpaceBetweenTrackAndIndicatorProperty); + } + else + { + return (uint?)GetInternalSpaceBetweenTrackAndIndicatorProperty(this); + } + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(SpaceBetweenTrackAndIndicatorProperty, value); + } + else + { + SetInternalSpaceBetweenTrackAndIndicatorProperty(this, null, value); + } + } } /// @@ -223,8 +300,28 @@ public uint? SpaceBetweenTrackAndIndicator /// 8 public Extents TrackPadding { - get => ((Extents)GetValue(TrackPaddingProperty)) ?? (trackPadding = new Extents(0, 0, 0, 0)); - set => SetValue(TrackPaddingProperty, value); + get + { + if (NUIApplication.IsUsingXaml) + { + return ((Extents)GetValue(TrackPaddingProperty)) ?? (trackPadding = new Extents(0, 0, 0, 0)); + } + else + { + return (Extents)GetInternalTrackPaddingProperty(this) ?? (trackPadding = new Extents(0, 0, 0, 0)); + } + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(TrackPaddingProperty, value); + } + else + { + SetInternalTrackPaddingProperty(this, null, value); + } + } } /// diff --git a/src/Tizen.NUI.Components/Style/ToastStyle.cs b/src/Tizen.NUI.Components/Style/ToastStyle.cs index 18d798ddd37..44107e0c3f4 100755 --- a/src/Tizen.NUI.Components/Style/ToastStyle.cs +++ b/src/Tizen.NUI.Components/Style/ToastStyle.cs @@ -28,18 +28,26 @@ public class ToastStyle : ControlStyle { /// The Duration bindable property. [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty DurationProperty = BindableProperty.Create(nameof(Duration), typeof(uint?), typeof(ToastStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty DurationProperty = null; + internal static void SetInternalDurationProperty(BindableObject bindable, object oldValue, object newValue) { ((ToastStyle)bindable).duration = (uint?)newValue; - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalDurationProperty(BindableObject bindable) { return ((ToastStyle)bindable).duration; - }); + } private uint? duration; - static ToastStyle() { } + static ToastStyle() + { + if (NUIApplication.IsUsingXaml) + { + DurationProperty = BindableProperty.Create(nameof(Duration), typeof(uint?), typeof(ToastStyle), null, + propertyChanged: SetInternalDurationProperty, defaultValueCreator: GetInternalDurationProperty); + } + } /// /// Creates a new instance of a ToastStyle. @@ -64,8 +72,28 @@ public ToastStyle(ToastStyle style) : base(style) [EditorBrowsable(EditorBrowsableState.Never)] public uint? Duration { - get => (uint?)GetValue(DurationProperty); - set => SetValue(DurationProperty, value); + get + { + if (NUIApplication.IsUsingXaml) + { + return (uint?)GetValue(DurationProperty); + } + else + { + return (uint?)GetInternalDurationProperty(this); + } + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(DurationProperty, value); + } + else + { + SetInternalDurationProperty(this, null, value); + } + } } ///