.NET MAUI Label ToolbarItem
Add labels in the toolbar using the LabelToolbarItem
.
The available properties for configuration are:
-
Text
(string
)—Defines the text(target typeLabel
) in the toolbar item. You can display an image next to the text. -
ImageSource
(Microsoft.Maui.Controls.ImageSource
)—Specifies the source of the image to display in the toolbar item.
Styling
You can style the LabelToolbarItem
using the Style
property. The target type of the property is LabelToolbarItemView
.
The available properties are:
-
Text
(string
)—Specifies the text in the toolbar item. -
TextColor
(Microsoft.Maui.Graphics.Color
)—Specifies the color of the text in the toolbar item. -
FontFamily
(string
)—Specifies the font family of the text to display in the toolbar item. -
FontSize
(double
)—Specifies the font size of the text to display in the toolbar item. Default value is16
. -
FontAttributes
(enum of typeMicrosoft.Maui.Controls.FontAttributes
)—Defines the font attributes of the text to display in the toolbar item. Default value isNone
. -
TextDecorations
(enum of typeMicrosoft.Maui.TextDecorations
)—Defines the decorations of the text to display in the toolbar item. Default value isNone
. -
HorizontalTextAlignment
(enum of typeMicrosoft.Maui.TextAlignment
)—Defines the horizontal alignment of the text to display in the toolbar item. The default value isStart
. -
VerticalTextAlignment
(enum of typeMicrosoft.Maui.TextAlignment
)—Defines the vertical alignment of the text to display in the toolbar item. Default value isCenter
. -
ImageSource
(Microsoft.Maui.Controls.ImageSource
)—Defines the source of the image displayed in the in the toolbar item. -
ImageAspect
(enum of typeMicrosoft.Maui.Aspect
)—Defines the aspect ratio of the image displayed in the in the toolbar item. Default value isCenter
. -
ImageWidth
(double
)—Defines the width in pixels of the image displayed in the in the toolbar item. Default value is-1.0
. -
ImageHeight
(double
)—Defines the height in pixels of the image displayed in the in the toolbar item. Default value is-1.0
. -
ImageSpacing
(double
)—Defines the spacing in pixels between the image and the text displayed in the in the toolbar item. Default value is8.0
. -
DisplayOptions
(enum of typeTelerik.Maui.Controls.ToolbarItemDisplayOptions
) property allows you to display text, image in the toolbar or in a combination of both. The options areText
andImage
. This enum type supports a bitwise combination of its members to enable more than one option.Position the image relative to the text in the toolbar item by setting the
ImagePosition
(enum of typeTelerik.Maui.Controls.ToolbarItemImagePosition
). The available options are:-
Left
—The image is displayed to the left of the text. -
Top
—The image is displayed at the top of the text. -
Right
—The image is displayed to the right of the text. -
Bottom
—The image is displayed at the bottom of the text.
-
HorizontalContentOptions
(enum of typeMicrosoft.Maui.Controls.LayoutOptions
)—Specifies the horizontal alignment options of the content displayed in the toolbar item.-
VerticalContentOptions
(enum of typeMicrosoft.Maui.Controls.LayoutOptions
)—Specifies the vertical alignment options of the content displayed in the toolbar item.
All other properties that can be applied through style are the properties applicable for ToolbarItemView.