Class Button

Definition

Namespace:
Tizen.NUI.Components
Assembly:
Tizen.NUI.Components.dll
API Level:
6

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.

C#
Copy
public class Button : Control, IDynamicResourceHandler, IElement, INameScope, IElementController, System.IDisposable, IResourcesProvider
Inheritance
Derived
Implements

Constructors

View Source

Button()

Creates a new instance of a Button.

Declaration
C#
Copy
public Button()
API Level: 6
View Source

Button(String)

Creates a new instance of a Button with style.

Declaration
C#
Copy
public Button(string style)
Parameters
Type Name Description
String style

Create Button by special style defined in UX.

API Level: 8
View Source

Button(ButtonStyle)

Creates a new instance of a Button with style.

Declaration
C#
Copy
public Button(ButtonStyle buttonStyle)
Parameters
Type Name Description
ButtonStyle buttonStyle

Create Button by style customized by user.

API Level: 8

Fields

View Source

FontFamilyProperty

FontFamilyProperty

Declaration
C#
Copy
public static readonly BindableProperty FontFamilyProperty
Field Value
Type Description
BindableProperty
View Source

IconPaddingProperty

Declaration
C#
Copy
public static readonly BindableProperty IconPaddingProperty
Field Value
Type Description
BindableProperty
View Source

IconRelativeOrientationProperty

Declaration
C#
Copy
public static readonly BindableProperty IconRelativeOrientationProperty
Field Value
Type Description
BindableProperty
View Source

IconSizeProperty

IconSizeProperty

Declaration
C#
Copy
public static readonly BindableProperty IconSizeProperty
Field Value
Type Description
BindableProperty
View Source

IconURLProperty

IconURLProperty

Declaration
C#
Copy
public static readonly BindableProperty IconURLProperty
Field Value
Type Description
BindableProperty
View Source

IconURLSelectorProperty

IconURLSelectorProperty

Declaration
C#
Copy
public static readonly BindableProperty IconURLSelectorProperty
Field Value
Type Description
BindableProperty
View Source

IsSelectableProperty

Declaration
C#
Copy
public static readonly BindableProperty IsSelectableProperty
Field Value
Type Description
BindableProperty
View Source

IsSelectedProperty

Declaration
C#
Copy
public static readonly BindableProperty IsSelectedProperty
Field Value
Type Description
BindableProperty
View Source

PointSizeProperty

PointSizeProperty

Declaration
C#
Copy
public static readonly BindableProperty PointSizeProperty
Field Value
Type Description
BindableProperty
View Source

PointSizeSelectorProperty

PointSizeSelectorProperty

Declaration
C#
Copy
public static readonly BindableProperty PointSizeSelectorProperty
Field Value
Type Description
BindableProperty
View Source

TextAlignmentProperty

TextAlignmentProperty

Declaration
C#
Copy
public static readonly BindableProperty TextAlignmentProperty
Field Value
Type Description
BindableProperty
View Source

TextColorProperty

TextColorProperty

Declaration
C#
Copy
public static readonly BindableProperty TextColorProperty
Field Value
Type Description
BindableProperty
View Source

TextColorSelectorProperty

TextColorSelectorProperty

Declaration
C#
Copy
public static readonly BindableProperty TextColorSelectorProperty
Field Value
Type Description
BindableProperty
View Source

TextPaddingProperty

Declaration
C#
Copy
public static readonly BindableProperty TextPaddingProperty
Field Value
Type Description
BindableProperty
View Source

TextProperty

TextProperty

Declaration
C#
Copy
public static readonly BindableProperty TextProperty
Field Value
Type Description
BindableProperty
View Source

TextSelectorProperty

TextSelectorProperty

Declaration
C#
Copy
public static readonly BindableProperty TextSelectorProperty
Field Value
Type Description
BindableProperty
View Source

TranslatableTextProperty

TranslatableTextProperty

Declaration
C#
Copy
public static readonly BindableProperty TranslatableTextProperty
Field Value
Type Description
BindableProperty
View Source

TranslatableTextSelectorProperty

TranslatableTextSelectorProperty

Declaration
C#
Copy
public static readonly BindableProperty TranslatableTextSelectorProperty
Field Value
Type Description
BindableProperty

Properties

View Source

Extension

The ButtonExtension instance that is injected by ButtonStyle.

Declaration
C#
Copy
protected ButtonExtension Extension { get; set; }
Property Value
Type Description
ButtonExtension
View Source

FontFamily

Text font family in Button.

Declaration
C#
Copy
public string FontFamily { get; set; }
Property Value
Type Description
String
API Level: 6
View Source

Icon

Button's icon part.

Declaration
C#
Copy
public ImageView Icon { get; }
Property Value
Type Description
ImageView
API Level: 8
View Source

IconPadding

Icon padding in Button. It is shortcut of Icon.Padding.

Declaration
C#
Copy
public Extents IconPadding { get; set; }
Property Value
Type Description
Extents
API Level: 6
View Source

IconRelativeOrientation

Icon relative orientation in Button, work only when show icon and text.

