Class Button
Definition
- Namespace:
- Tizen.NUI.Components
- Assembly:
- Tizen.NUI.Components.dll
Button is one kind of common component, a button clearly describes what action will occur when the user selects it. Button may contain text or an icon.
public class Button : Control, IDynamicResourceHandler, INameScope, System.IDisposable, IResourcesProvider
- Inheritance
-
objectButton
- Derived
- Implements
-
System.IDisposable
Constructors
View SourceButton()
Creates a new instance of a Button.
Declaration
public Button()
Button(string)
Creates a new instance of a Button with style.
Declaration
public Button(string style)
Parameters
Type | Name | Description |
---|---|---|
string | style | Create Button by special style defined in UX. |
Button(ButtonStyle)
Creates a new instance of a Button with style.
Declaration
public Button(ButtonStyle buttonStyle)
Parameters
Type | Name | Description |
---|---|---|
ButtonStyle | buttonStyle | Create Button by style customized by user. |
Fields
View SourceFontFamilyProperty
FontFamilyProperty
Declaration
public static readonly BindableProperty FontFamilyProperty
Field Value
Type | Description |
---|---|
BindableProperty |
IconPaddingProperty
Declaration
public static readonly BindableProperty IconPaddingProperty
Field Value
Type | Description |
---|---|
BindableProperty |
IconRelativeOrientationProperty
Declaration
public static readonly BindableProperty IconRelativeOrientationProperty
Field Value
Type | Description |
---|---|
BindableProperty |
IconSizeProperty
IconSizeProperty
Declaration
public static readonly BindableProperty IconSizeProperty
Field Value
Type | Description |
---|---|
BindableProperty |
IconURLProperty
IconURLProperty
Declaration
public static readonly BindableProperty IconURLProperty
Field Value
Type | Description |
---|---|
BindableProperty |
IconURLSelectorProperty
IconURLSelectorProperty
Declaration
public static readonly BindableProperty IconURLSelectorProperty
Field Value
Type | Description |
---|---|
BindableProperty |
IsSelectableProperty
Declaration
public static readonly BindableProperty IsSelectableProperty
Field Value
Type | Description |
---|---|
BindableProperty |
IsSelectedProperty
Declaration
public static readonly BindableProperty IsSelectedProperty
Field Value
Type | Description |
---|---|
BindableProperty |
PointSizeProperty
PointSizeProperty
Declaration
public static readonly BindableProperty PointSizeProperty
Field Value
Type | Description |
---|---|
BindableProperty |
PointSizeSelectorProperty
PointSizeSelectorProperty
Declaration
public static readonly BindableProperty PointSizeSelectorProperty
Field Value
Type | Description |
---|---|
BindableProperty |
TextAlignmentProperty
TextAlignmentProperty
Declaration
public static readonly BindableProperty TextAlignmentProperty
Field Value
Type | Description |
---|---|
BindableProperty |
TextColorProperty
TextColorProperty
Declaration
public static readonly BindableProperty TextColorProperty
Field Value
Type | Description |
---|---|
BindableProperty |
TextColorSelectorProperty
TextColorSelectorProperty
Declaration
public static readonly BindableProperty TextColorSelectorProperty
Field Value
Type | Description |
---|---|
BindableProperty |
TextPaddingProperty
Declaration
public static readonly BindableProperty TextPaddingProperty
Field Value
Type | Description |
---|---|
BindableProperty |
TextProperty
TextProperty
Declaration
public static readonly BindableProperty TextProperty
Field Value
Type | Description |
---|---|
BindableProperty |
TextSelectorProperty
TextSelectorProperty
Declaration
public static readonly BindableProperty TextSelectorProperty
Field Value
Type | Description |
---|---|
BindableProperty |
TranslatableTextProperty
TranslatableTextProperty
Declaration
public static readonly BindableProperty TranslatableTextProperty
Field Value
Type | Description |
---|---|
BindableProperty |
TranslatableTextSelectorProperty
TranslatableTextSelectorProperty
Declaration
public static readonly BindableProperty TranslatableTextSelectorProperty
Field Value
Type | Description |
---|---|
BindableProperty |
Properties
View SourceExtension
The ButtonExtension instance that is injected by ButtonStyle.
Declaration
protected ButtonExtension Extension { get; set; }
Property Value
Type | Description |
---|---|
ButtonExtension |
FontFamily
Text font family in Button.
Declaration
public string FontFamily { get; set; }
Property Value
Type | Description |
---|---|
string |
Icon
Button's icon part.
Declaration
public ImageView Icon { get; }
Property Value
Type | Description |
---|---|
ImageView |
IconPadding
Icon padding in Button. It is shortcut of Icon.Padding.
Declaration
public Extents IconPadding { get; set; }
Property Value
Type | Description |
---|---|
Extents |
IconRelativeOrientation
Icon relative orientation in Button, work only when show icon and text.
Declaration
public Button.IconOrientation? IconRelativeOrientation { get; set; }
Property Value
Type | Description |
---|---|
IconOrientation? |
IconSize
Icon image's size in Button.
Declaration
public Size IconSize { get; set; }
Property Value
Type | Description |
---|---|
Size |
IconURL
Icon image's resource url in Button.
Declaration
public string IconURL { get; set; }
Property Value
Type | Description |
---|---|
string |
IconURLSelector
Icon image's resource url selector in Button. Getter returns copied selector value if exist, null otherwise.
Declaration
public StringSelector IconURLSelector { get; set; }
Property Value
Type | Description |
---|---|
StringSelector |
IsEnabled
Flag to decide enable or disable in Button.
Declaration
public bool IsEnabled { get; set; }
Property Value
Type | Description |
---|---|
bool |
IsSelectable
Flag to decide Button can be selected or not.
Declaration
public bool IsSelectable { get; set; }
Property Value
Type | Description |
---|---|
bool |
IsSelected
Flag to decide selected state in Button.
Declaration
public bool IsSelected { get; set; }
Property Value
Type | Description |
---|---|
bool |
ItemAlignment
The item (text or icon or both) alignment.
Declaration
public LinearLayout.Alignment ItemAlignment { get; set; }
Property Value
Type | Description |
---|---|
LinearLayout.Alignment |
ItemHorizontalAlignment
The item (text or icon or both) horizontal alignment.
Declaration
public HorizontalAlignment ItemHorizontalAlignment { get; set; }
Property Value
Type | Description |
---|---|
HorizontalAlignment |
ItemSpacing
The space between icon and text. The value is applied when there exist icon and text both. The width value is used when the items are arranged horizontally. Otherwise, the height value is used.
Declaration
public Size2D ItemSpacing { get; set; }
Property Value
Type | Description |
---|---|
Size2D |
ItemVerticalAlignment
The item (text or icon or both) vertical alignment.
Declaration
public VerticalAlignment ItemVerticalAlignment { get; set; }
Property Value
Type | Description |
---|---|
VerticalAlignment |
OverlayImage
Button's overlay image part.
Declaration
public ImageView OverlayImage { get; }
Property Value
Type | Description |
---|---|
ImageView |
PointSize
Text point size in Button.
Declaration
public float PointSize { get; set; }
Property Value
Type | Description |
---|---|
float |
PointSizeSelector
Text font size selector in Button. Getter returns copied selector value if exist, null otherwise.
Declaration
public FloatSelector PointSizeSelector { get; set; }
Property Value
Type | Description |
---|---|
FloatSelector |
Style
The last applied style object copy.
Declaration
public ButtonStyle Style { get; }
Property Value
Type | Description |
---|---|
ButtonStyle |
Remarks
Modifying contents in style may cause unexpected behaviour.
Text
The text of Button.
Declaration
public string Text { get; set; }
Property Value
Type | Description |
---|---|
string |
TextAlignment
Text horizontal alignment in Button.
Declaration
public HorizontalAlignment TextAlignment { get; set; }
Property Value
Type | Description |
---|---|
HorizontalAlignment |
TextColor
Text color in Button.
Declaration
public Color TextColor { get; set; }
Property Value
Type | Description |
---|---|
Color |
TextColorSelector
Text color selector in Button. Getter returns copied selector value if exist, null otherwise.
Declaration
public ColorSelector TextColorSelector { get; set; }
Property Value
Type | Description |
---|---|
ColorSelector |
TextLabel
Button's text part.
Declaration
public TextLabel TextLabel { get; }
Property Value
Type | Description |
---|---|
TextLabel |
TextPadding
Text padding in Button. It is shortcut of TextLabel.Padding.
Declaration
public Extents TextPadding { get; set; }
Property Value
Type | Description |
---|---|
Extents |
TextSelector
Text string selector in Button.
Getter returns copied selector value if exist, null otherwise.
Declaration
public StringSelector TextSelector { get; set; }
Property Value
Type | Description |
---|---|
StringSelector |
TranslatableText
Translate text string in Button.
Declaration
public string TranslatableText { get; set; }
Property Value
Type | Description |
---|---|
string |
TranslatableTextSelector
Translatable text string selector in Button. Getter returns copied selector value if exist, null otherwise.
Declaration
public StringSelector TranslatableTextSelector { get; set; }
Property Value
Type | Description |
---|---|
StringSelector |
Methods
View SourceAccessibilityCalculateStates()
Calculates current states for the button
Declaration
protected override AccessibilityStates AccessibilityCalculateStates()
Returns
Type | Description |
---|---|
AccessibilityStates |
Overrides
View SourceAccessibilityGetName()
Gets accessibility name.
Declaration
protected override string AccessibilityGetName()
Returns
Type | Description |
---|---|
string |
Overrides
View SourceApplyStyle(ViewStyle)
Apply style to button.
Declaration
public override void ApplyStyle(ViewStyle viewStyle)
Parameters
Type | Name | Description |
---|---|---|
ViewStyle | viewStyle | The style to apply. |
Overrides
View SourceCreateIcon()
Creates Button's icon part.
Declaration
protected virtual ImageView CreateIcon()
Returns
Type | Description |
---|---|
ImageView |
CreateOverlayImage()
Creates Button's overlay image part.
Declaration
protected virtual ImageView CreateOverlayImage()
Returns
Type | Description |
---|---|
ImageView |
CreateText()
Creates Button's text part.
Declaration
protected virtual TextLabel CreateText()
Returns
Type | Description |
---|---|
TextLabel |
CreateViewStyle()
Get Button style.
Declaration
protected override ViewStyle CreateViewStyle()
Returns
Type | Description |
---|---|
ViewStyle | The default button style. |
Overrides
View SourceDispose(DisposeTypes)
Dispose Button and all children on it.
Declaration
protected override void Dispose(DisposeTypes type)
Parameters
Type | Name | Description |
---|---|---|
DisposeTypes | type | Dispose type. |
Overrides
View SourceHandleControlStateOnTouch(Touch)
Declaration
protected override bool HandleControlStateOnTouch(Touch touch)
Parameters
Type | Name | Description |
---|---|---|
Touch | touch |
Returns
Type | Description |
---|---|
bool |
Overrides
View SourceLayoutItems()
Put sub items (e.g. buttonText, buttonIcon) to the right place.
Declaration
protected virtual void LayoutItems()
OnClicked(ClickedEventArgs)
Called when the Button is Clicked by a user
Declaration
protected virtual void OnClicked(ClickedEventArgs eventArgs)
Parameters
Type | Name | Description |
---|---|---|
ClickedEventArgs | eventArgs | The click information. |
OnControlStateChanged(ControlStateChangedEventArgs)
Declaration
protected override void OnControlStateChanged(View.ControlStateChangedEventArgs controlStateChangedInfo)
Parameters
Type | Name | Description |
---|---|---|
View.ControlStateChangedEventArgs | controlStateChangedInfo |
Overrides
View SourceOnEnabled(bool)
Declaration
protected override void OnEnabled(bool enabled)
Parameters
Type | Name | Description |
---|---|---|
bool | enabled |
Overrides
View SourceOnFocusGained()
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.
Declaration
public override void OnFocusGained()
Overrides
View SourceOnFocusLost()
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.
Declaration
public override void OnFocusLost()
Overrides
View SourceOnInitialize()
Initializes AT-SPI object.
Declaration
public override void OnInitialize()
Overrides
View SourceOnKey(Key)
Called after a key event is received by the view that has had its focus set.
Declaration
public override bool OnKey(Key key)
Parameters
Type | Name | Description |
---|---|---|
Key | key | The key event. |
Returns
Type | Description |
---|---|
bool | True if the key event should be consumed. |
Overrides
View SourceOnRelayout(Vector2, RelayoutContainer)
Declaration
public override void OnRelayout(Vector2 size, RelayoutContainer container)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | size | |
RelayoutContainer | container |
Overrides
View SourceOnTouch(Touch)
Called after a touch event is received by the owning view.
CustomViewBehaviour.REQUIRES_TOUCH_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).
Declaration
public override bool OnTouch(Touch touch)
Parameters
Type | Name | Description |
---|---|---|
Touch | touch | The touch event. |
Returns
Type | Description |
---|---|
bool | True if the event should be consumed. |
Overrides
View SourceOnUpdate()
Declaration
protected override void OnUpdate()
Overrides
View SourceUpdateState()
Update Button State.
Declaration
protected void UpdateState()
Events
View SourceClicked
An event for the button clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.
Declaration
public event EventHandler<ClickedEventArgs> Clicked
Event Type
Type | Description |
---|---|
EventHandler<><ClickedEventArgs> |
ClickEvent
An event for the button clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.
Declaration
public event EventHandler<Button.ClickEventArgs> ClickEvent
Event Type
Type | Description |
---|---|
EventHandler<><ClickEventArgs> |
StateChangedEvent
An event for the button state changed signal which can be used to subscribe or unsubscribe the event handler provided by the user.
Declaration
public event EventHandler<Button.StateChangedEventArgs> StateChangedEvent
Event Type
Type | Description |
---|---|
EventHandler<><StateChangedEventArgs> |