menu

MAUI

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

    Show / Hide Table of Contents

    Class BaseToolbarItem

    Represents the BaseToolbarItem class.

    Inheritance
    System.Object
    BaseToolbarItem
    SeparatorToolbarItem
    SfToolbarItem
    Namespace: Syncfusion.Maui.Toolbar
    Assembly: Syncfusion.Maui.Toolbar.dll
    Syntax
    public abstract class BaseToolbarItem : Element

    Constructors

    BaseToolbarItem()

    Declaration
    protected BaseToolbarItem()

    Fields

    AlignmentProperty

    Identifies the Alignment bindable property.

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

    Gets or sets the value for alignment of the toolbar items.

    Properties

    Alignment

    Gets or sets the value for alignment of the toolbar items.

    Declaration
    public ToolbarItemAlignment Alignment { get; set; }
    Property Value
    Type
    ToolbarItemAlignment
    Examples

    The below example shows how to use the alignment property.

    • XAML
    • C#
    • C#
    <ContentPage.BindingContext>
        <local:ToolbarViewModel/>
    </ContentPage.BindingContext>
    <toolbar:SfToolbar x:Name="Toolbar"
                   HeightRequest="56"
                   Items="{Binding ToolbarItems}">
    </toolbar:SfToolbar>
    public class ToolbarViewModel
    {
        public ObservableCollection<BaseToolbarItem> ToolbarItems { get; set; }
        public ToolbarViewModel()
        {
            ToolbarItems = new ObservableCollection<BaseToolbarItem>()
            {
                new SfToolbarItem() { Alignment = ToolbarItemAlignment.Start, Icon = new FontImageSource() { Glyph = "\uE713", FontFamily = "MaterialAssets" }, Text = "Start Item" },
                new SeparatorToolbarItem() { Alignment = ToolbarItemAlignment.Start },
                new SfToolbarItem() { Alignment = ToolbarItemAlignment.Center, Icon = new FontImageSource() { Glyph = "\uE714", FontFamily = "MaterialAssets" }, Text = "Center Item" },
                new SeparatorToolbarItem() { Alignment = ToolbarItemAlignment.Center },
                new SfToolbarItem() { Alignment = ToolbarItemAlignment.End, Icon = new FontImageSource() { Glyph = "\uE715", FontFamily = "MaterialAssets" }, Text = "End Item" },
                new SeparatorToolbarItem() { Alignment = ToolbarItemAlignment.End },
            };
        }
    }
    SfToolbar toolbar = new SfToolbar();
    ToolbarViewModel viewModel = new ToolbarViewModel();
    toolbar.HeightRequest = 56;
    toolbar.Items = viewModel.ToolbarItems;
    toolbar.Orientation = ToolbarOrientation.Horizontal;
    this.Content = toolbar;
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved