2 * Copyright(c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using Tizen.NUI.BaseComponents;
19 using System.ComponentModel;
20 using Tizen.NUI.Binding;
22 namespace Tizen.NUI.Components
25 /// Slider value changed event data.
27 /// <since_tizen> 8 </since_tizen>
28 public class SliderValueChangedEventArgs : EventArgs
31 /// Current Slider value
33 /// <since_tizen> 8 </since_tizen>
34 public float CurrentValue { get; set; }
38 /// Slider sliding started event data.
40 /// <since_tizen> 8 </since_tizen>
41 public class SliderSlidingStartedEventArgs : EventArgs
44 /// Current Slider value
46 /// <since_tizen> 8 </since_tizen>
47 public float CurrentValue { get; set; }
51 /// Slider sliding finished event data.
53 /// <since_tizen> 8 </since_tizen>
54 public class SliderSlidingFinishedEventArgs : EventArgs
57 /// Current Slider value
59 /// <since_tizen> 8 </since_tizen>
60 public float CurrentValue { get; set; }
64 /// A slider lets users select a value from a continuous or discrete range of values by moving the slider thumb.
66 /// <since_tizen> 6 </since_tizen>
67 public partial class Slider : Control
69 [EditorBrowsable(EditorBrowsableState.Never)]
70 public static readonly BindableProperty IndicatorTypeProperty = BindableProperty.Create("IndicatorType", typeof(IndicatorType), typeof(Slider), IndicatorType.None, propertyChanged: (bindable, oldValue, newValue) =>
72 var instance = (Slider)bindable;
75 instance.privateIndicatorType = (IndicatorType)newValue;
78 defaultValueCreator: (bindable) =>
80 var instance = (Slider)bindable;
81 return instance.privateIndicatorType;
83 [EditorBrowsable(EditorBrowsableState.Never)]
84 public static readonly BindableProperty SpaceBetweenTrackAndIndicatorProperty = BindableProperty.Create(nameof(SpaceBetweenTrackAndIndicator), typeof(uint), typeof(Slider), (uint)0, propertyChanged: (bindable, oldValue, newValue) =>
86 var instance = (Slider)bindable;
89 instance.privateSpaceBetweenTrackAndIndicator = (uint)newValue;
92 defaultValueCreator: (bindable) =>
94 var instance = (Slider)bindable;
95 return instance.privateSpaceBetweenTrackAndIndicator;
97 [EditorBrowsable(EditorBrowsableState.Never)]
98 public static readonly BindableProperty TrackThicknessProperty = BindableProperty.Create(nameof(TrackThickness), typeof(uint), typeof(Slider), (uint)0, propertyChanged: (bindable, oldValue, newValue) =>
100 var instance = (Slider)bindable;
101 if (newValue != null)
103 instance.privateTrackThickness = (uint)newValue;
106 defaultValueCreator: (bindable) =>
108 var instance = (Slider)bindable;
109 return instance.privateTrackThickness;
111 [EditorBrowsable(EditorBrowsableState.Never)]
112 public static readonly BindableProperty IsValueShownProperty = BindableProperty.Create(nameof(IsValueShown), typeof(bool), typeof(Slider), true, propertyChanged: (bindable, oldValue, newValue) =>
114 var instance = (Slider)bindable;
115 if (newValue != null)
117 bool newValueShown = (bool)newValue;
118 if (instance.isValueShown != newValueShown)
120 instance.isValueShown = newValueShown;
124 defaultValueCreator: (bindable) =>
126 var instance = (Slider)bindable;
127 return instance.isValueShown;
129 [EditorBrowsable(EditorBrowsableState.Never)]
130 public static readonly BindableProperty ValueIndicatorTextProperty = BindableProperty.Create(nameof(ValueIndicatorText), typeof(string), typeof(Slider), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
132 var instance = (Slider)bindable;
133 if (newValue != null)
135 string newText = (string)newValue;
136 instance.valueIndicatorText.Text = newText;
137 if (instance.sliderStyle != null)
139 instance.sliderStyle.ValueIndicatorText.Text = newText;
143 defaultValueCreator: (bindable) =>
145 var instance = (Slider)bindable;
146 return instance.valueIndicatorText.Text;
152 /// The constructor of the Slider class.
154 /// <since_tizen> 6 </since_tizen>
161 /// The constructor of the Slider class with specific style.
163 /// <param name="style">The string to initialize the Slider</param>
164 /// <since_tizen> 8 </since_tizen>
165 public Slider(string style) : base(style)
171 /// The constructor of the Slider class with specific style.
173 /// <param name="sliderStyle">The style object to initialize the Slider</param>
174 /// <since_tizen> 8 </since_tizen>
175 public Slider(SliderStyle sliderStyle) : base(sliderStyle)
181 /// The value changed event handler.
183 /// <since_tizen> 6 </since_tizen>
184 [Obsolete("Deprecated in API8; Will be removed in API10. Please use ValueChanged event instead.")]
185 public event EventHandler<ValueChangedArgs> ValueChangedEvent
189 valueChangedHandler += value;
193 valueChangedHandler -= value;
198 /// The sliding finished event handler.
200 /// <since_tizen> 6 </since_tizen>
201 [Obsolete("Deprecated in API8; Will be removed in API10. Please use SlidingFinished event instead.")]
202 public event EventHandler<SlidingFinishedArgs> SlidingFinishedEvent
206 slidingFinishedHandler += value;
210 slidingFinishedHandler -= value;
215 /// The value changed event handler.
217 /// <since_tizen> 8 </since_tizen>
218 public event EventHandler<SliderValueChangedEventArgs> ValueChanged
222 sliderValueChangedHandler += value;
226 sliderValueChangedHandler -= value;
231 /// The sliding started event handler.
233 /// <since_tizen> 8 </since_tizen>
234 public event EventHandler<SliderSlidingStartedEventArgs> SlidingStarted
238 sliderSlidingStartedHandler += value;
242 sliderSlidingStartedHandler -= value;
247 /// The sliding finished event handler.
249 /// <since_tizen> 8 </since_tizen>
250 public event EventHandler<SliderSlidingFinishedEventArgs> SlidingFinished
254 sliderSlidingFinishedHandler += value;
258 sliderSlidingFinishedHandler -= value;
263 /// The state changed event handler.
265 /// <since_tizen> 6 </since_tizen>
266 [Obsolete("Deprecated in API8; Will be removed in API10. Please use View.ControlStateChangedEvent")]
267 public event EventHandler<StateChangedArgs> StateChangedEvent
271 stateChangedHandler += value;
275 stateChangedHandler -= value;
280 /// The direction type of slider.
282 /// <since_tizen> 6 </since_tizen>
283 public enum DirectionType
286 /// The Horizontal type.
288 /// <since_tizen> 6 </since_tizen>
292 /// The Vertical type.
294 /// <since_tizen> 6 </since_tizen>
299 /// The indicator type of slider.
301 /// <since_tizen> 6 </since_tizen>
302 public enum IndicatorType
304 /// <summary> Only contains slider bar.</summary>
305 /// <since_tizen> 6 </since_tizen>
308 /// <summary> Contains slider bar, IndicatorImage.</summary>
309 /// <since_tizen> 6 </since_tizen>
312 /// <summary> Contains slider bar, IndicatorText.</summary>
313 /// <since_tizen> 6 </since_tizen>
318 /// Return a copied Style instance of Slider
321 /// It returns copied Style instance and changing it does not effect to the Slider.
322 /// Style setting is possible by using constructor or the function of ApplyStyle(ViewStyle viewStyle)
324 /// <since_tizen> 8 </since_tizen>
325 public new SliderStyle Style
329 var result = new SliderStyle(sliderStyle);
330 result.CopyPropertiesFromView(this);
331 result.Track.CopyPropertiesFromView(bgTrackImage);
332 result.Progress.CopyPropertiesFromView(slidedTrackImage);
333 result.Thumb.CopyPropertiesFromView(thumbImage);
334 result.LowIndicatorImage.CopyPropertiesFromView(lowIndicatorImage);
335 result.HighIndicatorImage.CopyPropertiesFromView(highIndicatorImage);
336 result.LowIndicator.CopyPropertiesFromView(lowIndicatorText);
337 result.HighIndicator.CopyPropertiesFromView(highIndicatorText);
338 result.ValueIndicatorText.CopyPropertiesFromView(valueIndicatorText);
339 result.ValueIndicatorImage.CopyPropertiesFromView(valueIndicatorImage);
345 /// Return a copied Style instance of Slider
347 private SliderStyle sliderStyle => ViewStyle as SliderStyle;
350 /// Gets or sets the direction type of slider.
352 /// <since_tizen> 6 </since_tizen>
353 public DirectionType Direction
361 if (direction == value)
366 RelayoutBaseComponent(false);
368 UpdateBgTrackPosition();
374 /// Gets or sets the indicator type, arrow or sign.
376 /// <since_tizen> 6 </since_tizen>
377 public IndicatorType Indicator
381 return (IndicatorType)GetValue(IndicatorTypeProperty);
385 SetValue(IndicatorTypeProperty, value);
390 /// Gets or sets the minimum value of slider.
392 /// <since_tizen> 6 </since_tizen>
393 public float MinValue
407 /// Gets or sets the maximum value of slider.
409 /// <since_tizen> 6 </since_tizen>
410 public float MaxValue
424 /// Gets or sets the current value of slider.
426 /// <since_tizen> 6 </since_tizen>
427 public float CurrentValue
441 /// Gets or sets the size of the thumb image object.
443 /// <since_tizen> 6 </since_tizen>
444 public Size ThumbSize
448 return thumbImage?.Size;
452 if (null != thumbImage)
454 thumbImage.Size = value;
455 sliderStyle.Thumb.Size = value;
461 /// Gets or sets the resource url of the thumb image object.
463 /// <since_tizen> 6 </since_tizen>
464 public string ThumbImageURL
468 return thumbImage?.ResourceUrl;
472 if (null != thumbImage)
474 thumbImage.ResourceUrl = value;
475 sliderStyle.Thumb.ResourceUrl = value;
481 /// Gets or sets the resource url selector of the thumb image object.
482 /// Getter returns copied selector value if exist, null otherwise.
484 /// <exception cref="NullReferenceException">Thrown when setting null value.</exception>
485 /// <since_tizen> 6 </since_tizen>
486 public StringSelector ThumbImageURLSelector
488 get => thumbImage == null ? null : new StringSelector((Selector<string>)thumbImage.GetValue(ImageView.ResourceUrlSelectorProperty));
491 if (value == null || thumbImage == null)
493 throw new NullReferenceException("Slider.ThumbImageURLSelector is null");
497 thumbImage.SetValue(ImageView.ResourceUrlSelectorProperty, value);
503 /// Gets or sets the color of the thumb image object.
505 /// <since_tizen> 8 </since_tizen>
506 public Color ThumbColor
510 return thumbImage?.Color;
514 if (null != thumbImage)
516 thumbImage.Color = value;
517 sliderStyle.Thumb.Color = value;
523 /// Gets or sets the color of the background track image object.
525 /// <since_tizen> 6 </since_tizen>
526 public Color BgTrackColor
530 return bgTrackImage?.BackgroundColor;
534 if (null != bgTrackImage)
536 bgTrackImage.BackgroundColor = value;
537 sliderStyle.Track.BackgroundColor = value;
543 /// Gets or sets the color of the slided track image object.
545 /// <since_tizen> 6 </since_tizen>
546 public Color SlidedTrackColor
550 return slidedTrackImage?.BackgroundColor;
554 if (null != slidedTrackImage)
556 slidedTrackImage.BackgroundColor = value;
557 sliderStyle.Progress.BackgroundColor = value;
563 /// Gets or sets the thickness value of the track.
565 /// <since_tizen> 6 </since_tizen>
566 public uint TrackThickness
570 return (uint)GetValue(TrackThicknessProperty);
574 SetValue(TrackThicknessProperty, value);
579 /// Gets or sets the resource url of the low indicator image object.
581 /// <since_tizen> 6 </since_tizen>
582 public string LowIndicatorImageURL
586 return lowIndicatorImage?.ResourceUrl;
590 if (null == lowIndicatorImage) lowIndicatorImage = new ImageView();
591 lowIndicatorImage.ResourceUrl = value;
592 sliderStyle.LowIndicatorImage.ResourceUrl = value;
597 /// Gets or sets the resource url of the high indicator image object.
599 /// <since_tizen> 6 </since_tizen>
600 public string HighIndicatorImageURL
604 return highIndicatorImage?.ResourceUrl;
608 if (null == highIndicatorImage) highIndicatorImage = new ImageView();
609 highIndicatorImage.ResourceUrl = value;
610 sliderStyle.HighIndicatorImage.ResourceUrl = value;
615 /// Gets or sets the text content of the low indicator text object.
617 /// <since_tizen> 6 </since_tizen>
618 public string LowIndicatorTextContent
622 return lowIndicatorText?.Text;
626 if (null != lowIndicatorText)
628 lowIndicatorText.Text = value;
629 sliderStyle.LowIndicator.Text = value;
635 /// Gets or sets the text content of the high indicator text object.
637 /// <since_tizen> 6 </since_tizen>
638 public string HighIndicatorTextContent
642 return highIndicatorText?.Text;
646 if (null != highIndicatorText)
648 highIndicatorText.Text = value;
649 sliderStyle.HighIndicator.Text = value;
655 /// Gets or sets the size of the low indicator object(image or text).
657 /// <since_tizen> 6 </since_tizen>
658 public Size LowIndicatorSize
662 return lowIndicatorSize;
666 lowIndicatorSize = value;
667 UpdateLowIndicatorSize();
669 UpdateBgTrackPosition();
675 /// Gets or sets the size of the high indicator object(image or text).
677 /// <since_tizen> 6 </since_tizen>
678 public Size HighIndicatorSize
682 return highIndicatorText?.Size;
686 if (null != highIndicatorText)
688 highIndicatorText.Size = value;
689 sliderStyle.HighIndicator.Size = value;
695 /// Gets or sets the value of the space between track and indicator.
697 /// <since_tizen> 6 </since_tizen>
698 public uint SpaceBetweenTrackAndIndicator
702 return (uint)GetValue(SpaceBetweenTrackAndIndicatorProperty);
706 SetValue(SpaceBetweenTrackAndIndicatorProperty, value);
711 /// Flag to decide whether the value indicator is shown
713 /// This will be public opened later after ACR done. Before ACR, need to be hidden as inhouse API.
714 [EditorBrowsable(EditorBrowsableState.Never)]
715 public bool IsValueShown
719 return (bool)GetValue(IsValueShownProperty);
723 SetValue(IsValueShownProperty, value);
728 /// Gets or sets the text of value indicator.
730 /// This will be public opened later after ACR done. Before ACR, need to be hidden as inhouse API.
731 [EditorBrowsable(EditorBrowsableState.Never)]
732 public string ValueIndicatorText
736 return (string)GetValue(ValueIndicatorTextProperty);
740 SetValue(ValueIndicatorTextProperty, value);
745 /// Gets or sets the size of the value indicator image object.
747 /// This will be public opened later after ACR done. Before ACR, need to be hidden as inhouse API.
748 [EditorBrowsable(EditorBrowsableState.Never)]
749 public Size ValueIndicatorSize
753 return valueIndicatorImage?.Size;
757 if (null != valueIndicatorImage)
759 valueIndicatorImage.Size = value;
760 sliderStyle.ValueIndicatorImage.Size = value;
766 /// Gets or sets the resource url of the value indicator image object.
768 /// This will be public opened later after ACR done. Before ACR, need to be hidden as inhouse API.
769 [EditorBrowsable(EditorBrowsableState.Never)]
770 public string ValueIndicatorUrl
774 return valueIndicatorImage?.ResourceUrl;
778 if (null != valueIndicatorImage)
780 valueIndicatorImage.ResourceUrl = value;
781 sliderStyle.ValueIndicatorImage.ResourceUrl = value;
786 private Extents spaceBetweenTrackAndIndicator
790 if (null == _spaceBetweenTrackAndIndicator)
792 _spaceBetweenTrackAndIndicator = new Extents((ushort start, ushort end, ushort top, ushort bottom) =>
794 Extents extents = new Extents(start, end, top, bottom);
795 _spaceBetweenTrackAndIndicator.CopyFrom(extents);
799 return _spaceBetweenTrackAndIndicator;
803 private IndicatorType privateIndicatorType
807 return indicatorType;
811 if (indicatorType == value)
815 indicatorType = value;
816 RelayoutBaseComponent(false);
818 UpdateBgTrackPosition();
823 private uint privateTrackThickness
827 return trackThickness ?? 0;
831 trackThickness = value;
832 if (bgTrackImage != null)
834 if (direction == DirectionType.Horizontal)
836 bgTrackImage.SizeHeight = (float)trackThickness.Value;
838 else if (direction == DirectionType.Vertical)
840 bgTrackImage.SizeWidth = (float)trackThickness.Value;
843 if (slidedTrackImage != null)
845 if (direction == DirectionType.Horizontal)
847 slidedTrackImage.SizeHeight = (float)trackThickness.Value;
849 else if (direction == DirectionType.Vertical)
851 slidedTrackImage.SizeWidth = (float)trackThickness.Value;
857 private uint privateSpaceBetweenTrackAndIndicator
861 return privateTrackPadding.Start;
865 ushort val = (ushort)value;
866 privateTrackPadding = new Extents(val, val, val, val);
870 private Extents privateTrackPadding
874 return spaceBetweenTrackAndIndicator;
878 spaceBetweenTrackAndIndicator.CopyFrom(value);
879 UpdateComponentByIndicatorTypeChanged();
881 UpdateBgTrackPosition();
887 /// Focus gained callback.
889 /// <since_tizen> 8 </since_tizen>
890 public override void OnFocusGained()
892 //State = ControlStates.Focused;
893 UpdateState(true, isPressed);
894 base.OnFocusGained();
898 /// Focus Lost callback.
900 /// <since_tizen> 8 </since_tizen>
901 public override void OnFocusLost()
903 //State = ControlStates.Normal;
904 UpdateState(false, isPressed);
909 /// Apply style to scrollbar.
911 /// <param name="viewStyle">The style to apply.</param>
912 /// <since_tizen> 8 </since_tizen>
913 public override void ApplyStyle(ViewStyle viewStyle)
915 base.ApplyStyle(viewStyle);
917 SliderStyle sliderStyle = viewStyle as SliderStyle;
919 if (null != sliderStyle?.Progress)
921 CreateSlidedTrack().ApplyStyle(sliderStyle.Progress);
924 if (null != sliderStyle?.LowIndicator)
926 CreateLowIndicatorText().ApplyStyle(sliderStyle.LowIndicator);
929 if (null != sliderStyle?.HighIndicator)
931 CreateHighIndicatorText().ApplyStyle(sliderStyle.HighIndicator);
934 if (null != sliderStyle?.Track)
936 CreateBackgroundTrack().ApplyStyle(sliderStyle.Track);
939 if (null != sliderStyle?.Thumb)
941 CreateThumb().ApplyStyle(sliderStyle.Thumb);
944 if (null != sliderStyle?.ValueIndicatorText)
946 CreateValueIndicatorText().ApplyStyle(sliderStyle.ValueIndicatorText);
949 if (null != sliderStyle?.ValueIndicatorImage)
951 CreateValueIndicator().ApplyStyle(sliderStyle.ValueIndicatorImage);
954 EnableControlStatePropagation = true;
958 /// Get Slider style.
960 /// <returns>The default slider style.</returns>
961 /// <since_tizen> 8 </since_tizen>
962 protected override ViewStyle CreateViewStyle()
964 return new SliderStyle();
970 /// <param name="type">Dispose type.</param>
971 /// <since_tizen> 6 </since_tizen>
972 protected override void Dispose(DisposeTypes type)
979 if (type == DisposeTypes.Explicit)
981 if (null != panGestureDetector)
983 panGestureDetector.Detach(this);
984 panGestureDetector.Detected -= OnPanGestureDetected;
985 panGestureDetector.Dispose();
986 panGestureDetector = null;
989 if (null != thumbImage)
991 thumbImage.TouchEvent -= OnTouchEventForThumb;
992 Utility.Dispose(thumbImage);
994 Utility.Dispose(slidedTrackImage);
995 if (null != bgTrackImage)
997 bgTrackImage.TouchEvent -= OnTouchEventForBgTrack;
998 Utility.Dispose(bgTrackImage);
1000 Utility.Dispose(lowIndicatorImage);
1001 Utility.Dispose(highIndicatorImage);
1002 Utility.Dispose(lowIndicatorText);
1003 Utility.Dispose(highIndicatorText);
1004 Utility.Dispose(valueIndicatorImage);
1005 Utility.Dispose(valueIndicatorText);
1012 /// Update Slider by style.
1014 /// <since_tizen> 6 </since_tizen>
1015 /// This will be public opened later after ACR done. Before ACR, need to be hidden as inhouse API.
1016 [EditorBrowsable(EditorBrowsableState.Never)]
1017 protected override void OnUpdate()
1019 RelayoutBaseComponent();
1021 UpdateComponentByIndicatorTypeChanged();
1022 UpdateBgTrackSize();
1023 UpdateBgTrackPosition();
1024 UpdateLowIndicatorSize();
1028 private void CalculateCurrentValueByGesture(float offset)
1030 currentSlidedOffset += offset;
1032 if (currentSlidedOffset <= 0)
1034 curValue = minValue;
1036 else if (currentSlidedOffset >= BgTrackLength())
1038 curValue = maxValue;
1042 int bgTrackLength = BgTrackLength();
1043 if (bgTrackLength != 0)
1045 curValue = ((currentSlidedOffset / (float)bgTrackLength) * (float)(maxValue - minValue)) + minValue;
1048 if (valueChangedHandler != null)
1050 ValueChangedArgs args = new ValueChangedArgs();
1051 args.CurrentValue = curValue;
1052 valueChangedHandler(this, args);
1055 if (sliderValueChangedHandler != null)
1057 SliderValueChangedEventArgs args = new SliderValueChangedEventArgs();
1058 args.CurrentValue = curValue;
1059 sliderValueChangedHandler(this, args);
1063 private bool OnTouchEventForBgTrack(object source, TouchEventArgs e)
1065 PointStateType state = e.Touch.GetState(0);
1066 if (state == PointStateType.Down)
1070 valueIndicatorImage.Show();
1073 Vector2 pos = e.Touch.GetLocalPosition(0);
1074 CalculateCurrentValueByTouch(pos);
1076 if (null != slidingFinishedHandler)
1078 SlidingFinishedArgs args = new SlidingFinishedArgs();
1079 args.CurrentValue = curValue;
1080 slidingFinishedHandler(this, args);
1083 if (null != sliderSlidingFinishedHandler)
1085 SliderSlidingFinishedEventArgs args = new SliderSlidingFinishedEventArgs();
1086 args.CurrentValue = curValue;
1087 sliderSlidingFinishedHandler(this, args);
1090 else if (state == PointStateType.Up)
1094 valueIndicatorImage.Hide();
1100 private bool OnTouchEventForThumb(object source, TouchEventArgs e)
1102 PointStateType state = e.Touch.GetState(0);
1103 if (state == PointStateType.Down)
1105 UpdateState(isFocused, true);
1107 else if (state == PointStateType.Up)
1109 UpdateState(isFocused, false);
1114 private void CalculateCurrentValueByTouch(Vector2 pos)
1116 int bgTrackLength = BgTrackLength();
1117 if (direction == DirectionType.Horizontal)
1119 currentSlidedOffset = pos.X;
1121 else if (direction == DirectionType.Vertical)
1123 currentSlidedOffset = bgTrackLength - pos.Y;
1126 if (bgTrackLength != 0)
1128 curValue = ((currentSlidedOffset / (float)bgTrackLength) * (maxValue - minValue)) + minValue;
1129 if (null != valueChangedHandler)
1131 ValueChangedArgs args = new ValueChangedArgs();
1132 args.CurrentValue = curValue;
1133 valueChangedHandler(this, args);
1136 if (null != sliderValueChangedHandler)
1138 SliderValueChangedEventArgs args = new SliderValueChangedEventArgs();
1139 args.CurrentValue = curValue;
1140 sliderValueChangedHandler(this, args);
1145 private void UpdateState(bool isFocusedNew, bool isPressedNew)
1147 if (isFocused == isFocusedNew && isPressed == isPressedNew)
1151 if (thumbImage == null || Style == null)
1155 isFocused = isFocusedNew;
1156 isPressed = isPressedNew;
1158 if (!isFocused && !isPressed)
1160 ControlState = ControlState.Normal;
1161 if (stateChangedHandler != null)
1163 StateChangedArgs args = new StateChangedArgs();
1164 args.CurrentState = (ControlStates)ControlStates.Normal;
1165 stateChangedHandler(this, args);
1170 ControlState = ControlState.Pressed;
1172 if (stateChangedHandler != null)
1174 StateChangedArgs args = new StateChangedArgs();
1175 args.CurrentState = (ControlStates)ControlStates.Pressed;
1176 stateChangedHandler(this, args);
1179 else if (!isPressed && isFocused)
1181 ControlState = ControlState.Focused;
1183 if (stateChangedHandler != null)
1185 StateChangedArgs args = new StateChangedArgs();
1186 args.CurrentState = (ControlStates)ControlStates.Focused;
1187 stateChangedHandler(this, args);
1192 private void UpdateComponentByIndicatorTypeChanged()
1194 IndicatorType type = CurrentIndicatorType();
1195 if (type == IndicatorType.None)
1197 if (lowIndicatorImage != null)
1199 lowIndicatorImage.Hide();
1201 if (highIndicatorImage != null)
1203 highIndicatorImage.Hide();
1205 if (lowIndicatorText != null)
1207 lowIndicatorText.Hide();
1209 if (highIndicatorText != null)
1211 highIndicatorText.Hide();
1214 else if (type == IndicatorType.Image)
1216 if (lowIndicatorImage != null)
1218 lowIndicatorImage.Show();
1220 if (highIndicatorImage != null)
1222 highIndicatorImage.Show();
1224 if (lowIndicatorText != null)
1226 lowIndicatorText.Hide();
1228 if (highIndicatorText != null)
1230 highIndicatorText.Hide();
1233 else if (type == IndicatorType.Text)
1235 if (lowIndicatorText != null)
1237 lowIndicatorText.Show();
1239 if (highIndicatorText != null)
1241 highIndicatorText.Show();
1243 if (lowIndicatorImage != null)
1245 lowIndicatorImage.Hide();
1247 if (highIndicatorImage != null)
1249 highIndicatorImage.Hide();
1255 /// Value Changed event data.
1257 /// <since_tizen> 6 </since_tizen>
1258 [Obsolete("Deprecated in API8; Will be removed in API10. Please use SliderValueChangedEventArgs instead.")]
1259 [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
1260 public class ValueChangedArgs : EventArgs
1265 /// <since_tizen> 6 </since_tizen>
1266 /// It will be removed in API10
1267 [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1051:Do not declare visible instance fields")]
1268 [Obsolete("Deprecated in API8; Will be removed in API10. Please use SliderValueChangedEventArgs.CurrentValue instead.")]
1269 public float CurrentValue;
1273 /// Value Changed event data.
1275 /// <since_tizen> 6 </since_tizen>
1276 [Obsolete("Deprecated in API8; Will be removed in API10. Please use SliderSlidingFinishedEventArgs instead.")]
1277 [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
1278 public class SlidingFinishedArgs : EventArgs
1283 /// <since_tizen> 6 </since_tizen>
1284 /// It will be removed in API10
1285 [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1051:Do not declare visible instance fields")]
1286 [Obsolete("Deprecated in API8; Will be removed in API10. Please use SliderSlidingFinishedEventArgs.CurrentValue instead.")]
1287 public float CurrentValue;
1291 /// State Changed event data.
1293 /// <since_tizen> 6 </since_tizen>
1294 [Obsolete("Deprecated in API8; Will be removed in API10. Please use View.ControlStateChangedEventArgs")]
1295 [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
1296 public class StateChangedArgs : EventArgs
1301 /// <since_tizen> 6 </since_tizen>
1302 /// It will be removed in API10
1303 [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1051:Do not declare visible instance fields")]
1304 [Obsolete("Deprecated in API8; Will be removed in API10")]
1305 public ControlStates CurrentState;