menu

MAUI

  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class SfButton - MAUI API Reference | Syncfusion

    Show / Hide Table of Contents

    Class SfButton

    Represents the SfButton class.

    Inheritance
    System.Object
    SfView
    ButtonBase
    SfButton
    Implements
    IDrawableLayout
    Microsoft.Maui.Graphics.IDrawable
    Microsoft.Maui.IAbsoluteLayout
    Microsoft.Maui.ILayout
    Microsoft.Maui.IView
    Microsoft.Maui.IElement
    Microsoft.Maui.ITransform
    Microsoft.Maui.IContainer
    System.Collections.Generic.IList<Microsoft.Maui.IView>
    System.Collections.Generic.ICollection<Microsoft.Maui.IView>
    System.Collections.Generic.IEnumerable<Microsoft.Maui.IView>
    System.Collections.IEnumerable
    Microsoft.Maui.ISafeAreaView
    Microsoft.Maui.IPadding
    Microsoft.Maui.ICrossPlatformLayout
    Microsoft.Maui.IVisualTreeElement
    Inherited Members
    ButtonBase.BackgroundImageSource
    ButtonBase.BackgroundImageSourceProperty
    ButtonBase.Clicked
    ButtonBase.Command
    ButtonBase.CommandParameter
    ButtonBase.CommandParameterProperty
    ButtonBase.CommandProperty
    ButtonBase.EnableRippleEffect
    ButtonBase.EnableRippleEffectProperty
    ButtonBase.FontAttributes
    ButtonBase.FontAttributesProperty
    ButtonBase.FontAutoScalingEnabled
    ButtonBase.FontAutoScalingEnabledProperty
    ButtonBase.FontFamily
    ButtonBase.FontFamilyProperty
    ButtonBase.FontSize
    ButtonBase.FontSizeProperty
    ButtonBase.HorizontalTextAlignment
    ButtonBase.HorizontalTextAlignmentProperty
    ButtonBase.ImageAlignment
    ButtonBase.ImageAlignmentProperty
    ButtonBase.ImageSize
    ButtonBase.ImageSizeProperty
    ButtonBase.ImageSource
    ButtonBase.ImageSourceProperty
    ButtonBase.OnPropertyChanged(String)
    ButtonBase.Padding
    ButtonBase.PaddingProperty
    ButtonBase.ShowIcon
    ButtonBase.ShowIconProperty
    ButtonBase.Stroke
    ButtonBase.StrokeProperty
    ButtonBase.Text
    ButtonBase.TextProperty
    ButtonBase.VerticalTextAlignment
    ButtonBase.VerticalTextAlignmentProperty
    SfView.ArrangeOverride(Rect)
    SfView.Children
    SfView.ClipToBounds
    SfView.IDrawableLayout.DrawingOrder
    SfView.IDrawableLayout.InvalidateDrawable()
    SfView.MeasureOverride(Double, Double)
    SfView.OnBindingContextChanged()
    Namespace: Syncfusion.Maui.Buttons
    Assembly: Syncfusion.Maui.Buttons.dll
    Syntax
    public class SfButton : ButtonBase, IDrawableLayout, IDrawable, IAbsoluteLayout, ILayout, IView, IElement, ITransform, IContainer, IList<IView>, ICollection<IView>, IEnumerable<IView>, IEnumerable, ISafeAreaView, IPadding, ICrossPlatformLayout, IVisualTreeElement, ISemanticsProvider, ITouchListener, ITapGestureListener, IGestureListener, ITextElement, IParentThemeElement, IThemeElement

    Constructors

    SfButton()

    Initializes a new instance of the SfButton class.

    Declaration
    public SfButton()

    Fields

    BackgroundProperty

    Gets or sets the value of BackgroundColor.This property can be used to give Background Color to Button control.This is a bindable property.

    Declaration
    public static readonly BindableProperty BackgroundProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty

    ContentProperty

    Identifies the Content property. This property can be used to set custom view to the button control.

    Declaration
    public static readonly BindableProperty ContentProperty
    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

    DashArrayProperty

    Identifies the DashArray bindable property.This property can be used to change the type of Border.

    Declaration
    public static readonly BindableProperty DashArrayProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    IsCheckableProperty

    Identifies the IsCheckable property. This property can be used to change the state of the SfButton.

    Declaration
    public static readonly BindableProperty IsCheckableProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    IsCheckedProperty

    Identifies the IsChecked property. It indicates whether the Sfbutton is in the default state .

    Declaration
    public static readonly BindableProperty IsCheckedProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    LineBreakModeProperty

    Gets or sets the value of LineBreakMode. This property can be used to change the text visibility. This is a bindable property.

    Declaration
    public static readonly BindableProperty LineBreakModeProperty
    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 SfButton control.This is Bindable Property

    Declaration
    public static readonly BindableProperty TextColorProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty

    TextTransformProperty

    Specifies the text transformation options for text processing

    Declaration
    public static readonly BindableProperty TextTransformProperty
    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 Button control.

    Declaration
    public Brush Background { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.Brush

    Specifies the background color.The default value is null .

    Content

    Gets or sets the value of the Content. This property can be used to set custom view to the button control.

    Declaration
    public DataTemplate Content { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.DataTemplate

    The content of border.

    CornerRadius

    Gets or sets the value of corner radius.This property can be used to customize the corners of button control.

    Declaration
    public CornerRadius CornerRadius { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.CornerRadius

    Specifies the corner radius.The default value is cornerradius(28).

    DashArray

    Gets or sets the value of dash of the border.This property can be used to customize the dash of border.

    Declaration
    public float[] DashArray { get; set; }
    Property Value
    Type Description
    System.Single[]

    The dash array of the border.

    IsCheckable

    Gets or sets a value indicating whether the SfButton is in the default state or not. This property can be used to change the state of the SfButton.

    Declaration
    public bool IsCheckable { get; set; }
    Property Value
    Type Description
    System.Boolean

    Specifies the ischeckable property.The default value is false.

    IsChecked

    Gets or sets a value indicating whether the Sfbutton is checkable. It is used to check the state of the SfButton.

    Declaration
    public bool IsChecked { get; set; }
    Property Value
    Type Description
    System.Boolean

    Specifies the ischecked property.The default value is false.

    LineBreakMode

    Gets or sets the value of line breakmode.This property can be used to customize the LineBreakMode of text.

    Declaration
    public LineBreakMode LineBreakMode { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.LineBreakMode

    Specifies the lineBreak mode.The default value is LineBreakMode.WordWrap.

    StrokeThickness

    Gets or sets the value of BorderThickness.This property can be used to give border thickness to button control

    Declaration
    public double StrokeThickness { get; set; }
    Property Value
    Type Description
    System.Double

    Specifies the stroke thickness.The default value is 0d.

    TextColor

    Gets or sets the value of Text Color.This property can be used to give Text Color to the text in SfButton control.

    Declaration
    public Color TextColor { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Graphics.Color

    Specifies the text color.The default value is Colors.White.

    TextTransform

    Gets or sets the value of TextTransform.This property is used to specify the text transformation options for text processing

    Declaration
    public TextTransform TextTransform { get; set; }
    Property Value
    Type
    Microsoft.Maui.TextTransform

    Methods

    ArrangeContent(Rect)

    Arrange content method.

    Declaration
    protected override Size ArrangeContent(Rect bounds)
    Parameters
    Type Name Description
    Microsoft.Maui.Graphics.Rect bounds
    Returns
    Type Description
    Microsoft.Maui.Graphics.Size

    the size.

    Overrides
    SfView.ArrangeContent(Rect)

    ChangeVisualState()

    To change the visual state of the ButtonBase control.

    Declaration
    protected override void ChangeVisualState()
    Overrides
    ButtonBase.ChangeVisualState()

    DrawOutline(ICanvas, RectF)

    Draws an outline on the provided canvas for the current view.

    Declaration
    protected override void DrawOutline(ICanvas canvas, RectF dirtyRect)
    Parameters
    Type Name Description
    Microsoft.Maui.Graphics.ICanvas canvas

    The canvas on which the outline will be drawn.

    Microsoft.Maui.Graphics.RectF dirtyRect

    The area to be updated on the canvas (dirty rectangle).

    Overrides
    ButtonBase.DrawOutline(ICanvas, RectF)

    Finalize()

    Destructor of the SfButton class.

    Declaration
    protected override void Finalize()
    Overrides
    ButtonBase.Finalize()

    GetSemanticsNodesCore(Double, Double)

    Returns the semantics node list

    Declaration
    protected override List<SemanticsNode> GetSemanticsNodesCore(double width, double height)
    Parameters
    Type Name Description
    System.Double width
    System.Double height
    Returns
    Type
    System.Collections.Generic.List<Syncfusion.Maui.Graphics.Internals.SemanticsNode>
    Overrides
    SfView.GetSemanticsNodesCore(Double, Double)

    MeasureContent(Double, Double)

    Measure content method.

    Declaration
    protected override Size MeasureContent(double widthConstraint, double heightConstraint)
    Parameters
    Type Name Description
    System.Double widthConstraint
    System.Double heightConstraint
    Returns
    Type
    Microsoft.Maui.Graphics.Size
    Overrides
    ButtonBase.MeasureContent(Double, Double)

    OnDraw(ICanvas, RectF)

    Drawing methods of button control.

    Declaration
    protected override void OnDraw(ICanvas canvas, RectF dirtyRect)
    Parameters
    Type Name Description
    Microsoft.Maui.Graphics.ICanvas canvas

    The canvas.

    Microsoft.Maui.Graphics.RectF dirtyRect

    The rect

    Overrides
    ButtonBase.OnDraw(ICanvas, RectF)

    OnHandlerChanged()

    Declaration
    protected override void OnHandlerChanged()
    Overrides
    ButtonBase.OnHandlerChanged()

    Implements

    IDrawableLayout
    Microsoft.Maui.Graphics.IDrawable
    Microsoft.Maui.IAbsoluteLayout
    Microsoft.Maui.ILayout
    Microsoft.Maui.IView
    Microsoft.Maui.IElement
    Microsoft.Maui.ITransform
    Microsoft.Maui.IContainer
    System.Collections.Generic.IList<>
    System.Collections.Generic.ICollection<>
    System.Collections.Generic.IEnumerable<>
    System.Collections.IEnumerable
    Microsoft.Maui.ISafeAreaView
    Microsoft.Maui.IPadding
    Microsoft.Maui.ICrossPlatformLayout
    Microsoft.Maui.IVisualTreeElement
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved