2 * Copyright(c) 2022 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 System.ComponentModel;
19 using System.Diagnostics;
20 using Tizen.NUI.BaseComponents;
21 using Tizen.NUI.Binding;
22 using Tizen.NUI.Accessibility;
24 namespace Tizen.NUI.Components
27 /// ClickedEventArgs is a class to record button click event arguments which will sent to user.
29 /// <since_tizen> 8 </since_tizen>
30 public class ClickedEventArgs : EventArgs
35 /// SelectedChangedEventArgs is a class to record item selected arguments which will sent to user.
37 /// <since_tizen> 8 </since_tizen>
38 public class SelectedChangedEventArgs : EventArgs
40 /// <summary> Selected state </summary>
41 /// <since_tizen> 8 </since_tizen>
42 public bool IsSelected { get; set; }
46 /// Button is one kind of common component, a button clearly describes what action will occur when the user selects it.
47 /// Button may contain text or an icon.
49 /// <since_tizen> 6 </since_tizen>
50 public partial class Button : Control
52 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
53 [EditorBrowsable(EditorBrowsableState.Never)]
54 public static readonly BindableProperty IconRelativeOrientationProperty = BindableProperty.Create(nameof(IconRelativeOrientation), typeof(IconOrientation?), typeof(Button), null, propertyChanged: (bindable, oldValue, newValue) =>
56 var instance = (Button)bindable;
57 var newIconOrientation = (IconOrientation?)newValue;
58 if (instance.iconRelativeOrientation != newIconOrientation)
60 instance.iconRelativeOrientation = newIconOrientation;
61 instance.LayoutItems();
64 defaultValueCreator: (bindable) => ((Button)bindable).iconRelativeOrientation
67 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
68 [EditorBrowsable(EditorBrowsableState.Never)]
69 public static readonly BindableProperty IsSelectedProperty = BindableProperty.Create(nameof(IsSelected), typeof(bool), typeof(Button), false, propertyChanged: (bindable, oldValue, newValue) =>
71 var instance = (Button)bindable;
74 bool newSelected = (bool)newValue;
75 if (instance.isSelected != newSelected)
77 instance.isSelected = newSelected;
79 if (instance.isSelectable)
81 instance.UpdateState();
84 if (Accessibility.Accessibility.IsEnabled && instance.IsHighlighted)
86 instance.EmitAccessibilityStateChangedEvent(AccessibilityState.Checked, newSelected);
91 defaultValueCreator: (bindable) =>
93 var instance = (Button)bindable;
94 return instance.isSelectable && instance.isSelected;
96 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
97 [EditorBrowsable(EditorBrowsableState.Never)]
98 public static readonly BindableProperty IsSelectableProperty = BindableProperty.Create(nameof(IsSelectable), typeof(bool), typeof(Button), true, propertyChanged: (bindable, oldValue, newValue) =>
100 var instance = (Button)bindable;
101 if (newValue != null)
103 bool newSelectable = (bool)newValue;
104 if (instance.isSelectable != newSelectable)
106 instance.isSelectable = newSelectable;
107 instance.UpdateState();
111 defaultValueCreator: (bindable) => ((Button)bindable).isSelectable);
113 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
114 [EditorBrowsable(EditorBrowsableState.Never)]
115 public static readonly BindableProperty IconPaddingProperty = BindableProperty.Create(nameof(IconPadding), typeof(Extents), typeof(Button), null, propertyChanged: (bindable, oldValue, newValue) =>
117 var instance = (Button)bindable;
118 if (instance.buttonIcon == null)
122 instance.buttonIcon.Padding = (Extents)newValue;
124 defaultValueCreator: (bindable) => ((Button)bindable).buttonIcon?.Padding);
126 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
127 [EditorBrowsable(EditorBrowsableState.Never)]
128 public static readonly BindableProperty TextPaddingProperty = BindableProperty.Create(nameof(TextPadding), typeof(Extents), typeof(Button), null, propertyChanged: (bindable, oldValue, newValue) =>
130 var instance = (Button)bindable;
131 if (instance.buttonText == null)
135 instance.buttonText.Padding = (Extents)newValue;
137 defaultValueCreator: (bindable) => ((Button)bindable).buttonText?.Padding);
139 /// <summary> The bindable property of ItemAlignment. </summary>
140 [EditorBrowsable(EditorBrowsableState.Never)]
141 internal static readonly BindableProperty ItemAlignmentProperty = BindableProperty.Create(nameof(ItemAlignment), typeof(LinearLayout.Alignment), typeof(Button), LinearLayout.Alignment.Center, propertyChanged: (bindable, oldValue, newValue) =>
143 var instance = (Button)bindable;
144 var newAlignment = (LinearLayout.Alignment)newValue;
146 if (instance.itemAlignment != newAlignment)
148 instance.itemAlignment = newAlignment;
150 switch (newAlignment)
152 case LinearLayout.Alignment.Begin:
153 instance.itemHorizontalAlignment = HorizontalAlignment.Begin;
155 case LinearLayout.Alignment.End:
156 instance.itemHorizontalAlignment = HorizontalAlignment.End;
158 case LinearLayout.Alignment.CenterHorizontal:
159 instance.itemHorizontalAlignment = HorizontalAlignment.Center;
161 case LinearLayout.Alignment.Top:
162 instance.itemVerticalAlignment = VerticalAlignment.Top;
164 case LinearLayout.Alignment.Bottom:
165 instance.itemVerticalAlignment = VerticalAlignment.Bottom;
167 case LinearLayout.Alignment.CenterVertical:
168 instance.itemVerticalAlignment = VerticalAlignment.Center;
170 case LinearLayout.Alignment.Center:
171 instance.itemHorizontalAlignment = HorizontalAlignment.Center;
172 instance.itemVerticalAlignment = VerticalAlignment.Center;
178 instance.LayoutItems();
181 defaultValueCreator: (bindable) => ((Button)bindable).itemAlignment);
183 /// <summary> The bindable property of ItemHorizontalAlignment. </summary>
184 [EditorBrowsable(EditorBrowsableState.Never)]
185 internal static readonly BindableProperty ItemHorizontalAlignmentProperty = BindableProperty.Create(nameof(ItemHorizontalAlignment), typeof(HorizontalAlignment), typeof(Button), HorizontalAlignment.Center, propertyChanged: (bindable, oldValue, newValue) =>
187 var instance = (Button)bindable;
188 var newHorizontalAlignment = (HorizontalAlignment)newValue;
190 if (instance.itemHorizontalAlignment != newHorizontalAlignment)
192 instance.itemHorizontalAlignment = newHorizontalAlignment;
193 instance.LayoutItems();
196 defaultValueCreator: (bindable) => ((Button)bindable).itemHorizontalAlignment);
198 /// <summary> The bindable property of ItemVerticalAlignment. </summary>
199 [EditorBrowsable(EditorBrowsableState.Never)]
200 internal static readonly BindableProperty ItemVerticalAlignmentProperty = BindableProperty.Create(nameof(ItemVerticalAlignment), typeof(VerticalAlignment), typeof(Button), VerticalAlignment.Center, propertyChanged: (bindable, oldValue, newValue) =>
202 var instance = (Button)bindable;
203 var newVerticalAlignment = (VerticalAlignment)newValue;
205 if (instance.itemVerticalAlignment != newVerticalAlignment)
207 instance.itemVerticalAlignment = newVerticalAlignment;
208 instance.LayoutItems();
211 defaultValueCreator: (bindable) => ((Button)bindable).itemVerticalAlignment);
213 /// <summary> The bindable property of ItemSpacing. </summary>
214 [EditorBrowsable(EditorBrowsableState.Never)]
215 internal static readonly BindableProperty ItemSpacingProperty = BindableProperty.Create(nameof(ItemSpacing), typeof(Size2D), typeof(Button), null, propertyChanged: (bindable, oldValue, newValue) =>
217 var instance = (Button)bindable;
218 instance.itemSpacing = (Size2D)newValue;
219 instance.UpdateSizeAndSpacing();
221 defaultValueCreator: (bindable) => ((Button)bindable).itemSpacing);
223 private IconOrientation? iconRelativeOrientation = IconOrientation.Left;
224 private bool isSelected = false;
225 private bool isSelectable = false;
226 private Size2D itemSpacing;
227 private LinearLayout.Alignment itemAlignment = LinearLayout.Alignment.Center;
228 private HorizontalAlignment itemHorizontalAlignment = HorizontalAlignment.Center;
229 private VerticalAlignment itemVerticalAlignment = VerticalAlignment.Center;
234 /// Creates a new instance of a Button.
236 /// <since_tizen> 6 </since_tizen>
237 public Button() : base()
243 /// Creates a new instance of a Button with style.
245 /// <param name="style">Create Button by special style defined in UX.</param>
246 /// <since_tizen> 8 </since_tizen>
247 public Button(string style) : base(style)
253 /// Creates a new instance of a Button with style.
255 /// <param name="buttonStyle">Create Button by style customized by user.</param>
256 /// <since_tizen> 8 </since_tizen>
257 public Button(ButtonStyle buttonStyle) : base(buttonStyle)
263 /// Calculates current states for the button<br />
265 [EditorBrowsable(EditorBrowsableState.Never)]
266 protected override AccessibilityStates AccessibilityCalculateStates()
268 var states = base.AccessibilityCalculateStates();
270 states[AccessibilityState.Checked] = this.IsSelected;
271 states[AccessibilityState.Enabled] = this.IsEnabled;
277 /// An event for the button clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
279 /// <since_tizen> 6 </since_tizen>
280 [Obsolete("Deprecated in API8; Will be removed in API10. Please use Clicked event instead.")]
281 public event EventHandler<ClickEventArgs> ClickEvent;
284 /// An event for the button clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.
286 /// <since_tizen> 8 </since_tizen>
287 public event EventHandler<ClickedEventArgs> Clicked;
290 /// An event for the button state changed signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
292 /// <since_tizen> 6 </since_tizen>
293 [Obsolete("Deprecated in API8; Will be removed in API10. Please use View.ControlStateChangedEvent")]
294 public event EventHandler<StateChangedEventArgs> StateChangedEvent
298 stateChangeHandler += value;
302 stateChangeHandler -= value;
307 /// Icon orientation.
309 /// <since_tizen> 6 </since_tizen>
310 public enum IconOrientation
315 /// <since_tizen> 6 </since_tizen>
320 /// <since_tizen> 6 </since_tizen>
325 /// <since_tizen> 6 </since_tizen>
330 /// <since_tizen> 6 </since_tizen>
335 /// Button's icon part.
337 /// <since_tizen> 8 </since_tizen>
338 public ImageView Icon
348 /// Button's overlay image part.
350 /// <since_tizen> 8 </since_tizen>
351 public ImageView OverlayImage
355 if (null == overlayImage)
357 overlayImage = CreateOverlayImage();
358 if (null != Extension)
360 overlayImage = Extension.OnCreateOverlayImage(this, overlayImage);
362 if (null != overlayImage)
364 overlayImage.ExcludeLayouting = true;
372 overlayImage = value;
377 /// Button's text part.
379 /// <since_tizen> 8 </since_tizen>
380 public TextLabel TextLabel
390 /// The last applied style object copy.
393 /// Modifying contents in style may cause unexpected behaviour.
395 /// <since_tizen> 8 </since_tizen>
396 public ButtonStyle Style => (ButtonStyle)(ViewStyle as ButtonStyle)?.Clone();
399 /// The text of Button.
401 /// <since_tizen> 6 </since_tizen>
406 return GetValue(TextProperty) as string;
410 SetValue(TextProperty, value);
411 NotifyPropertyChanged();
414 private string InternalText
418 return TextLabel.Text;
422 TextLabel.Text = value;
424 if (Accessibility.Accessibility.IsEnabled && IsHighlighted && String.IsNullOrEmpty(AccessibilityName) && GetAccessibilityNameSignal().Empty())
426 EmitAccessibilityEvent(AccessibilityPropertyChangeEvent.Name);
432 /// Flag to decide Button can be selected or not.
434 /// <since_tizen> 6 </since_tizen>
435 public bool IsSelectable
439 return (bool)GetValue(IsSelectableProperty);
443 SetValue(IsSelectableProperty, value);
448 /// Translate text string in Button.
450 /// <since_tizen> 6 </since_tizen>
451 public string TranslatableText
455 return GetValue(TranslatableTextProperty) as string;
459 SetValue(TranslatableTextProperty, value);
460 NotifyPropertyChanged();
463 private string InternalTranslatableText
467 return TextLabel.TranslatableText;
471 TextLabel.TranslatableText = value;
476 /// Text point size in Button.
478 /// <since_tizen> 6 </since_tizen>
479 public float PointSize
483 return (float)GetValue(PointSizeProperty);
487 SetValue(PointSizeProperty, value);
488 NotifyPropertyChanged();
491 private float InternalPointSize
495 return TextLabel.PointSize;
499 TextLabel.PointSize = value;
504 /// Text font family in Button.
506 /// <since_tizen> 6 </since_tizen>
507 public string FontFamily
511 return GetValue(FontFamilyProperty) as string;
515 SetValue(FontFamilyProperty, value);
516 NotifyPropertyChanged();
519 private string InternalFontFamily
523 return TextLabel.FontFamily;
527 TextLabel.FontFamily = value;
532 /// Text color in Button.
534 /// <since_tizen> 6 </since_tizen>
535 public Color TextColor
539 return GetValue(TextColorProperty) as Color;
543 SetValue(TextColorProperty, value);
544 NotifyPropertyChanged();
547 private Color InternalTextColor
551 return TextLabel.TextColor;
555 TextLabel.TextColor = value;
560 /// Text horizontal alignment in Button.
562 /// <since_tizen> 6 </since_tizen>
563 public HorizontalAlignment TextAlignment
567 return (HorizontalAlignment)GetValue(TextAlignmentProperty);
571 SetValue(TextAlignmentProperty, value);
572 NotifyPropertyChanged();
575 private HorizontalAlignment InternalTextAlignment
579 return TextLabel.HorizontalAlignment;
583 TextLabel.HorizontalAlignment = value;
588 /// Icon image's resource url in Button.
590 /// <since_tizen> 6 </since_tizen>
591 public string IconURL
595 return GetValue(IconURLProperty) as string;
599 SetValue(IconURLProperty, value);
600 NotifyPropertyChanged();
603 private string InternalIconURL
607 return Icon.ResourceUrl;
611 Icon.ResourceUrl = value;
616 /// Icon image's size in Button.
618 [EditorBrowsable(EditorBrowsableState.Never)]
623 return GetValue(IconSizeProperty) as Size;
627 SetValue(IconSizeProperty, value);
628 NotifyPropertyChanged();
631 private Size InternalIconSize
634 set => Icon.Size = value;
638 /// Text string selector in Button.
639 /// Getter returns copied selector value if exist, null otherwise.
640 /// <exception cref="NullReferenceException">Thrown when setting null value.</exception>
642 /// <since_tizen> 6 </since_tizen>
643 public StringSelector TextSelector
647 return GetValue(TextSelectorProperty) as StringSelector;
651 SetValue(TextSelectorProperty, value);
652 NotifyPropertyChanged();
655 private StringSelector InternalTextSelector
657 get => buttonText?.TextSelector == null ? null : new StringSelector(buttonText.TextSelector);
660 if (value == null || buttonText == null)
662 throw new NullReferenceException("Button.TextSelector is null");
666 buttonText.TextSelector = value;
672 /// Translatable text string selector in Button.
673 /// Getter returns copied selector value if exist, null otherwise.
675 /// <exception cref="NullReferenceException">Thrown when setting null value.</exception>
676 /// <since_tizen> 6 </since_tizen>
677 public StringSelector TranslatableTextSelector
681 return GetValue(TranslatableTextSelectorProperty) as StringSelector;
685 SetValue(TranslatableTextSelectorProperty, value);
686 NotifyPropertyChanged();
689 private StringSelector InternalTranslatableTextSelector
691 get => (buttonText?.TranslatableTextSelector == null) ? null : new StringSelector(buttonText.TranslatableTextSelector);
694 if (value == null || buttonText == null)
696 throw new NullReferenceException("Button.TranslatableTextSelector is null");
700 buttonText.TranslatableTextSelector = value;
706 /// Text color selector in Button.
707 /// Getter returns copied selector value if exist, null otherwise.
709 /// <exception cref="NullReferenceException">Thrown when setting null value.</exception>
710 /// <since_tizen> 6 </since_tizen>
711 public ColorSelector TextColorSelector
715 return GetValue(TextColorSelectorProperty) as ColorSelector;
719 SetValue(TextColorSelectorProperty, value);
720 NotifyPropertyChanged();
723 private ColorSelector InternalTextColorSelector
725 get => buttonText?.TextColorSelector == null ? null : new ColorSelector(buttonText.TextColorSelector);
728 if (value == null || buttonText == null)
730 throw new NullReferenceException("Button.TextColorSelectorProperty is null");
734 buttonText.TextColorSelector = value;
740 /// Text font size selector in Button.
741 /// Getter returns copied selector value if exist, null otherwise.
743 /// <exception cref="NullReferenceException">Thrown when setting null value.</exception>
744 /// <since_tizen> 6 </since_tizen>
745 public FloatSelector PointSizeSelector
749 return GetValue(PointSizeSelectorProperty) as FloatSelector;
753 SetValue(PointSizeSelectorProperty, value);
754 NotifyPropertyChanged();
757 private FloatSelector InternalPointSizeSelector
759 get => buttonText?.PointSizeSelector == null ? null : new FloatSelector(buttonText.PointSizeSelector);
762 if (value == null || buttonText == null)
764 throw new NullReferenceException("Button.PointSizeSelector is null");
768 buttonText.PointSizeSelector = value;
774 /// Icon image's resource url selector in Button.
775 /// Getter returns copied selector value if exist, null otherwise.
777 /// <exception cref="NullReferenceException">Thrown when setting null value.</exception>
778 /// <since_tizen> 6 </since_tizen>
779 public StringSelector IconURLSelector
783 return GetValue(IconURLSelectorProperty) as StringSelector;
787 SetValue(IconURLSelectorProperty, value);
788 NotifyPropertyChanged();
791 private StringSelector InternalIconURLSelector
793 get => buttonIcon?.ResourceUrlSelector == null ? null : new StringSelector(buttonIcon.ResourceUrlSelector);
796 if (value == null || buttonIcon == null)
798 throw new NullReferenceException("Button.IconURLSelector is null");
802 buttonIcon.ResourceUrlSelector = value;
808 /// Flag to decide selected state in Button.
810 /// <since_tizen> 6 </since_tizen>
811 public bool IsSelected
815 return (bool)GetValue(IsSelectedProperty);
819 SetValue(IsSelectedProperty, value);
824 /// Flag to decide enable or disable in Button.
826 /// <since_tizen> 6 </since_tizen>
827 public new bool IsEnabled
829 get => base.IsEnabled;
832 base.IsEnabled = value;
837 /// Icon relative orientation in Button, work only when show icon and text.
839 /// <since_tizen> 8 </since_tizen>
840 public IconOrientation? IconRelativeOrientation
844 return (IconOrientation?)GetValue(IconRelativeOrientationProperty) ?? IconOrientation.Left;
848 SetValue(IconRelativeOrientationProperty, value);
853 /// Icon padding in Button. It is shortcut of Icon.Padding.
855 /// <since_tizen> 6 </since_tizen>
856 public Extents IconPadding
858 get => (Extents)GetValue(IconPaddingProperty) ?? new Extents();
859 set => SetValue(IconPaddingProperty, value);
863 /// Text padding in Button. It is shortcut of TextLabel.Padding.
865 /// <since_tizen> 6 </since_tizen>
866 public Extents TextPadding
868 get => (Extents)GetValue(TextPaddingProperty) ?? new Extents();
869 set => SetValue(TextPaddingProperty, value);
873 /// The item (text or icon or both) alignment.
875 /// <since_tizen> 9 </since_tizen>
876 public LinearLayout.Alignment ItemAlignment
878 get => (LinearLayout.Alignment)GetValue(ItemAlignmentProperty);
879 set => SetValue(ItemAlignmentProperty, value);
883 /// The item (text or icon or both) horizontal alignment.
885 [EditorBrowsable(EditorBrowsableState.Never)]
886 public HorizontalAlignment ItemHorizontalAlignment
888 get => (HorizontalAlignment)GetValue(ItemHorizontalAlignmentProperty);
889 set => SetValue(ItemHorizontalAlignmentProperty, value);
893 /// The item (text or icon or both) vertical alignment.
895 [EditorBrowsable(EditorBrowsableState.Never)]
896 public VerticalAlignment ItemVerticalAlignment
898 get => (VerticalAlignment)GetValue(ItemVerticalAlignmentProperty);
899 set => SetValue(ItemVerticalAlignmentProperty, value);
903 /// The space between icon and text.
904 /// The value is applied when there exist icon and text both.
905 /// The width value is used when the items are arranged horizontally. Otherwise, the height value is used.
907 /// <since_tizen> 9 </since_tizen>
908 public Size2D ItemSpacing
910 get => (Size2D)GetValue(ItemSpacingProperty);
911 set => SetValue(ItemSpacingProperty, value);
915 /// Called after a key event is received by the view that has had its focus set.
917 /// <param name="key">The key event.</param>
918 /// <returns>True if the key event should be consumed.</returns>
919 /// <since_tizen> 6 </since_tizen>
920 public override bool OnKey(Key key)
922 bool clicked = false;
924 if (!IsEnabled || null == key)
929 if (key.State == Key.StateType.Down)
931 if (key.KeyPressedName == "Return")
937 else if (key.State == Key.StateType.Up)
939 if (key.KeyPressedName == "Return")
941 clicked = isPressed && IsEnabled;
947 IsSelected = !IsSelected;
956 ClickedEventArgs eventArgs = new ClickedEventArgs();
957 OnClickedInternal(eventArgs);
961 return base.OnKey(key) || clicked;
965 /// Called when the control gain key input focus. Should be overridden by derived classes if they need to customize what happens when the focus is gained.
967 /// <since_tizen> 8 </since_tizen>
968 public override void OnFocusGained()
970 base.OnFocusGained();
975 /// Called when the control loses key input focus. Should be overridden by derived classes if they need to customize what happens when the focus is lost.
977 /// <since_tizen> 8 </since_tizen>
978 public override void OnFocusLost()
985 /// Called after a touch event is received by the owning view.<br />
986 /// CustomViewBehaviour.REQUIRES_TOUCH_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).<br />
988 /// <param name="touch">The touch event.</param>
989 /// <returns>True if the event should be consumed.</returns>
990 /// <since_tizen> 8 </since_tizen>
991 [Obsolete("Deprecated in API8; Will be removed in API10. Please use OnClicked instead.")]
992 #pragma warning disable CS0809 // Obsolete member overrides non-obsolete member, It will be removed in API10
993 public override bool OnTouch(Touch touch)
994 #pragma warning restore CS0809 // Obsolete member overrides non-obsolete member, It will be removed in API10
996 return base.OnTouch(touch);
1000 /// Apply style to button.
1002 /// <param name="viewStyle">The style to apply.</param>
1003 /// <since_tizen> 8 </since_tizen>
1004 public override void ApplyStyle(ViewStyle viewStyle)
1006 Debug.Assert(buttonIcon != null && buttonText != null);
1008 base.ApplyStyle(viewStyle);
1010 if (!styleApplying && viewStyle is ButtonStyle buttonStyle)
1012 styleApplying = true;
1014 if (buttonStyle.Overlay != null)
1016 OverlayImage?.ApplyStyle(buttonStyle.Overlay);
1019 if ((Extension = buttonStyle.CreateExtension()) != null)
1021 buttonIcon.Unparent();
1022 buttonIcon = Extension.OnCreateIcon(this, buttonIcon);
1024 buttonText.Unparent();
1025 buttonText = Extension.OnCreateText(this, buttonText);
1030 if (buttonStyle.Text != null)
1032 buttonText.ThemeChangeSensitive = false;
1033 buttonText.ApplyStyle(buttonStyle.Text);
1036 if (buttonStyle.Icon != null)
1038 buttonIcon.ApplyStyle(buttonStyle.Icon);
1040 styleApplying = false;
1047 /// ClickEventArgs is a class to record button click event arguments which will sent to user.
1049 /// <since_tizen> 6 </since_tizen>
1050 [Obsolete("Deprecated in API8; Will be removed in API10. Please use ClickedEventArgs instead.")]
1051 [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
1052 public class ClickEventArgs : EventArgs
1057 /// StateChangeEventArgs is a class to record button state change event arguments which will sent to user.
1059 /// <since_tizen> 6 </since_tizen>
1060 [Obsolete("Deprecated in API8; Will be removed in API10. Please use View.ControlStateChangedEventArgs")]
1061 [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
1062 public class StateChangedEventArgs : EventArgs
1064 /// <summary> previous state of Button </summary>
1065 /// <since_tizen> 6 </since_tizen>
1066 /// It will be removed in API10
1067 [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1051:Do not declare visible instance fields")]
1068 [Obsolete("Deprecated in API8; Will be removed in API10")]
1069 public ControlStates PreviousState;
1070 /// <summary> current state of Button </summary>
1071 /// <since_tizen> 6 </since_tizen>
1072 /// It will be removed in API10
1073 [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1051:Do not declare visible instance fields")]
1074 [Obsolete("Deprecated in API8; Will be removed in API10")]
1075 public ControlStates CurrentState;