Class ButtonBase
Represents the ButtonBase class.
Implements
Namespace: Syncfusion.Maui.Toolkit
Assembly: Syncfusion.Maui.Toolkit.dll
Syntax
public abstract class ButtonBase : SfView, IDrawableLayout, IDrawable, IAbsoluteLayout, ILayout, IView, IElement, ITransform, IContainer, IList<IView>, ICollection<IView>, IEnumerable<IView>, IEnumerable, ISafeAreaView, IPadding, ICrossPlatformLayout, IVisualTreeElement, ISemanticsProvider, ITouchListener, ITextElement, ITapGestureListener, IGestureListener
Constructors
ButtonBase()
Initializes a new instance of the ButtonBase class.
Declaration
public ButtonBase()
Fields
BackgroundImageSourceProperty
Identifies the BackgroundImageSource property. This property can be used to set an image as the background of ButtonBase.
Declaration
public static readonly BindableProperty BackgroundImageSourceProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
This Microsoft.Maui.Controls.BindableProperty is read-only.
BackgroundProperty
Gets or sets the value of BackgroundColor.This property can be used to give Background Color to ButtonBase control.This is a bindable property.
Declaration
public static readonly BindableProperty BackgroundProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
CommandParameterProperty
Identifies the CommandParameter bindable property. It is a parameter to pass to the Command property. This is a bindable property.
Declaration
public static readonly BindableProperty CommandParameterProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
This bindable property is read-only.
CommandProperty
Identifies the Command bindable property. It invokes when the ButtonBase is activated. The default value is null.
Declaration
public static readonly BindableProperty CommandProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
This bindable property is read-only.
CornerRadiusProperty
Gets or sets the value of CornerRadius. This property can be used to change the corner radius. This is a bindable property.
Declaration
public static readonly BindableProperty CornerRadiusProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
EnableRippleEffectProperty
Identifies the EnableRippleEffect property. This property can be used to enable ripple effect of ButtonBase.
Declaration
public static readonly BindableProperty EnableRippleEffectProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
This Microsoft.Maui.Controls.BindableProperty is read-only.
FontAttributesProperty
Identifies the FontAttributes property. This property can be used to change the font of text to either bold or italic.
Declaration
public static readonly BindableProperty FontAttributesProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
This Microsoft.Maui.Controls.BindableProperty is read-only.
FontAutoScalingEnabledProperty
Identifies the FontAutoScalingEnabled bindable property.
Declaration
public static readonly BindableProperty FontAutoScalingEnabledProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for FontAutoScalingEnabled bindable property. |
FontFamilyProperty
Identifies the FontFamily property. This property can be used to change the font family of the text in ButtonBase.
Declaration
public static readonly BindableProperty FontFamilyProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
This Microsoft.Maui.Controls.BindableProperty is read-only.
FontSizeProperty
Gets or sets the value of FontSize.This property can be used to give FontSize to the Text in ButtonBase control.This is Bindable Property.
Declaration
public static readonly BindableProperty FontSizeProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
HorizontalTextAlignmentProperty
Gets or sets the value of HorizontalTextAlignment.This property can be used to give HorizontalTextAlignment to the Text in ButtonBase control.This is Bindable Property
Declaration
public static readonly BindableProperty HorizontalTextAlignmentProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
ImageAlignmentProperty
Identifies the ImageAlignment property. This property can be used to change the position of the image in the ButtonBase control.
Declaration
public static readonly BindableProperty ImageAlignmentProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
This Microsoft.Maui.Controls.BindableProperty is read-only.
ImageSizeProperty
Identifies the ImageSize bindable property. This property can be used to customize the width of an imgage in the ButtonBase control.
Declaration
public static readonly BindableProperty ImageSizeProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
This Microsoft.Maui.Controls.BindableProperty is read-only.
ImageSourceProperty
Identifies the ImageSource property. This property can be used to set an source of an image.This is Bindable Property.
Declaration
public static readonly BindableProperty ImageSourceProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
PaddingProperty
Identifies the Padding property. This property can be used to set padding to the sides of ButtonBase.
Declaration
public static readonly BindableProperty PaddingProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
This Microsoft.Maui.Controls.BindableProperty is read-only.
ShowIconProperty
Identifies the ShowIcon property. This property can be used to set an icon by setting this property to true.This is Bindable Property.
Declaration
public static readonly BindableProperty ShowIconProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
StrokeProperty
Gets or sets the value of Stroke.This property can be used to give border Color to ButtonBase control.This is a bindable property.
Declaration
public static readonly BindableProperty StrokeProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
StrokeThicknessProperty
Gets or sets the value of BorderThickness.This property can be used to give border thickness to ButtonBase control.This is a bindable property.
Declaration
public static readonly BindableProperty StrokeThicknessProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
TextColorProperty
Gets or sets the value of Text Color.This property can be used to give Text Color to the text in the ButtonBase control.This is Bindable Property
Declaration
public static readonly BindableProperty TextColorProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
TextProperty
Gets or sets the value of Text.This property can be used to give Text to the ButtonBase control.This is Bindable Property.
Declaration
public static readonly BindableProperty TextProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
VerticalTextAlignmentProperty
Gets or sets the value of VerticalTextAlignment.This property can be used to give VerticalTextAlignment to the Text in ButtonBase control.This is Bindable Property
Declaration
public static readonly BindableProperty VerticalTextAlignmentProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Properties
Background
Gets or sets the value of BackgroundColor.This property can be used to give Background Color to the ButtonBase control.
Declaration
public Brush Background { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Controls.Brush | Specifies the background color.The default value is null . |
BackgroundImageSource
Gets or sets the value of the BackgroundImageSource. This property can be used to set an image as the background of ButtonBase.
Declaration
public ImageSource BackgroundImageSource { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Controls.ImageSource | Specifies the background image source.The default value is null. |
Command
Gets or sets the value of the Command. It invokes when the ButtonBase is activated. It is a bindable property.
Declaration
public ICommand Command { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Input.ICommand | Specifies the command. |
CommandParameter
Gets or sets the value of the CommandParameter, which is a parameter to pass the Command property. This is a bindable property.
Declaration
public object CommandParameter { get; set; }
Property Value
Type | Description |
---|---|
System.Object | Specifies the command parameter. |
CornerRadius
Gets or sets the value of corner radius.This property can be used to customize the corners of ButtonBase control.
Declaration
public CornerRadius CornerRadius { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.CornerRadius | Specifies the corner radius.The default value is cornerradius(8). |
EnableRippleEffect
Gets or sets a value indicating whether the ripple effect of ButtonBase is enabled or not.
Declaration
public bool EnableRippleEffect { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | Specifies the Enable ripple effect property. The default value is true. |
FontAttributes
Gets or sets the value of FontAttributes. This property can be used to change the font of text in either bold or italic.
Declaration
public FontAttributes FontAttributes { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Controls.FontAttributes | Specifies the font attributes.The default value is Microsoft.Maui.Controls.FontAttributes.None |
FontAutoScalingEnabled
Enables automatic font size adjustment based on device settings.
Declaration
public bool FontAutoScalingEnabled { get; set; }
Property Value
Type |
---|
System.Boolean |
FontFamily
Gets or sets the value of the FontFamily. This property can be used to change the font family of the text in ButtonBase.
Declaration
public string FontFamily { get; set; }
Property Value
Type | Description |
---|---|
System.String | Specifies the font family.The default value is string.empty. |
FontSize
Gets or sets the value of FontSize.This property can be used to give FontSize to the Text in ButtonBase control.
Declaration
public double FontSize { get; set; }
Property Value
Type | Description |
---|---|
System.Double | Specifies the font size.The default value is 14d. |
HorizontalTextAlignment
Gets or sets the value of HorizontalTextAlignment.This property can be used to give HorizontalTextAlignment to the Text in ButtonBase control.
Declaration
public TextAlignment HorizontalTextAlignment { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.TextAlignment | Specifies the text alignment.The default value is Microsoft.Maui.TextAlignment.Center. |
ImageAlignment
Gets or sets the ImageAlignment for the Image.
Declaration
public Alignment ImageAlignment { get; set; }
Property Value
Type | Description |
---|---|
Alignment | Specifies the image alignment.The default value is Start. |
ImageSize
Gets or sets a value for the Image width
Declaration
public double ImageSize { get; set; }
Property Value
Type | Description |
---|---|
System.Double | Specifies the image width.The default value is 18. |
ImageSource
Gets or sets a value of the ImageSoure. This property can be used to set the source to an image.
Declaration
public ImageSource ImageSource { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Controls.ImageSource | Specifies the image source.The default value is null. |
Padding
Gets or sets the value of Padding. This property can be used to set padding to the sides of ButtonBase.
Declaration
public Thickness Padding { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Thickness | Specifies the padding.The default value is 2 for Android platform and 0 for other platform. |
ShowIcon
Gets or sets a value indicating whether the image icon of SfButton is visible or not. The icon is in visible state when this property is set to true.
Declaration
public bool ShowIcon { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | Specifies the show icon property.The default value is false. |
Stroke
Gets or sets the value of stroke.This property can be used to give border Color to ButtonBase control.
Declaration
public Brush Stroke { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Controls.Brush | Specifies the stroke.The default value is Color.FromArgb("#79747E"). |
StrokeThickness
Gets or sets the value of BorderThickness.This property can be used to give border thickness to ButtonBase control
Declaration
public double StrokeThickness { get; set; }
Property Value
Type | Description |
---|---|
System.Double | Specifies the stroke thickness.The default value is 1f. |
Text
Gets or sets the value of Text.This property can be used to give Text to the ButtonBase control.
Declaration
public string Text { get; set; }
Property Value
Type | Description |
---|---|
System.String | Specifies the text.The default value is string.Empty. |
TextColor
Gets or sets the value of Text Color.This property can be used to give Text Color to the text in Buttonbase control.
Declaration
public Color TextColor { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Graphics.Color | Specifies the text color.The default value is Color.FromArgb("#1C1B1F"). |
VerticalTextAlignment
Gets or sets the value of VerticalTextAlignment.This property can be used to give VerticalTextAlignment to the Text in ButtonBase control.
Declaration
public TextAlignment VerticalTextAlignment { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.TextAlignment | Specifies the text alignment.The default value is Microsoft.Maui.TextAlignment.Center. |
Methods
Finalize()
Destructor of the ButtonBase class.
Declaration
protected override void Finalize()
OnHandlerChanged()
Declaration
protected override void OnHandlerChanged()
Overrides
Events
Clicked
It represents the Clicked event handler. This clicked event is hooked when clicking the ButtonBase control.
Declaration
public event EventHandler<EventArgs> Clicked
Event Type
Type |
---|
System.EventHandler<System.EventArgs> |