maui-devexpress-dot-maui-dot-core-b3db921c.md
A button control.
Namespace : DevExpress.Maui.Core
Assembly : DevExpress.Maui.Core.dll
NuGet Package : DevExpress.Maui.Core
[DXLicenseMAUI]
public class DXButton :
DXButtonBase
The following members return DXButton objects:
DXButton performs the assigned action when a user taps it. The control can display a caption string (Content), icon (Icon), or both.
Use the following events to define how the button should respond to taps:
ClickedFires when a user taps a DXButtonBase descendant.TapFires when a user taps a DXButtonBase descendant. This event allows you to pass additional event data.TapPressedFires when a user taps a DXButtonBase descendant and a finger is not released.TapReleasedFires when a user taps a DXButtonBase descendant and a finger is released.
You can use the ButtonType property to specify one of the following appearance types:
|
Button Type
|
Appearance
| | --- | --- | |
Accent
|
| |
Filled
|
| |
Outlined
|
| |
Text
|
| |
ToolButton
|
|
The button has a different appearance in each state and you can use the following properties to customize its colors:
BorderColorGets or sets the border color of the button. This is a bindable property.TextColorGets or sets the text color within the button’s content. This is a bindable property.IconColorGets or sets the icon color within the button’s content. This is a bindable property.
PressedBorderColorGets or sets the border color of the button in the pressed state. This is a bindable property.PressedBackgroundColorGets or sets the background color of the button in the pressed state. This is a bindable property.PressedTextColorGets or sets the text color of the button in the pressed state. This is a bindable property.PressedIconColorGets or sets the icon color of the button in the pressed state. This is a bindable property.
DisabledBorderColorGets or sets the border color of the button in the disabled state. This is a bindable property.DisabledBackgroundColorGets or sets the background color of the button in the disabled state. This is a bindable property.DisabledTextColorGets or sets the text color of the button in the disabled state. This is a bindable property.DisabledIconColorGets or sets the icon color of the button in the disabled state. This is a bindable property.
FontFamilyGets or sets the button’s text font. This is a bindable property.FontSizeGets or sets the text font size within the button’s content. This is a bindable property.FontAttributesGets or sets whether the button’s text font style is bold, italic, or unmodified. This is a bindable property.FontAutoScalingEnabledGets or sets whether the button’s text reflects font scaling preferences set in the operating system. This is a bindable property.
IconGets or sets the icon image within the button’s content. This is a bindable property.ShowIconGets or sets whether to show an icon within the button’s content. This is a bindable property.IconAspectGets or sets the icon scale within the button’s content. This is a bindable property.IconColorGets or sets the icon color within the button’s content. This is a bindable property.PressedIconColorGets or sets the icon color of the button in the pressed state. This is a bindable property.DisabledIconColorGets or sets the icon color of the button in the disabled state. This is a bindable property.IconColorizationEnabledGets or sets whether to change the icon color within the button’s content. This is a bindable property.IconHeightGets or sets the icon height within the button’s content. This is a bindable property.IconWidthGets or sets the icon width within the button’s content. This is a bindable property.IconIndentGets or sets the distance between icon and text within the button’s content. This is a bindable property.IconPlacementGets or sets the icon position within the button’s content. This is a bindable property.
TextHorizontalAlignmentGets or sets the text horizontal alignment within the button’s content. This is a bindable property.TextVerticalAlignmentGets or sets the text vertical alignment within the button’s content. This is a bindable property.VerticalContentAlignmentGets or sets the vertical alignment of the button’s content (icon and text). This is a bindable property.HorizontalContentAlignmentGets or sets the horizontal alignment of the button’s content (icon and text). This is a bindable property.IconPlacementGets or sets the icon position within the button’s content. This is a bindable property.
UseRippleEffectGets or sets whether to show ripple effects when a users taps the button. This is a bindable property.RippleEffectPositionGets or sets whether to show ripple effects in front of button content or behind it. This is a bindable property.
This example shows how to customize button appearance and handle the button click event.
|
Button State
|
Default Appearance
|
Custom Appearance
| | --- | --- | --- | |
Default
|
|
| |
Pressed
|
|
| |
Disabled
|
|
|
Add the clear.png icon file to the Resources/Images folder.
Use the following properties to adjust the button’s appearance and handle the Clicked event to clear label on button tap:
You can also handle the Tap event to specify an action that occurs when a user taps a DXButtonBase descendant. The Tap event allows you to pass additional event data.
The following featured scenarios show how you can use the DXButton class:
Master-Detail View with BottomSheet Control
Infinite Collection View Scrolling
Display Filtering UI Elements in a BottomSheet
Show 14 items
Microsoft.Maui.Controls.ITabStopElement
Microsoft.Maui.IFrameworkElement
Show 16 items
System.Object BindableObject Element NavigableElement VisualElement View DevExpress.Maui.Core.Internal.DXViewElement DevExpress.Maui.Core.Internal.DXViewBaseCore DXViewBase DXBorder DXContentPresenterBase DXContentPresenter DXButtonBase DXButton DXToggleButton
See Also