menu

MAUI

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

    Show / Hide Table of Contents

    Class ToggleButton

    Represents the ToggleButton class.

    Inheritance
    System.Object
    SfView
    ToggleButton
    SfCheckBox
    SfRadioButton
    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
    SfView.ArrangeContent(Rect)
    SfView.ArrangeOverride(Rect)
    SfView.Children
    SfView.ClipToBounds
    SfView.GetSemanticsNodesCore(Double, Double)
    SfView.IDrawableLayout.DrawingOrder
    SfView.IDrawableLayout.InvalidateDrawable()
    SfView.MeasureContent(Double, Double)
    SfView.MeasureOverride(Double, Double)
    SfView.OnBindingContextChanged()
    SfView.OnDraw(ICanvas, RectF)
    SfView.OnHandlerChanged()
    Namespace: Syncfusion.Maui.Buttons
    Assembly: Syncfusion.Maui.Buttons.dll
    Syntax
    public abstract class ToggleButton : SfView, IDrawableLayout, IDrawable, IAbsoluteLayout, ILayout, IView, IElement, ITransform, IContainer, IList<IView>, ICollection<IView>, IEnumerable<IView>, IEnumerable, ISafeAreaView, IPadding, ICrossPlatformLayout, IVisualTreeElement, ISemanticsProvider, ITextElement

    Constructors

    ToggleButton()

    Initializes a new instance of the ToggleButton class.

    Declaration
    public ToggleButton()

    Fields

    CheckedColorProperty

    Backing store for CheckedColor property.

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

    ContentSpacingProperty

    Gets or sets the ContentSpacing for ToggleButton. This is a Bindable property.

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

    ControlSizeProperty

    Backing store for Control size property.

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

    EnabledAnimationProperty

    Gets or sets the EnabledAnimation for ToggleButton. This is a Bindable property.

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

    FlowDirectionProperty

    Backing store for FlowDirection property.

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

    FontAttributesProperty

    Gets or sets a value that indicates whether the font for the Text is bold, italic, or neither.

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

    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

    Gets or sets the font family to which the font for theText belongs.

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

    FontSizeProperty

    Gets or sets the size of the font for Text.

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

    HorizontalTextAlignmentProperty

    Backing store for HorizontalTextAlignment property.

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

    IsEnabledProperty

    Backing store for IsEnabledProperty.

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

    PaddingProperty

    Identifies the Padding bindable property.

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

    StrokeThicknessProperty

    Backing store for StrokeThickness property.

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

    TextColorProperty

    Backing store for TextColor property.

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

    TextProperty

    Backing store for Text property.

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

    UncheckedColorProperty

    Backing store for UnCheckedColor property.

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

    Properties

    CheckedColor

    Gets or sets the fill color of the ToggleButton when the CheckedColor property value is changed.

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

    ContentSpacing

    Gets or sets a value that can be used to customize the gap between the toggle button and text. 

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

    It accepts double values and the default value is 13.

    ControlSize

    Gets or sets the value that can be used to customize the size of the control.

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

    The default value is 18.

    EnabledAnimation

    Gets or sets a value indicating whether to enable animation.

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

    It accepts Boolean values and the default values is true.

    FlowDirection

    Gets or sets the value of FlowDirection.

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

    FontAttributes

    Gets or sets a value that indicates whether the font for the Text is bold, italic, or neither.

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

    FontAutoScalingEnabled

    Gets or sets a value that Determines whether or not the font of the control should scale automatically according to the operating system settings.

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

    It accepts Boolean values, and the default value is false.

    FontFamily

    Gets or sets the font used to display text in the control.

    Declaration
    public string FontFamily { get; set; }
    Property Value
    Type
    System.String

    FontSize

    Gets or sets the size of the text in this control.

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

    HorizontalTextAlignment

    Gets or sets the horizontal alignment of the text in this content.

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

    IsEnabled

    Gets or sets the value of IsEnabled.

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

    Padding

    Gets or sets a value that can be used to adjust the padding for the Control.

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

    It accepts a Thickness value, allowing customization of left, top, right, and bottom padding. The default value is 13,0,0,0.

    StrokeThickness

    Gets or sets the stroke thickness for the ToggleButton. The stroke thickness will be visible only if the stroke is not set to transparent.

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

    Text

    Gets or sets the Text.

    Declaration
    public string Text { get; set; }
    Property Value
    Type
    System.String

    TextColor

    Gets or sets the color of the text in this control.

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

    UncheckedColor

    Gets or sets the stroke color of the ToggleButton when the UnCheckedColor property value is changed.

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

    Events

    StateChanged

    Event handles when value of the IsChecked property changed.

    Declaration
    public event EventHandler<StateChangedEventArgs> StateChanged
    Event Type
    Type
    System.EventHandler<StateChangedEventArgs>

    StateChanging

    Occurs when the state is changing in SfCheckBox

    Declaration
    public event EventHandler<StateChangingEventArgs> StateChanging
    Event Type
    Type
    System.EventHandler<StateChangingEventArgs>

    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