Declaration
C#
Copy
public Button.IconOrientation? IconRelativeOrientation { get; set; }
Property Value
Type Description
Nullable<Button.IconOrientation>
API Level: 8
View Source

IconSize

Icon image's size in Button.

Declaration
C#
Copy
public Size IconSize { get; set; }
Property Value
Type Description
Size
View Source

IconURL

Icon image's resource url in Button.

Declaration
C#
Copy
public string IconURL { get; set; }
Property Value
Type Description
String
API Level: 6
View Source

IconURLSelector

Icon image's resource url selector in Button. Getter returns copied selector value if exist, null otherwise.

Declaration
C#
Copy
public StringSelector IconURLSelector { get; set; }
Property Value
Type Description
StringSelector
API Level: 6
View Source

IsEnabled

Flag to decide enable or disable in Button.

Declaration
C#
Copy
public bool IsEnabled { get; set; }
Property Value
Type Description
Boolean
API Level: 6
View Source

IsSelectable

Flag to decide Button can be selected or not.

Declaration
C#
Copy
public bool IsSelectable { get; set; }
Property Value
Type Description
Boolean
API Level: 6
View Source

IsSelected

Flag to decide selected state in Button.

Declaration
C#
Copy
public bool IsSelected { get; set; }
Property Value
Type Description
Boolean
API Level: 6
View Source

ItemAlignment

The item (text or icon or both) alignment.

Declaration
C#
Copy
public LinearLayout.Alignment ItemAlignment { get; set; }
Property Value
Type Description
LinearLayout.Alignment
API Level: 9
View Source

ItemHorizontalAlignment

The item (text or icon or both) horizontal alignment.

Declaration
C#
Copy
public HorizontalAlignment ItemHorizontalAlignment { get; set; }
Property Value
Type Description
HorizontalAlignment
View Source

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
C#
Copy
public Size2D ItemSpacing { get; set; }
Property Value
Type Description
Size2D
API Level: 9
View Source

ItemVerticalAlignment

The item (text or icon or both) vertical alignment.

Declaration
C#
Copy
public VerticalAlignment ItemVerticalAlignment { get; set; }
Property Value
Type Description
VerticalAlignment
View Source

OverlayImage

Button's overlay image part.

Declaration
C#
Copy
public ImageView OverlayImage { get; }
Property Value
Type Description
ImageView
API Level: 8
View Source

PointSize

Text point size in Button.

Declaration
C#
Copy
public float PointSize { get; set; }
Property Value
Type Description
Single
API Level: 6
View Source

PointSizeSelector

Text font size selector in Button. Getter returns copied selector value if exist, null otherwise.

Declaration
C#
Copy
public FloatSelector PointSizeSelector { get; set; }
Property Value
Type Description
FloatSelector
API Level: 6
View Source

Style

The last applied style object copy.

Declaration
C#
Copy
public ButtonStyle Style { get; }
Property Value
Type Description
ButtonStyle
Remarks

Modifying contents in style may cause unexpected behaviour.

API Level: 8
View Source

Text

The text of Button.

Declaration
C#
Copy
public string Text { get; set; }
Property Value
Type Description
String
API Level: 6
View Source

TextAlignment

Text horizontal alignment in Button.

Declaration
C#
Copy
public HorizontalAlignment TextAlignment { get; set; }
Property Value
Type Description
HorizontalAlignment
API Level: 6
View Source

TextColor

Text color in Button.

Declaration
C#
Copy
public Color TextColor { get; set; }
Property Value
Type Description
Color
API Level: 6
View Source

TextColorSelector

Text color selector in Button. Getter returns copied selector value if exist, null otherwise.

Declaration
C#
Copy
public ColorSelector TextColorSelector { get; set; }
Property Value
Type Description
ColorSelector
API Level: 6
View Source

TextLabel

Button's text part.

Declaration
C#
Copy
public TextLabel TextLabel { get; }
Property Value
Type Description
TextLabel
API Level: 8
View Source

TextPadding

Text padding in Button. It is shortcut of TextLabel.Padding.

Declaration
C#
Copy
public Extents TextPadding { get; set; }
Property Value
Type Description
Extents
API Level: 6
View Source

TextSelector

Text string selector in Button. Getter returns copied selector value if exist, null otherwise. Thrown when setting null value.

Declaration
C#
Copy
public StringSelector TextSelector { get; set; }
Property Value
Type Description
StringSelector
API Level: 6
View Source

TranslatableText

Translate text string in Button.

Declaration
C#
Copy
public string TranslatableText { get; set; }
Property Value
Type Description
String
API Level: 6
View Source

TranslatableTextSelector

Translatable text string selector in Button. Getter returns copied selector value if exist, null otherwise.

Declaration
C#
Copy
public StringSelector TranslatableTextSelector { get; set; }
Property Value
Type Description
StringSelector
API Level: 6

Methods

View Source

AccessibilityCalculateStates()

Calculates current states for the button

Declaration
C#
Copy
protected override AccessibilityStates AccessibilityCalculateStates()
Returns
Type Description
AccessibilityStates
Overrides
View Source

AccessibilityGetName()

Gets accessibility name.

Declaration
C#
Copy
protected override string AccessibilityGetName()
Returns
Type Description
String
Overrides
View Source

