Class BaseToolbarItem
Inheritance
System.Object
BaseToolbarItem
Assembly: Syncfusion.Maui.Toolbar.dll
public abstract class BaseToolbarItem : Element
Constructors
Declaration
protected BaseToolbarItem()
Fields
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
Gets or sets the value for alignment of the toolbar items.
Declaration
public ToolbarItemAlignment Alignment { get; set; }
Property Value
The below example shows how to use the alignment property.
<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