diff --git a/src/Tizen.NUI.Components/Controls/ImageScrollBar.cs b/src/Tizen.NUI.Components/Controls/ImageScrollBar.cs index d5d8394ef9c..2a5a94b6fca 100755 --- a/src/Tizen.NUI.Components/Controls/ImageScrollBar.cs +++ b/src/Tizen.NUI.Components/Controls/ImageScrollBar.cs @@ -160,6 +160,14 @@ static ScrollBar() propertyChanged: SetInternalCurrentValueProperty, defaultValueCreator: GetInternalCurrentValueProperty); DurationProperty = BindableProperty.Create(nameof(Duration), typeof(uint), typeof(ScrollBar), default(uint), propertyChanged: SetInternalDurationProperty, defaultValueCreator: GetInternalDurationProperty); + ThumbSizeProperty = BindableProperty.Create(nameof(ThumbSize), typeof(Size), typeof(ScrollBar), null, + propertyChanged: SetInternalThumbSizeProperty, defaultValueCreator: GetInternalThumbSizeProperty); + TrackImageURLProperty = BindableProperty.Create(nameof(TrackImageURL), typeof(string), typeof(ScrollBar), default(string), + propertyChanged: SetInternalTrackImageURLProperty, defaultValueCreator: GetInternalTrackImageURLProperty); + TrackColorProperty = BindableProperty.Create(nameof(TrackColor), typeof(Color), typeof(ScrollBar), null, + propertyChanged: SetInternalTrackColorProperty, defaultValueCreator: GetInternalTrackColorProperty); + ThumbColorProperty = BindableProperty.Create(nameof(ThumbColor), typeof(Color), typeof(ScrollBar), null, + propertyChanged: SetInternalThumbColorProperty, defaultValueCreator: GetInternalThumbColorProperty); } } @@ -273,11 +281,25 @@ public Size ThumbSize { get { - return GetValue(ThumbSizeProperty) as Size; + if (NUIApplication.IsUsingXaml) + { + return GetValue(ThumbSizeProperty) as Size; + } + else + { + return GetInternalThumbSizeProperty(this) as Size; + } } set { - SetValue(ThumbSizeProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(ThumbSizeProperty, value); + } + else + { + SetInternalThumbSizeProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -307,11 +329,25 @@ public string TrackImageURL { get { - return GetValue(TrackImageURLProperty) as string; + if (NUIApplication.IsUsingXaml) + { + return GetValue(TrackImageURLProperty) as string; + } + else + { + return GetInternalTrackImageURLProperty(this) as string; + } } set { - SetValue(TrackImageURLProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(TrackImageURLProperty, value); + } + else + { + SetInternalTrackImageURLProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -341,11 +377,25 @@ public Color TrackColor { get { - return GetValue(TrackColorProperty) as Color; + if (NUIApplication.IsUsingXaml) + { + return GetValue(TrackColorProperty) as Color; + } + else + { + return GetInternalTrackColorProperty(this) as Color; + } } set { - SetValue(TrackColorProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(TrackColorProperty, value); + } + else + { + SetInternalTrackColorProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -374,11 +424,25 @@ public Color ThumbColor { get { - return GetValue(ThumbColorProperty) as Color; + if (NUIApplication.IsUsingXaml) + { + return GetValue(ThumbColorProperty) as Color; + } + else + { + return GetInternalThumbColorProperty(this) as Color; + } } set { - SetValue(ThumbColorProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(ThumbColorProperty, value); + } + else + { + SetInternalThumbColorProperty(this, null, value); + } NotifyPropertyChanged(); } } diff --git a/src/Tizen.NUI.Components/Controls/ScrollBarBindableProperty.cs b/src/Tizen.NUI.Components/Controls/ScrollBarBindableProperty.cs index ab294c87e58..cd32136ee37 100755 --- a/src/Tizen.NUI.Components/Controls/ScrollBarBindableProperty.cs +++ b/src/Tizen.NUI.Components/Controls/ScrollBarBindableProperty.cs @@ -9,72 +9,76 @@ public partial class ScrollBar /// ThumbSizeProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty ThumbSizeProperty = BindableProperty.Create(nameof(ThumbSize), typeof(Size), typeof(ScrollBar), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty ThumbSizeProperty = null; + internal static void SetInternalThumbSizeProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (ScrollBar)bindable; if (newValue != null) { instance.InternalThumbSize = newValue as Size; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalThumbSizeProperty(BindableObject bindable) { var instance = (ScrollBar)bindable; return instance.InternalThumbSize; - }); + } /// /// TrackImageURLProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty TrackImageURLProperty = BindableProperty.Create(nameof(TrackImageURL), typeof(string), typeof(ScrollBar), default(string), propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty TrackImageURLProperty = null; + internal static void SetInternalTrackImageURLProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (ScrollBar)bindable; if (newValue != null) { instance.InternalTrackImageURL = newValue as string; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalTrackImageURLProperty(BindableObject bindable) { var instance = (ScrollBar)bindable; return instance.InternalTrackImageURL; - }); + } /// /// TrackColorProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty TrackColorProperty = BindableProperty.Create(nameof(TrackColor), typeof(Color), typeof(ScrollBar), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty TrackColorProperty = null; + internal static void SetInternalTrackColorProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (ScrollBar)bindable; if (newValue != null) { instance.InternalTrackColor = newValue as Color; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalTrackColorProperty(BindableObject bindable) { var instance = (ScrollBar)bindable; return instance.InternalTrackColor; - }); + } /// /// ThumbColorProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty ThumbColorProperty = BindableProperty.Create(nameof(ThumbColor), typeof(Color), typeof(ScrollBar), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty ThumbColorProperty = null; + internal static void SetInternalThumbColorProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (ScrollBar)bindable; if (newValue != null) { instance.InternalThumbColor = newValue as Color; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalThumbColorProperty(BindableObject bindable) { var instance = (ScrollBar)bindable; return instance.InternalThumbColor; - }); + } } } diff --git a/src/Tizen.NUI.Components/Controls/Scrollbar.cs b/src/Tizen.NUI.Components/Controls/Scrollbar.cs index a8950ec2594..ca4f55285f1 100755 --- a/src/Tizen.NUI.Components/Controls/Scrollbar.cs +++ b/src/Tizen.NUI.Components/Controls/Scrollbar.cs @@ -35,53 +35,87 @@ public class Scrollbar : ScrollbarBase /// Bindable property of TrackThickness [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty TrackThicknessProperty = BindableProperty.Create(nameof(TrackThickness), typeof(float), typeof(Scrollbar), default(float), - propertyChanged: (bindable, oldValue, newValue) => ((Scrollbar)bindable).UpdateTrackThickness((float?)newValue ?? 0), - defaultValueCreator: (bindable) => ((Scrollbar)bindable).trackThickness - ); + public static readonly BindableProperty TrackThicknessProperty = null; + internal static void SetInternalTrackThicknessProperty(BindableObject bindable, object oldValue, object newValue) + { + ((Scrollbar)bindable).UpdateTrackThickness((float?)newValue ?? 0); + } + internal static object GetInternalTrackThicknessProperty(BindableObject bindable) + { + return ((Scrollbar)bindable).trackThickness; + } /// Bindable property of ThumbThickness [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty ThumbThicknessProperty = BindableProperty.Create(nameof(ThumbThickness), typeof(float), typeof(Scrollbar), default(float), - propertyChanged: (bindable, oldValue, newValue) => ((Scrollbar)bindable).UpdateThumbThickness((float?)newValue ?? 0), - defaultValueCreator: (bindable) => ((Scrollbar)bindable).thumbThickness - ); + public static readonly BindableProperty ThumbThicknessProperty = null; + internal static void SetInternalThumbThicknessProperty(BindableObject bindable, object oldValue, object newValue) + { + ((Scrollbar)bindable).UpdateThumbThickness((float?)newValue ?? 0); + } + internal static object GetInternalThumbThicknessProperty(BindableObject bindable) + { + return ((Scrollbar)bindable).thumbThickness; + } /// Bindable property of TrackColor [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty TrackColorProperty = BindableProperty.Create(nameof(TrackColor), typeof(Color), typeof(Scrollbar), null, - propertyChanged: (bindable, oldValue, newValue) => ((Scrollbar)bindable).trackView.BackgroundColor = (Color)newValue, - defaultValueCreator: (bindable) => ((Scrollbar)bindable).trackView.BackgroundColor - ); + public static readonly BindableProperty TrackColorProperty = null; + internal static void SetInternalTrackColorProperty(BindableObject bindable, object oldValue, object newValue) + { + ((Scrollbar)bindable).trackView.BackgroundColor = (Color)newValue; + } + internal static object GetInternalTrackColorProperty(BindableObject bindable) + { + return ((Scrollbar)bindable).trackView.BackgroundColor; + } /// Bindable property of ThumbColor [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty ThumbColorProperty = BindableProperty.Create(nameof(ThumbColor), typeof(Color), typeof(Scrollbar), null, - propertyChanged: (bindable, oldValue, newValue) => ((Scrollbar)bindable).UpdateThumbColor((Color)newValue), - defaultValueCreator: (bindable) => ((Scrollbar)bindable).thumbColor - ); + public static readonly BindableProperty ThumbColorProperty = null; + internal static void SetInternalThumbColorProperty(BindableObject bindable, object oldValue, object newValue) + { + ((Scrollbar)bindable).UpdateThumbColor((Color)newValue); + } + internal static object GetInternalThumbColorProperty(BindableObject bindable) + { + return ((Scrollbar)bindable).thumbColor; + } /// Bindable property of TrackPadding [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty TrackPaddingProperty = BindableProperty.Create(nameof(TrackPadding), typeof(Extents), typeof(Scrollbar), null, - propertyChanged: (bindable, oldValue, newValue) => ((Scrollbar)bindable).UpdateTrackPadding((Extents)newValue), - defaultValueCreator: (bindable) => ((Scrollbar)bindable).trackPadding - ); + public static readonly BindableProperty TrackPaddingProperty = null; + internal static void SetInternalTrackPaddingProperty(BindableObject bindable, object oldValue, object newValue) + { + ((Scrollbar)bindable).UpdateTrackPadding((Extents)newValue); + } + internal static object GetInternalTrackPaddingProperty(BindableObject bindable) + { + return ((Scrollbar)bindable).trackPadding; + } /// Bindable property of ThumbVerticalImageUrl [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty ThumbVerticalImageUrlProperty = BindableProperty.Create(nameof(ThumbVerticalImageUrl), typeof(string), typeof(Scrollbar), null, - propertyChanged: (bindable, oldValue, newValue) => ((Scrollbar)bindable).UpdateThumbImage((string)newValue, false), - defaultValueCreator: (bindable) => ((Scrollbar)bindable).thumbVerticalImageUrl - ); + public static readonly BindableProperty ThumbVerticalImageUrlProperty = null; + internal static void SetInternalThumbVerticalImageUrlProperty(BindableObject bindable, object oldValue, object newValue) + { + ((Scrollbar)bindable).UpdateThumbImage((string)newValue, false); + } + internal static object GetInternalThumbVerticalImageUrlProperty(BindableObject bindable) + { + return ((Scrollbar)bindable).thumbVerticalImageUrl; + } /// Bindable property of ThumbHorizontalImageUrl [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty ThumbHorizontalImageUrlProperty = BindableProperty.Create(nameof(ThumbHorizontalImageUrl), typeof(string), typeof(Scrollbar), null, - propertyChanged: (bindable, oldValue, newValue) => ((Scrollbar)bindable).UpdateThumbImage((string)newValue, true), - defaultValueCreator: (bindable) => ((Scrollbar)bindable).thumbHorizontalImageUrl - ); - + public static readonly BindableProperty ThumbHorizontalImageUrlProperty = null; + internal static void SetInternalThumbHorizontalImageUrlProperty(BindableObject bindable, object oldValue, object newValue) + { + ((Scrollbar)bindable).UpdateThumbImage((string)newValue, true); + } + internal static object GetInternalThumbHorizontalImageUrlProperty(BindableObject bindable) + { + return ((Scrollbar)bindable).thumbHorizontalImageUrl; + } private View trackView; private ImageView thumbView; @@ -140,6 +174,23 @@ public Scrollbar(ScrollbarStyle style) : base(style) /// static Scrollbar() { + if (NUIApplication.IsUsingXaml) + { + TrackThicknessProperty = BindableProperty.Create(nameof(TrackThickness), typeof(float), typeof(Scrollbar), default(float), + propertyChanged: SetInternalTrackThicknessProperty, defaultValueCreator: GetInternalTrackThicknessProperty); + ThumbThicknessProperty = BindableProperty.Create(nameof(ThumbThickness), typeof(float), typeof(Scrollbar), default(float), + propertyChanged: SetInternalThumbThicknessProperty, defaultValueCreator: GetInternalThumbThicknessProperty); + TrackColorProperty = BindableProperty.Create(nameof(TrackColor), typeof(Color), typeof(Scrollbar), null, + propertyChanged: SetInternalTrackColorProperty, defaultValueCreator: GetInternalTrackColorProperty); + ThumbColorProperty = BindableProperty.Create(nameof(ThumbColor), typeof(Color), typeof(Scrollbar), null, + propertyChanged: SetInternalThumbColorProperty, defaultValueCreator: GetInternalThumbColorProperty); + TrackPaddingProperty = BindableProperty.Create(nameof(TrackPadding), typeof(Extents), typeof(Scrollbar), null, + propertyChanged: SetInternalTrackPaddingProperty, defaultValueCreator: GetInternalTrackPaddingProperty); + ThumbVerticalImageUrlProperty = BindableProperty.Create(nameof(ThumbVerticalImageUrl), typeof(string), typeof(Scrollbar), null, + propertyChanged: SetInternalThumbVerticalImageUrlProperty, defaultValueCreator: GetInternalThumbVerticalImageUrlProperty); + ThumbHorizontalImageUrlProperty = BindableProperty.Create(nameof(ThumbHorizontalImageUrl), typeof(string), typeof(Scrollbar), null, + propertyChanged: SetInternalThumbHorizontalImageUrlProperty, defaultValueCreator: GetInternalThumbHorizontalImageUrlProperty); + } } #endregion Constructors @@ -153,8 +204,28 @@ static Scrollbar() [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 +234,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 +264,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 +294,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); + } + } } /// @@ -195,8 +326,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); + } + } } /// @@ -205,8 +356,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); + } + } } /// @@ -215,8 +386,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/Controls/Slider.cs b/src/Tizen.NUI.Components/Controls/Slider.cs index b1d3e6442dd..7cd948e7ee0 100755 --- a/src/Tizen.NUI.Components/Controls/Slider.cs +++ b/src/Tizen.NUI.Components/Controls/Slider.cs @@ -72,61 +72,65 @@ public partial class Slider : Control, IAtspiValue /// SpaceBetweenTrackAndIndicatorProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty IndicatorProperty = BindableProperty.Create(nameof(Indicator), typeof(IndicatorType), typeof(Slider), IndicatorType.None, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty IndicatorProperty = null; + internal static void SetInternalIndicatorProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Slider)bindable; if (newValue != null) { instance.privateIndicatorType = (IndicatorType)newValue; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalIndicatorProperty(BindableObject bindable) { var instance = (Slider)bindable; return instance.privateIndicatorType; - }); + } /// /// SpaceBetweenTrackAndIndicatorProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty SpaceBetweenTrackAndIndicatorProperty = BindableProperty.Create(nameof(SpaceBetweenTrackAndIndicator), typeof(uint), typeof(Slider), (uint)0, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty SpaceBetweenTrackAndIndicatorProperty = null; + internal static void SetInternalSpaceBetweenTrackAndIndicatorProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Slider)bindable; if (newValue != null) { instance.privateSpaceBetweenTrackAndIndicator = (uint)newValue; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalSpaceBetweenTrackAndIndicatorProperty(BindableObject bindable) { var instance = (Slider)bindable; return instance.privateSpaceBetweenTrackAndIndicator; - }); + } /// /// TrackThicknessProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty TrackThicknessProperty = BindableProperty.Create(nameof(TrackThickness), typeof(uint), typeof(Slider), (uint)0, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty TrackThicknessProperty = null; + internal static void SetInternalTrackThicknessProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Slider)bindable; if (newValue != null) { instance.privateTrackThickness = (uint)newValue; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalTrackThicknessProperty(BindableObject bindable) { var instance = (Slider)bindable; return instance.privateTrackThickness; - }); + } /// /// IsValueShownProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty IsValueShownProperty = BindableProperty.Create(nameof(IsValueShown), typeof(bool), typeof(Slider), true, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty IsValueShownProperty = null; + internal static void SetInternalIsValueShownProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Slider)bindable; if (newValue != null) @@ -137,18 +141,19 @@ public partial class Slider : Control, IAtspiValue instance.isValueShown = newValueShown; } } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalIsValueShownProperty(BindableObject bindable) { var instance = (Slider)bindable; return instance.isValueShown; - }); + } /// /// ValueIndicatorTextProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty ValueIndicatorTextProperty = BindableProperty.Create(nameof(ValueIndicatorText), typeof(string), typeof(Slider), string.Empty, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty ValueIndicatorTextProperty = null; + internal static void SetInternalValueIndicatorTextProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Slider)bindable; if (newValue != null) @@ -156,12 +161,12 @@ public partial class Slider : Control, IAtspiValue string newText = (string)newValue; instance.valueIndicatorText.Text = newText; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalValueIndicatorTextProperty(BindableObject bindable) { var instance = (Slider)bindable; return instance.valueIndicatorText.Text; - }); + } /// /// Bindable property of CurrentValue @@ -170,46 +175,112 @@ public partial class Slider : Control, IAtspiValue /// /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty CurrentValueProperty = BindableProperty.Create(nameof(CurrentValue), typeof(float), typeof(Slider), 0.0f, BindingMode.TwoWay, - propertyChanged: (bindable, oldValue, newValue) => - { - var instance = (Slider)bindable; + public static readonly BindableProperty CurrentValueProperty = null; + internal static void SetInternalCurrentValueProperty(BindableObject bindable, object oldValue, object newValue) + { + var instance = (Slider)bindable; - if (newValue != null) + if (newValue != null) + { + float value = (float)newValue; + if (value < instance.minValue) { - float value = (float)newValue; - if (value < instance.minValue) - { - instance.curValue = instance.minValue; - } - else if (value > instance.maxValue) - { - instance.curValue = instance.maxValue; - } - else - { - instance.curValue = value; - } + instance.curValue = instance.minValue; + } + else if (value > instance.maxValue) + { + instance.curValue = instance.maxValue; + } + else + { + instance.curValue = value; + } - instance.sliderValueChangedHandler?.Invoke(instance, new SliderValueChangedEventArgs - { - CurrentValue = instance.curValue - }); - if (Accessibility.Accessibility.IsEnabled && instance.IsHighlighted) - { - instance.EmitAccessibilityEvent(AccessibilityPropertyChangeEvent.Value); - } - instance.UpdateValue(); + instance.sliderValueChangedHandler?.Invoke(instance, new SliderValueChangedEventArgs + { + CurrentValue = instance.curValue + }); + if (Accessibility.Accessibility.IsEnabled && instance.IsHighlighted) + { + instance.EmitAccessibilityEvent(AccessibilityPropertyChangeEvent.Value); } - }, - defaultValueCreator: (bindable) => - { - var instance = (Slider)bindable; - return instance.curValue; + instance.UpdateValue(); } - ); - - static Slider() { } + } + internal static object GetInternalCurrentValueProperty(BindableObject bindable) + { + var instance = (Slider)bindable; + return instance.curValue; + } + + static Slider() + { + if (NUIApplication.IsUsingXaml) + { + IndicatorProperty = BindableProperty.Create(nameof(Indicator), typeof(IndicatorType), typeof(Slider), IndicatorType.None, + propertyChanged: SetInternalIndicatorProperty, defaultValueCreator: GetInternalIndicatorProperty); + SpaceBetweenTrackAndIndicatorProperty = BindableProperty.Create(nameof(SpaceBetweenTrackAndIndicator), typeof(uint), typeof(Slider), (uint)0, + propertyChanged: SetInternalSpaceBetweenTrackAndIndicatorProperty, defaultValueCreator: GetInternalSpaceBetweenTrackAndIndicatorProperty); + TrackThicknessProperty = BindableProperty.Create(nameof(TrackThickness), typeof(uint), typeof(Slider), (uint)0, + propertyChanged: SetInternalTrackThicknessProperty, defaultValueCreator: GetInternalTrackThicknessProperty); + IsValueShownProperty = BindableProperty.Create(nameof(IsValueShown), typeof(bool), typeof(Slider), true, + propertyChanged: SetInternalIsValueShownProperty, defaultValueCreator: GetInternalIsValueShownProperty); + ValueIndicatorTextProperty = BindableProperty.Create(nameof(ValueIndicatorText), typeof(string), typeof(Slider), string.Empty, + propertyChanged: SetInternalValueIndicatorTextProperty, defaultValueCreator: GetInternalValueIndicatorTextProperty); + CurrentValueProperty = BindableProperty.Create(nameof(CurrentValue), typeof(float), typeof(Slider), 0.0f, BindingMode.TwoWay, + propertyChanged: SetInternalCurrentValueProperty, defaultValueCreator: GetInternalCurrentValueProperty); + DirectionProperty = BindableProperty.Create(nameof(Direction), typeof(DirectionType), typeof(Slider), default(DirectionType), + propertyChanged: SetInternalDirectionProperty, defaultValueCreator: GetInternalDirectionProperty); + MinValueProperty = BindableProperty.Create(nameof(MinValue), typeof(float), typeof(Slider), default(float), + propertyChanged: SetInternalMinValueProperty, defaultValueCreator: GetInternalMinValueProperty); + MaxValueProperty = BindableProperty.Create(nameof(MaxValue), typeof(float), typeof(Slider), default(float), + propertyChanged: SetInternalMaxValueProperty, defaultValueCreator: GetInternalMaxValueProperty); + ThumbSizeProperty = BindableProperty.Create(nameof(ThumbSize), typeof(Size), typeof(Slider), null, + propertyChanged: SetInternalThumbSizeProperty, defaultValueCreator: GetInternalThumbSizeProperty); + ThumbImageURLProperty = BindableProperty.Create(nameof(ThumbImageURL), typeof(string), typeof(Slider), default(string), + propertyChanged: SetInternalThumbImageURLProperty, defaultValueCreator: GetInternalThumbImageURLProperty); + ThumbImageURLSelectorProperty = BindableProperty.Create(nameof(ThumbImageURLSelector), typeof(StringSelector), typeof(Slider), null, + propertyChanged: SetInternalThumbImageURLSelectorProperty, defaultValueCreator: GetInternalThumbImageURLSelectorProperty); + ThumbImageUrlProperty = BindableProperty.Create(nameof(ThumbImageUrl), typeof(Selector), typeof(Slider), null, + propertyChanged: SetInternalThumbImageUrlProperty, defaultValueCreator: GetInternalThumbImageUrlProperty); + ThumbColorProperty = BindableProperty.Create(nameof(ThumbColor), typeof(Color), typeof(Slider), null, + propertyChanged: SetInternalThumbColorProperty, defaultValueCreator: GetInternalThumbColorProperty); + BgTrackColorProperty = BindableProperty.Create(nameof(BgTrackColor), typeof(Color), typeof(Slider), null, + propertyChanged: SetInternalBgTrackColorProperty, defaultValueCreator: GetInternalBgTrackColorProperty); + SlidedTrackColorProperty = BindableProperty.Create(nameof(SlidedTrackColor), typeof(Color), typeof(Slider), null, + propertyChanged: SetInternalSlidedTrackColorProperty, defaultValueCreator: GetInternalSlidedTrackColorProperty); + WarningStartValueProperty = BindableProperty.Create(nameof(WarningStartValue), typeof(float), typeof(Slider), default(float), + propertyChanged: SetInternalWarningStartValueProperty, defaultValueCreator: GetInternalWarningStartValueProperty); + WarningTrackColorProperty = BindableProperty.Create(nameof(WarningTrackColor), typeof(Color), typeof(Slider), null, + propertyChanged: SetInternalWarningTrackColorProperty, defaultValueCreator: GetInternalWarningTrackColorProperty); + WarningSlidedTrackColorProperty = BindableProperty.Create(nameof(WarningSlidedTrackColor), typeof(Color), typeof(Slider), null, + propertyChanged: SetInternalWarningSlidedTrackColorProperty, defaultValueCreator: GetInternalWarningSlidedTrackColorProperty); + WarningThumbImageUrlProperty = BindableProperty.Create(nameof(WarningThumbImageUrl), typeof(Tizen.NUI.BaseComponents.Selector), typeof(Slider), null, + propertyChanged: SetInternalWarningThumbImageUrlProperty, defaultValueCreator: GetInternalWarningThumbImageUrlProperty); + WarningThumbColorProperty = BindableProperty.Create(nameof(WarningThumbColor), typeof(Color), typeof(Slider), null, + propertyChanged: SetInternalWarningThumbColorProperty, defaultValueCreator: GetInternalWarningThumbColorProperty); + LowIndicatorImageURLProperty = BindableProperty.Create(nameof(LowIndicatorImageURL), typeof(string), typeof(Slider), default(string), + propertyChanged: SetInternalLowIndicatorImageURLProperty, defaultValueCreator: GetInternalLowIndicatorImageURLProperty); + HighIndicatorImageURLProperty = BindableProperty.Create(nameof(HighIndicatorImageURL), typeof(string), typeof(Slider), default(string), + propertyChanged: SetInternalHighIndicatorImageURLProperty, defaultValueCreator: GetInternalHighIndicatorImageURLProperty); + LowIndicatorTextContentProperty = BindableProperty.Create(nameof(LowIndicatorTextContent), typeof(string), typeof(Slider), default(string), + propertyChanged: SetInternalLowIndicatorTextContentProperty, defaultValueCreator: GetInternalLowIndicatorTextContentProperty); + HighIndicatorTextContentProperty = BindableProperty.Create(nameof(HighIndicatorTextContent), typeof(string), typeof(Slider), default(string), + propertyChanged: SetInternalHighIndicatorTextContentProperty, defaultValueCreator: GetInternalHighIndicatorTextContentProperty); + LowIndicatorSizeProperty = BindableProperty.Create(nameof(LowIndicatorSize), typeof(Size), typeof(Slider), null, + propertyChanged: SetInternalLowIndicatorSizeProperty, defaultValueCreator: GetInternalLowIndicatorSizeProperty); + HighIndicatorSizeProperty = BindableProperty.Create(nameof(HighIndicatorSize), typeof(Size), typeof(Slider), null, + propertyChanged: SetInternalHighIndicatorSizeProperty, defaultValueCreator: GetInternalHighIndicatorSizeProperty); + ValueIndicatorSizeProperty = BindableProperty.Create(nameof(ValueIndicatorSize), typeof(Size), typeof(Slider), null, + propertyChanged: SetInternalValueIndicatorSizeProperty, defaultValueCreator: GetInternalValueIndicatorSizeProperty); + ValueIndicatorUrlProperty = BindableProperty.Create(nameof(ValueIndicatorUrl), typeof(string), typeof(Slider), default(string), + propertyChanged: SetInternalValueIndicatorUrlProperty, defaultValueCreator: GetInternalValueIndicatorUrlProperty); + IsDiscreteProperty = BindableProperty.Create(nameof(IsDiscrete), typeof(bool), typeof(Slider), default(bool), + propertyChanged: SetInternalIsDiscreteProperty, defaultValueCreator: GetInternalIsDiscreteProperty); + DiscreteValueProperty = BindableProperty.Create(nameof(DiscreteValue), typeof(float), typeof(Slider), default(float), + propertyChanged: SetInternalDiscreteValueProperty, defaultValueCreator: GetInternalDiscreteValueProperty); + } + } /// /// The constructor of the Slider class. @@ -346,11 +417,25 @@ public DirectionType Direction { get { - return (DirectionType)GetValue(DirectionProperty); + if (NUIApplication.IsUsingXaml) + { + return (DirectionType)GetValue(DirectionProperty); + } + else + { + return (DirectionType)GetInternalDirectionProperty(this); + } } set { - SetValue(DirectionProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(DirectionProperty, value); + } + else + { + SetInternalDirectionProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -383,11 +468,25 @@ public IndicatorType Indicator { get { - return (IndicatorType)GetValue(IndicatorProperty); + if (NUIApplication.IsUsingXaml) + { + return (IndicatorType)GetValue(IndicatorProperty); + } + else + { + return (IndicatorType)GetInternalIndicatorProperty(this); + } } set { - SetValue(IndicatorProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(IndicatorProperty, value); + } + else + { + SetInternalIndicatorProperty(this, null, value); + } } } @@ -399,11 +498,25 @@ public float MinValue { get { - return (float)GetValue(MinValueProperty); + if (!NUIApplication.IsUsingXaml) + { + return (float)GetValue(MinValueProperty); + } + else + { + return (float)GetInternalMinValueProperty(this); + } } set { - SetValue(MinValueProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(MinValueProperty, value); + } + else + { + SetInternalMinValueProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -428,11 +541,25 @@ public float MaxValue { get { - return (float)GetValue(MaxValueProperty); + if (NUIApplication.IsUsingXaml) + { + return (float)GetValue(MaxValueProperty); + } + else + { + return (float)GetInternalMaxValueProperty(this); + } } set { - SetValue(MaxValueProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(MaxValueProperty, value); + } + else + { + SetInternalMaxValueProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -457,11 +584,25 @@ public float CurrentValue { get { - return (float)GetValue(CurrentValueProperty); + if (NUIApplication.IsUsingXaml) + { + return (float)GetValue(CurrentValueProperty); + } + else + { + return (float)GetInternalCurrentValueProperty(this); + } } set { - SetValue(CurrentValueProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(CurrentValueProperty, value); + } + else + { + SetInternalCurrentValueProperty(this, null, value); + } } } @@ -473,11 +614,25 @@ public Size ThumbSize { get { - return GetValue(ThumbSizeProperty) as Size; + if (NUIApplication.IsUsingXaml) + { + return GetValue(ThumbSizeProperty) as Size; + } + else + { + return GetInternalThumbSizeProperty(this) as Size; + } } set { - SetValue(ThumbSizeProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(ThumbSizeProperty, value); + } + else + { + SetInternalThumbSizeProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -507,11 +662,25 @@ public string ThumbImageURL { get { - return GetValue(ThumbImageURLProperty) as string; + if (NUIApplication.IsUsingXaml) + { + return GetValue(ThumbImageURLProperty) as string; + } + else + { + return GetInternalThumbImageURLProperty(this) as string; + } } set { - SetValue(ThumbImageURLProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(ThumbImageURLProperty, value); + } + else + { + SetInternalThumbImageURLProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -543,11 +712,25 @@ public StringSelector ThumbImageURLSelector { get { - return GetValue(ThumbImageURLSelectorProperty) as StringSelector; + if (NUIApplication.IsUsingXaml) + { + return GetValue(ThumbImageURLSelectorProperty) as StringSelector; + } + else + { + return GetInternalThumbImageURLSelectorProperty(this) as StringSelector; + } } set { - SetValue(ThumbImageURLSelectorProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(ThumbImageURLSelectorProperty, value); + } + else + { + SetInternalThumbImageURLSelectorProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -584,11 +767,25 @@ public Selector ThumbImageUrl { get { - return GetValue(ThumbImageUrlProperty) as Selector; + if (NUIApplication.IsUsingXaml) + { + return GetValue(ThumbImageUrlProperty) as Selector; + } + else + { + return GetInternalThumbImageUrlProperty(this) as Selector; + } } set { - SetValue(ThumbImageUrlProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(ThumbImageUrlProperty, value); + } + else + { + SetInternalThumbImageUrlProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -626,11 +823,25 @@ public Color ThumbColor { get { - return GetValue(ThumbColorProperty) as Color; + if (NUIApplication.IsUsingXaml) + { + return GetValue(ThumbColorProperty) as Color; + } + else + { + return GetInternalThumbColorProperty(this) as Color; + } } set { - SetValue(ThumbColorProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(ThumbColorProperty, value); + } + else + { + SetInternalThumbColorProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -684,11 +895,25 @@ public Color BgTrackColor { get { - return GetValue(BgTrackColorProperty) as Color; + if (NUIApplication.IsUsingXaml) + { + return GetValue(BgTrackColorProperty) as Color; + } + else + { + return GetInternalBgTrackColorProperty(this) as Color; + } } set { - SetValue(BgTrackColorProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(BgTrackColorProperty, value); + } + else + { + SetInternalBgTrackColorProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -715,11 +940,25 @@ public Color SlidedTrackColor { get { - return GetValue(SlidedTrackColorProperty) as Color; + if (NUIApplication.IsUsingXaml) + { + return GetValue(SlidedTrackColorProperty) as Color; + } + else + { + return GetInternalSlidedTrackColorProperty(this) as Color; + } } set { - SetValue(SlidedTrackColorProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(SlidedTrackColorProperty, value); + } + else + { + SetInternalSlidedTrackColorProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -746,11 +985,25 @@ public uint TrackThickness { get { - return (uint)GetValue(TrackThicknessProperty); + if (NUIApplication.IsUsingXaml) + { + return (uint)GetValue(TrackThicknessProperty); + } + else + { + return (uint)GetInternalTrackThicknessProperty(this); + } } set { - SetValue(TrackThicknessProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(TrackThicknessProperty, value); + } + else + { + SetInternalTrackThicknessProperty(this, null, value); + } } } @@ -763,11 +1016,25 @@ public float WarningStartValue { get { - return (float)GetValue(WarningStartValueProperty); + if (NUIApplication.IsUsingXaml) + { + return (float)GetValue(WarningStartValueProperty); + } + else + { + return (float)GetInternalWarningStartValueProperty(this); + } } set { - SetValue(WarningStartValueProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(WarningStartValueProperty, value); + } + else + { + SetInternalWarningStartValueProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -793,11 +1060,25 @@ public Color WarningTrackColor { get { - return GetValue(WarningTrackColorProperty) as Color; + if (NUIApplication.IsUsingXaml) + { + return GetValue(WarningTrackColorProperty) as Color; + } + else + { + return GetInternalWarningTrackColorProperty(this) as Color; + } } set { - SetValue(WarningTrackColorProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(WarningTrackColorProperty, value); + } + else + { + SetInternalWarningTrackColorProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -825,11 +1106,25 @@ public Color WarningSlidedTrackColor { get { - return GetValue(WarningSlidedTrackColorProperty) as Color; + if (NUIApplication.IsUsingXaml) + { + return GetValue(WarningSlidedTrackColorProperty) as Color; + } + else + { + return GetInternalWarningSlidedTrackColorProperty(this) as Color; + } } set { - SetValue(WarningSlidedTrackColorProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(WarningSlidedTrackColorProperty, value); + } + else + { + SetInternalWarningSlidedTrackColorProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -858,11 +1153,25 @@ public Selector WarningThumbImageUrl { get { - return GetValue(WarningThumbImageUrlProperty) as Selector; + if (NUIApplication.IsUsingXaml) + { + return GetValue(WarningThumbImageUrlProperty) as Selector; + } + else + { + return GetInternalWarningThumbImageUrlProperty(this) as Selector; + } } set { - SetValue(WarningThumbImageUrlProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(WarningThumbImageUrlProperty, value); + } + else + { + SetInternalWarningThumbImageUrlProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -894,11 +1203,25 @@ public Color WarningThumbColor { get { - return GetValue(WarningThumbColorProperty) as Color; + if (NUIApplication.IsUsingXaml) + { + return GetValue(WarningThumbColorProperty) as Color; + } + else + { + return GetInternalWarningThumbColorProperty(this) as Color; + } } set { - SetValue(WarningThumbColorProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(WarningThumbColorProperty, value); + } + else + { + SetInternalWarningThumbColorProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -922,11 +1245,25 @@ public string LowIndicatorImageURL { get { - return GetValue(LowIndicatorImageURLProperty) as string; + if (NUIApplication.IsUsingXaml) + { + return GetValue(LowIndicatorImageURLProperty) as string; + } + else + { + return GetInternalLowIndicatorImageURLProperty(this) as string; + } } set { - SetValue(LowIndicatorImageURLProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(LowIndicatorImageURLProperty, value); + } + else + { + SetInternalLowIndicatorImageURLProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -958,11 +1295,25 @@ public string HighIndicatorImageURL { get { - return GetValue(HighIndicatorImageURLProperty) as string; + if (NUIApplication.IsUsingXaml) + { + return GetValue(HighIndicatorImageURLProperty) as string; + } + else + { + return GetInternalHighIndicatorImageURLProperty(this) as string; + } } set { - SetValue(HighIndicatorImageURLProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(HighIndicatorImageURLProperty, value); + } + else + { + SetInternalHighIndicatorImageURLProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -994,11 +1345,25 @@ public string LowIndicatorTextContent { get { - return GetValue(LowIndicatorTextContentProperty) as string; + if (NUIApplication.IsUsingXaml) + { + return GetValue(LowIndicatorTextContentProperty) as string; + } + else + { + return GetInternalLowIndicatorTextContentProperty(this) as string; + } } set { - SetValue(LowIndicatorTextContentProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(LowIndicatorTextContentProperty, value); + } + else + { + SetInternalLowIndicatorTextContentProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -1025,11 +1390,25 @@ public string HighIndicatorTextContent { get { - return GetValue(HighIndicatorTextContentProperty) as string; + if (NUIApplication.IsUsingXaml) + { + return GetValue(HighIndicatorTextContentProperty) as string; + } + else + { + return GetInternalHighIndicatorTextContentProperty(this) as string; + } } set { - SetValue(HighIndicatorTextContentProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(HighIndicatorTextContentProperty, value); + } + else + { + SetInternalHighIndicatorTextContentProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -1056,11 +1435,25 @@ public Size LowIndicatorSize { get { - return GetValue(LowIndicatorSizeProperty) as Size; + if (NUIApplication.IsUsingXaml) + { + return GetValue(LowIndicatorSizeProperty) as Size; + } + else + { + return GetInternalLowIndicatorSizeProperty(this) as Size; + } } set { - SetValue(LowIndicatorSizeProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(LowIndicatorSizeProperty, value); + } + else + { + SetInternalLowIndicatorSizeProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -1088,11 +1481,25 @@ public Size HighIndicatorSize { get { - return GetValue(HighIndicatorSizeProperty) as Size; + if (NUIApplication.IsUsingXaml) + { + return GetValue(HighIndicatorSizeProperty) as Size; + } + else + { + return GetInternalHighIndicatorSizeProperty(this) as Size; + } } set { - SetValue(HighIndicatorSizeProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(HighIndicatorSizeProperty, value); + } + else + { + SetInternalHighIndicatorSizeProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -1120,11 +1527,25 @@ public uint SpaceBetweenTrackAndIndicator { get { - return (uint)GetValue(SpaceBetweenTrackAndIndicatorProperty); + if (NUIApplication.IsUsingXaml) + { + return (uint)GetValue(SpaceBetweenTrackAndIndicatorProperty); + } + else + { + return (uint)GetInternalSpaceBetweenTrackAndIndicatorProperty(this); + } } set { - SetValue(SpaceBetweenTrackAndIndicatorProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(SpaceBetweenTrackAndIndicatorProperty, value); + } + else + { + SetInternalSpaceBetweenTrackAndIndicatorProperty(this, null, value); + } } } @@ -1136,11 +1557,25 @@ public bool IsValueShown { get { - return (bool)GetValue(IsValueShownProperty); + if (NUIApplication.IsUsingXaml) + { + return (bool)GetValue(IsValueShownProperty); + } + else + { + return (bool)GetInternalIsValueShownProperty(this); + } } set { - SetValue(IsValueShownProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(IsValueShownProperty, value); + } + else + { + SetInternalIsValueShownProperty(this, null, value); + } } } @@ -1152,11 +1587,25 @@ public string ValueIndicatorText { get { - return (string)GetValue(ValueIndicatorTextProperty); + if (NUIApplication.IsUsingXaml) + { + return (string)GetValue(ValueIndicatorTextProperty); + } + else + { + return (string)GetInternalValueIndicatorTextProperty(this); + } } set { - SetValue(ValueIndicatorTextProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(ValueIndicatorTextProperty, value); + } + else + { + SetInternalValueIndicatorTextProperty(this, null, value); + } } } @@ -1168,11 +1617,25 @@ public Size ValueIndicatorSize { get { - return GetValue(ValueIndicatorSizeProperty) as Size; + if (NUIApplication.IsUsingXaml) + { + return GetValue(ValueIndicatorSizeProperty) as Size; + } + else + { + return GetInternalValueIndicatorSizeProperty(this) as Size; + } } set { - SetValue(ValueIndicatorSizeProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(ValueIndicatorSizeProperty, value); + } + else + { + SetInternalValueIndicatorSizeProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -1199,11 +1662,25 @@ public string ValueIndicatorUrl { get { - return GetValue(ValueIndicatorUrlProperty) as string; + if (NUIApplication.IsUsingXaml) + { + return GetValue(ValueIndicatorUrlProperty) as string; + } + else + { + return GetInternalValueIndicatorUrlProperty(this) as string; + } } set { - SetValue(ValueIndicatorUrlProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(ValueIndicatorUrlProperty, value); + } + else + { + SetInternalValueIndicatorUrlProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -1232,11 +1709,25 @@ public bool IsDiscrete { get { - return (bool)GetValue(IsDiscreteProperty); + if (NUIApplication.IsUsingXaml) + { + return (bool)GetValue(IsDiscreteProperty); + } + else + { + return (bool)GetInternalIsDiscreteProperty(this); + } } set { - SetValue(IsDiscreteProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(IsDiscreteProperty, value); + } + else + { + SetInternalIsDiscreteProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -1256,11 +1747,25 @@ public float DiscreteValue { get { - return (float)GetValue(DiscreteValueProperty); + if (NUIApplication.IsUsingXaml) + { + return (float)GetValue(DiscreteValueProperty); + } + else + { + return (float)GetInternalDiscreteValueProperty(this); + } } set { - SetValue(DiscreteValueProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(DiscreteValueProperty, value); + } + else + { + SetInternalDiscreteValueProperty(this, null, value); + } NotifyPropertyChanged(); } } diff --git a/src/Tizen.NUI.Components/Controls/SliderBindableProperty.cs b/src/Tizen.NUI.Components/Controls/SliderBindableProperty.cs index ec36b198bfd..e1c227a9c93 100755 --- a/src/Tizen.NUI.Components/Controls/SliderBindableProperty.cs +++ b/src/Tizen.NUI.Components/Controls/SliderBindableProperty.cs @@ -10,448 +10,472 @@ public partial class Slider /// DirectionProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty DirectionProperty = BindableProperty.Create(nameof(Direction), typeof(DirectionType), typeof(Slider), default(DirectionType), propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty DirectionProperty = null; + internal static void SetInternalDirectionProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Slider)bindable; if (newValue != null) { instance.InternalDirection = (DirectionType)newValue; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalDirectionProperty(BindableObject bindable) { var instance = (Slider)bindable; return instance.InternalDirection; - }); + } /// /// MinValueProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty MinValueProperty = BindableProperty.Create(nameof(MinValue), typeof(float), typeof(Slider), default(float), propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty MinValueProperty = null; + internal static void SetInternalMinValueProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Slider)bindable; if (newValue != null) { instance.InternalMinValue = (float)newValue; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalMinValueProperty(BindableObject bindable) { var instance = (Slider)bindable; return instance.InternalMinValue; - }); + } /// /// MaxValueProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty MaxValueProperty = BindableProperty.Create(nameof(MaxValue), typeof(float), typeof(Slider), default(float), propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty MaxValueProperty = null; + internal static void SetInternalMaxValueProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Slider)bindable; if (newValue != null) { instance.InternalMaxValue = (float)newValue; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalMaxValueProperty(BindableObject bindable) { var instance = (Slider)bindable; return instance.InternalMaxValue; - }); + } /// /// ThumbSizeProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty ThumbSizeProperty = BindableProperty.Create(nameof(ThumbSize), typeof(Size), typeof(Slider), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty ThumbSizeProperty = null; + internal static void SetInternalThumbSizeProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Slider)bindable; if (newValue != null) { instance.InternalThumbSize = newValue as Size; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalThumbSizeProperty(BindableObject bindable) { var instance = (Slider)bindable; return instance.InternalThumbSize; - }); + } /// /// ThumbImageURLProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty ThumbImageURLProperty = BindableProperty.Create(nameof(ThumbImageURL), typeof(string), typeof(Slider), default(string), propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty ThumbImageURLProperty = null; + internal static void SetInternalThumbImageURLProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Slider)bindable; if (newValue != null) { instance.InternalThumbImageURL = newValue as string; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalThumbImageURLProperty(BindableObject bindable) { var instance = (Slider)bindable; return instance.InternalThumbImageURL; - }); + } /// /// ThumbImageURLSelectorProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty ThumbImageURLSelectorProperty = BindableProperty.Create(nameof(ThumbImageURLSelector), typeof(StringSelector), typeof(Slider), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty ThumbImageURLSelectorProperty = null; + internal static void SetInternalThumbImageURLSelectorProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Slider)bindable; instance.InternalThumbImageURLSelector = newValue as StringSelector; - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalThumbImageURLSelectorProperty(BindableObject bindable) { var instance = (Slider)bindable; return instance.InternalThumbImageURLSelector; - }); + } /// /// ThumbImageUrlProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty ThumbImageUrlProperty = BindableProperty.Create(nameof(ThumbImageUrl), typeof(Selector), typeof(Slider), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty ThumbImageUrlProperty = null; + internal static void SetInternalThumbImageUrlProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Slider)bindable; if (newValue != null) { instance.InternalThumbImageUrl = newValue as Tizen.NUI.BaseComponents.Selector; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalThumbImageUrlProperty(BindableObject bindable) { var instance = (Slider)bindable; return instance.InternalThumbImageUrl; - }); + } /// /// ThumbColorProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty ThumbColorProperty = BindableProperty.Create(nameof(ThumbColor), typeof(Color), typeof(Slider), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty ThumbColorProperty = null; + internal static void SetInternalThumbColorProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Slider)bindable; if (newValue != null) { instance.InternalThumbColor = newValue as Color; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalThumbColorProperty(BindableObject bindable) { var instance = (Slider)bindable; return instance.InternalThumbColor; - }); + } /// /// BgTrackColorProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty BgTrackColorProperty = BindableProperty.Create(nameof(BgTrackColor), typeof(Color), typeof(Slider), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty BgTrackColorProperty = null; + internal static void SetInternalBgTrackColorProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Slider)bindable; if (newValue != null) { instance.InternalBgTrackColor = newValue as Color; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalBgTrackColorProperty(BindableObject bindable) { var instance = (Slider)bindable; return instance.InternalBgTrackColor; - }); + } /// /// SlidedTrackColorProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty SlidedTrackColorProperty = BindableProperty.Create(nameof(SlidedTrackColor), typeof(Color), typeof(Slider), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty SlidedTrackColorProperty = null; + internal static void SetInternalSlidedTrackColorProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Slider)bindable; if (newValue != null) { instance.InternalSlidedTrackColor = newValue as Color; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalSlidedTrackColorProperty(BindableObject bindable) { var instance = (Slider)bindable; return instance.InternalSlidedTrackColor; - }); + } /// /// WarningStartValueProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty WarningStartValueProperty = BindableProperty.Create(nameof(WarningStartValue), typeof(float), typeof(Slider), default(float), propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty WarningStartValueProperty = null; + internal static void SetInternalWarningStartValueProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Slider)bindable; if (newValue != null) { instance.InternalWarningStartValue = (float)newValue; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalWarningStartValueProperty(BindableObject bindable) { var instance = (Slider)bindable; return instance.InternalWarningStartValue; - }); + } /// /// WarningTrackColorProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty WarningTrackColorProperty = BindableProperty.Create(nameof(WarningTrackColor), typeof(Color), typeof(Slider), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty WarningTrackColorProperty = null; + internal static void SetInternalWarningTrackColorProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Slider)bindable; if (newValue != null) { instance.InternalWarningTrackColor = newValue as Color; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalWarningTrackColorProperty(BindableObject bindable) { var instance = (Slider)bindable; return instance.InternalWarningTrackColor; - }); + } /// /// WarningSlidedTrackColorProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty WarningSlidedTrackColorProperty = BindableProperty.Create(nameof(WarningSlidedTrackColor), typeof(Color), typeof(Slider), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty WarningSlidedTrackColorProperty = null; + internal static void SetInternalWarningSlidedTrackColorProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Slider)bindable; if (newValue != null) { instance.InternalWarningSlidedTrackColor = newValue as Color; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalWarningSlidedTrackColorProperty(BindableObject bindable) { var instance = (Slider)bindable; return instance.InternalWarningSlidedTrackColor; - }); + } /// /// WarningThumbImageUrlProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty WarningThumbImageUrlProperty = BindableProperty.Create(nameof(WarningThumbImageUrl), typeof(Tizen.NUI.BaseComponents.Selector), typeof(Slider), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty WarningThumbImageUrlProperty = null; + internal static void SetInternalWarningThumbImageUrlProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Slider)bindable; if (newValue != null) { instance.InternalWarningThumbImageUrl = newValue as Tizen.NUI.BaseComponents.Selector; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalWarningThumbImageUrlProperty(BindableObject bindable) { var instance = (Slider)bindable; return instance.InternalWarningThumbImageUrl; - }); + } /// /// WarningThumbColorProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty WarningThumbColorProperty = BindableProperty.Create(nameof(WarningThumbColor), typeof(Color), typeof(Slider), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty WarningThumbColorProperty = null; + internal static void SetInternalWarningThumbColorProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Slider)bindable; if (newValue != null) { instance.InternalWarningThumbColor = newValue as Color; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalWarningThumbColorProperty(BindableObject bindable) { var instance = (Slider)bindable; return instance.InternalWarningThumbColor; - }); + } /// /// LowIndicatorImageURLProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty LowIndicatorImageURLProperty = BindableProperty.Create(nameof(LowIndicatorImageURL), typeof(string), typeof(Slider), default(string), propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty LowIndicatorImageURLProperty = null; + internal static void SetInternalLowIndicatorImageURLProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Slider)bindable; if (newValue != null) { instance.InternalLowIndicatorImageURL = newValue as string; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalLowIndicatorImageURLProperty(BindableObject bindable) { var instance = (Slider)bindable; return instance.InternalLowIndicatorImageURL; - }); + } /// /// HighIndicatorImageURLProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty HighIndicatorImageURLProperty = BindableProperty.Create(nameof(HighIndicatorImageURL), typeof(string), typeof(Slider), default(string), propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty HighIndicatorImageURLProperty = null; + internal static void SetInternalHighIndicatorImageURLProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Slider)bindable; if (newValue != null) { instance.InternalHighIndicatorImageURL = newValue as string; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalHighIndicatorImageURLProperty(BindableObject bindable) { var instance = (Slider)bindable; return instance.InternalHighIndicatorImageURL; - }); + } /// /// LowIndicatorTextContentProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty LowIndicatorTextContentProperty = BindableProperty.Create(nameof(LowIndicatorTextContent), typeof(string), typeof(Slider), default(string), propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty LowIndicatorTextContentProperty = null; + internal static void SetInternalLowIndicatorTextContentProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Slider)bindable; if (newValue != null) { instance.InternalLowIndicatorTextContent = newValue as string; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalLowIndicatorTextContentProperty(BindableObject bindable) { var instance = (Slider)bindable; return instance.InternalLowIndicatorTextContent; - }); + } /// /// HighIndicatorTextContentProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty HighIndicatorTextContentProperty = BindableProperty.Create(nameof(HighIndicatorTextContent), typeof(string), typeof(Slider), default(string), propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty HighIndicatorTextContentProperty = null; + internal static void SetInternalHighIndicatorTextContentProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Slider)bindable; if (newValue != null) { instance.InternalHighIndicatorTextContent = newValue as string; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalHighIndicatorTextContentProperty(BindableObject bindable) { var instance = (Slider)bindable; return instance.InternalHighIndicatorTextContent; - }); + } /// /// LowIndicatorSizeProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty LowIndicatorSizeProperty = BindableProperty.Create(nameof(LowIndicatorSize), typeof(Size), typeof(Slider), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty LowIndicatorSizeProperty = null; + internal static void SetInternalLowIndicatorSizeProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Slider)bindable; if (newValue as Size is var nVal && nVal != null) { instance.InternalLowIndicatorSize = nVal; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalLowIndicatorSizeProperty(BindableObject bindable) { var instance = (Slider)bindable; return instance.InternalLowIndicatorSize; - }); + } /// /// HighIndicatorSizeProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty HighIndicatorSizeProperty = BindableProperty.Create(nameof(HighIndicatorSize), typeof(Size), typeof(Slider), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty HighIndicatorSizeProperty = null; + internal static void SetInternalHighIndicatorSizeProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Slider)bindable; if (newValue as Size is var nVal && nVal != null) { instance.InternalHighIndicatorSize = nVal; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalHighIndicatorSizeProperty(BindableObject bindable) { var instance = (Slider)bindable; return instance.InternalHighIndicatorSize; - }); + } /// /// ValueIndicatorSizeProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty ValueIndicatorSizeProperty = BindableProperty.Create(nameof(ValueIndicatorSize), typeof(Size), typeof(Slider), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty ValueIndicatorSizeProperty = null; + internal static void SetInternalValueIndicatorSizeProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Slider)bindable; if (newValue as Size is var nVal && nVal != null) { instance.InternalValueIndicatorSize = nVal; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalValueIndicatorSizeProperty(BindableObject bindable) { var instance = (Slider)bindable; return instance.InternalValueIndicatorSize; - }); + } /// /// ValueIndicatorUrlProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty ValueIndicatorUrlProperty = BindableProperty.Create(nameof(ValueIndicatorUrl), typeof(string), typeof(Slider), default(string), propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty ValueIndicatorUrlProperty = null; + internal static void SetInternalValueIndicatorUrlProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Slider)bindable; if (newValue != null) { instance.InternalValueIndicatorUrl = newValue as string; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalValueIndicatorUrlProperty(BindableObject bindable) { var instance = (Slider)bindable; return instance.InternalValueIndicatorUrl; - }); + } /// /// IsDiscreteProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty IsDiscreteProperty = BindableProperty.Create(nameof(IsDiscrete), typeof(bool), typeof(Slider), default(bool), propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty IsDiscreteProperty = null; + internal static void SetInternalIsDiscreteProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Slider)bindable; if (newValue != null) { instance.InternalIsDiscrete = (bool)newValue; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalIsDiscreteProperty(BindableObject bindable) { var instance = (Slider)bindable; return instance.InternalIsDiscrete; - }); + } /// /// DiscreteValueProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty DiscreteValueProperty = BindableProperty.Create(nameof(DiscreteValue), typeof(float), typeof(Slider), default(float), propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty DiscreteValueProperty = null; + internal static void SetInternalDiscreteValueProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Slider)bindable; if (newValue != null) { instance.InternalDiscreteValue = (float)newValue; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalDiscreteValueProperty(BindableObject bindable) { var instance = (Slider)bindable; return instance.InternalDiscreteValue; - }); - + } } } diff --git a/src/Tizen.NUI.Components/Controls/Switch.cs b/src/Tizen.NUI.Components/Controls/Switch.cs index df04c7804d4..dc9c66ed430 100755 --- a/src/Tizen.NUI.Components/Controls/Switch.cs +++ b/src/Tizen.NUI.Components/Controls/Switch.cs @@ -18,6 +18,7 @@ using System.ComponentModel; using System.Diagnostics; using Tizen.NUI.BaseComponents; +using Tizen.NUI.Binding; using Tizen.NUI.Components.Extension; namespace Tizen.NUI.Components @@ -31,7 +32,20 @@ public partial class Switch : Button { private ImageView thumb = null; - static Switch() { } + static Switch() + { + if (NUIApplication.IsUsingXaml) + { + SwitchBackgroundImageURLSelectorProperty = BindableProperty.Create(nameof(SwitchBackgroundImageURLSelector), typeof(StringSelector), typeof(Switch), null, + propertyChanged: SetInternalSwitchBackgroundImageURLSelectorProperty, defaultValueCreator: GetInternalSwitchBackgroundImageURLSelectorProperty); + SwitchHandlerImageURLProperty = BindableProperty.Create(nameof(SwitchHandlerImageURL), typeof(string), typeof(Switch), default(string), + propertyChanged: SetInternalSwitchHandlerImageURLProperty, defaultValueCreator: GetInternalSwitchHandlerImageURLProperty); + SwitchHandlerImageURLSelectorProperty = BindableProperty.Create(nameof(SwitchHandlerImageURLSelector), typeof(StringSelector), typeof(Switch), null, + propertyChanged: SetInternalSwitchHandlerImageURLSelectorProperty, defaultValueCreator: GetInternalSwitchHandlerImageURLSelectorProperty); + SwitchHandlerImageSizeProperty = BindableProperty.Create(nameof(SwitchHandlerImageSize), typeof(Size), typeof(Switch), null, + propertyChanged: SetInternalSwitchHandlerImageSizeProperty, defaultValueCreator: GetInternalSwitchHandlerImageSizeProperty); + } + } /// /// Creates a new instance of a Switch. @@ -192,11 +206,25 @@ public StringSelector SwitchBackgroundImageURLSelector { get { - return GetValue(SwitchBackgroundImageURLSelectorProperty) as StringSelector; + if (NUIApplication.IsUsingXaml) + { + return GetValue(SwitchBackgroundImageURLSelectorProperty) as StringSelector; + } + else + { + return GetInternalSwitchBackgroundImageURLSelectorProperty(this) as StringSelector; + } } set { - SetValue(SwitchBackgroundImageURLSelectorProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(SwitchBackgroundImageURLSelectorProperty, value); + } + else + { + SetInternalSwitchBackgroundImageURLSelectorProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -226,11 +254,25 @@ public string SwitchHandlerImageURL { get { - return GetValue(SwitchHandlerImageURLProperty) as string; + if (NUIApplication.IsUsingXaml) + { + return GetValue(SwitchHandlerImageURLProperty) as string; + } + else + { + return GetInternalSwitchHandlerImageURLProperty(this) as string; + } } set { - SetValue(SwitchHandlerImageURLProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(SwitchHandlerImageURLProperty, value); + } + else + { + SetInternalSwitchHandlerImageURLProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -255,11 +297,25 @@ public StringSelector SwitchHandlerImageURLSelector { get { - return GetValue(SwitchHandlerImageURLSelectorProperty) as StringSelector; + if (NUIApplication.IsUsingXaml) + { + return GetValue(SwitchHandlerImageURLSelectorProperty) as StringSelector; + } + else + { + return GetInternalSwitchHandlerImageURLSelectorProperty(this) as StringSelector; + } } set { - SetValue(SwitchHandlerImageURLSelectorProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(SwitchHandlerImageURLSelectorProperty, value); + } + else + { + SetInternalSwitchHandlerImageURLSelectorProperty(this, null, value); + } NotifyPropertyChanged(); } } @@ -289,11 +345,25 @@ public Size SwitchHandlerImageSize { get { - return GetValue(SwitchHandlerImageSizeProperty) as Size; + if (NUIApplication.IsUsingXaml) + { + return GetValue(SwitchHandlerImageSizeProperty) as Size; + } + else + { + return GetInternalSwitchHandlerImageSizeProperty(this) as Size; + } } set { - SetValue(SwitchHandlerImageSizeProperty, value); + if (NUIApplication.IsUsingXaml) + { + SetValue(SwitchHandlerImageSizeProperty, value); + } + else + { + SetInternalSwitchHandlerImageSizeProperty(this, null, value); + } NotifyPropertyChanged(); } } diff --git a/src/Tizen.NUI.Components/Controls/SwitchBindableProperty.cs b/src/Tizen.NUI.Components/Controls/SwitchBindableProperty.cs index 094e807d03e..6610566cd7b 100755 --- a/src/Tizen.NUI.Components/Controls/SwitchBindableProperty.cs +++ b/src/Tizen.NUI.Components/Controls/SwitchBindableProperty.cs @@ -9,73 +9,76 @@ public partial class Switch /// SwitchBackgroundImageURLSelectorProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty SwitchBackgroundImageURLSelectorProperty = BindableProperty.Create(nameof(SwitchBackgroundImageURLSelector), typeof(StringSelector), typeof(Switch), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty SwitchBackgroundImageURLSelectorProperty = null; + internal static void SetInternalSwitchBackgroundImageURLSelectorProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Switch)bindable; if (newValue != null) { instance.InternalSwitchBackgroundImageURLSelector = newValue as StringSelector; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalSwitchBackgroundImageURLSelectorProperty(BindableObject bindable) { var instance = (Switch)bindable; return instance.InternalSwitchBackgroundImageURLSelector; - }); + } /// /// SwitchHandlerImageURLProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty SwitchHandlerImageURLProperty = BindableProperty.Create(nameof(SwitchHandlerImageURL), typeof(string), typeof(Switch), default(string), propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty SwitchHandlerImageURLProperty = null; + internal static void SetInternalSwitchHandlerImageURLProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Switch)bindable; if (newValue != null) { instance.InternalSwitchHandlerImageURL = newValue as string; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalSwitchHandlerImageURLProperty(BindableObject bindable) { var instance = (Switch)bindable; return instance.InternalSwitchHandlerImageURL; - }); + } /// /// SwitchHandlerImageURLSelectorProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty SwitchHandlerImageURLSelectorProperty = BindableProperty.Create(nameof(SwitchHandlerImageURLSelector), typeof(StringSelector), typeof(Switch), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty SwitchHandlerImageURLSelectorProperty = null; + internal static void SetInternalSwitchHandlerImageURLSelectorProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Switch)bindable; if (newValue != null) { instance.InternalSwitchHandlerImageURLSelector = newValue as StringSelector; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalSwitchHandlerImageURLSelectorProperty(BindableObject bindable) { var instance = (Switch)bindable; return instance.InternalSwitchHandlerImageURLSelector; - }); + } /// /// SwitchHandlerImageSizeProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty SwitchHandlerImageSizeProperty = BindableProperty.Create(nameof(SwitchHandlerImageSize), typeof(Size), typeof(Switch), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty SwitchHandlerImageSizeProperty = null; + internal static void SetInternalSwitchHandlerImageSizeProperty(BindableObject bindable, object oldValue, object newValue) { var instance = (Switch)bindable; if (newValue != null) { instance.InternalSwitchHandlerImageSize = newValue as Size; } - }, - defaultValueCreator: (bindable) => + } + internal static object GetInternalSwitchHandlerImageSizeProperty(BindableObject bindable) { var instance = (Switch)bindable; return instance.InternalSwitchHandlerImageSize; - }); - + } } }