ApplyStyle(ViewStyle)

Apply style to button.

Declaration
C#
Copy
public override void ApplyStyle(ViewStyle viewStyle)
Parameters
Type Name Description
ViewStyle viewStyle

The style to apply.

Overrides
API Level: 8
View Source

CreateIcon()

Creates Button's icon part.

Declaration
C#
Copy
protected virtual ImageView CreateIcon()
Returns
Type Description
ImageView
View Source

CreateOverlayImage()

Creates Button's overlay image part.

Declaration
C#
Copy
protected virtual ImageView CreateOverlayImage()
Returns
Type Description
ImageView
View Source

CreateText()

Creates Button's text part.

Declaration
C#
Copy
protected virtual TextLabel CreateText()
Returns
Type Description
TextLabel
View Source

CreateViewStyle()

Get Button style.

Declaration
C#
Copy
protected override ViewStyle CreateViewStyle()
Returns
Type Description
ViewStyle

The default button style.

Overrides
API Level: 8
View Source

Dispose(DisposeTypes)

Dispose Button and all children on it.

Declaration
C#
Copy
protected override void Dispose(DisposeTypes type)
Parameters
Type Name Description
DisposeTypes type

Dispose type.

Overrides
API Level: 6
View Source

HandleControlStateOnTouch(Touch)

The touch event handler for ControlState. Please change ControlState value by touch state if needed.

Declaration
C#
Copy
protected override bool HandleControlStateOnTouch(Touch touch)
Parameters
Type Name Description
Touch touch
Returns
Type Description
Boolean
Overrides
View Source

LayoutItems()

Put sub items (e.g. buttonText, buttonIcon) to the right place.

Declaration
C#
Copy
protected virtual void LayoutItems()
View Source

OnClicked(ClickedEventArgs)

Called when the Button is Clicked by a user

Declaration
C#
Copy
protected virtual void OnClicked(ClickedEventArgs eventArgs)
Parameters
Type Name Description
ClickedEventArgs eventArgs

The click information.

View Source

OnControlStateChanged(View.ControlStateChangedEventArgs)

Called after the View's ControlStates changed.

Declaration
C#
Copy
protected override void OnControlStateChanged(View.ControlStateChangedEventArgs controlStateChangedInfo)
Parameters
Type Name Description
View.ControlStateChangedEventArgs controlStateChangedInfo

The information including state changed variables.

Overrides
View Source

OnEnabled(Boolean)

Internal callback of enabled property changes. Inherited view can override this method to implements enabled property changes.

Declaration
C#
Copy
protected override void OnEnabled(bool enabled)
Parameters
Type Name Description
Boolean enabled
Overrides
View Source

OnFocusGained()

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
C#
Copy
public override void OnFocusGained()
Overrides
API Level: 8
View Source

OnFocusLost()

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
C#
Copy
public override void OnFocusLost()
Overrides
API Level: 8
View Source

OnInitialize()

Initializes AT-SPI object.

Declaration
C#
Copy
public override void OnInitialize()
Overrides
View Source

OnKey(Key)

Called after a key event is received by the view that has had its focus set.

Declaration
C#
Copy
public override bool OnKey(Key key)
Parameters
Type Name Description
Key key

The key event.

Returns
Type Description
Boolean

True if the key event should be consumed.

Overrides
API Level: 6
View Source

OnRelayout(Vector2, RelayoutContainer)

Called after the size negotiation has been finished for this control.
The control is expected to assign this given size to itself or its children.
Should be overridden by derived classes if they need to layout views differently after certain operations like add or remove views, resize, or after changing specific properties.
As this function is called from inside the size negotiation algorithm, you cannot call RequestRelayout (the call would just be ignored).

Declaration
C#
Copy
public override void OnRelayout(Vector2 size, RelayoutContainer container)
Parameters
Type Name Description
Vector2 size

The allocated size.

RelayoutContainer container

The control should add views to this container that it is not able to allocate a size for.

Overrides
View Source

OnTouch(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
C#
Copy
public override bool OnTouch(Touch touch)
Parameters
Type Name Description
Touch touch

The touch event.

Returns
Type Description
Boolean

True if the event should be consumed.

Overrides
API Level: 8
View Source

OnUpdate()

Declaration
C#
Copy
protected override void OnUpdate()
Overrides
View Source

UpdateState()

Update Button State.

Declaration
C#
Copy
protected void UpdateState()
API Level: 6

Events

View Source

Clicked

An event for the button clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.

Declaration
C#
Copy
public event EventHandler<ClickedEventArgs> Clicked
Event Type
Type Description
EventHandler<ClickedEventArgs>
API Level: 8
View Source

ClickEvent

An event for the button clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.

Declaration
C#
Copy
public event EventHandler<Button.ClickEventArgs> ClickEvent
Event Type
Type Description
EventHandler<Button.ClickEventArgs>
API Level: 6
View Source

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
C#
Copy
public event EventHandler<Button.StateChangedEventArgs> StateChangedEvent
Event Type
Type Description
EventHandler<Button.StateChangedEventArgs>
API Level: 6

Implements

Extension Methods