.NET MAUI SplitButton ToolbarItem
Add a split button in the toolbar using the SplitButtonToolbarItem. The toolbar item inherits from the DropDownMenuButtonToolbarItem.
The exposed property is Items(of type IList<ToolbarItem>)—Read-only collection of ToolbarItems to display in the drop-down menu.
DropDownMenuButtonToolbarIteminherits fromDropDownButtonToolbarItem. You can apply all properties from theDropDownButtonToolbarItemto theSplitButtonToolbarItem. The properties are described in the DropDownButton ToolbarItem article.
<telerik:SplitButtonToolbarItem Text="Save As...">
<telerik:SplitButtonToolbarItem.Style>
<Style TargetType="telerik:SplitButtonToolbarItemView">
<Setter Property="DisplayOptions" Value="Text" />
<Setter Property="MinimumWidthRequest" Value="{OnIdiom Default=110, Phone=125}" />
</Style>
</telerik:SplitButtonToolbarItem.Style>
<telerik:ButtonToolbarItem Text="Save as TXT">
<telerik:ButtonToolbarItem.ImageSource>
<FontImageSource Glyph="{x:Static telerik:TelerikFont.IconFile}"
FontFamily="{x:Static telerik:TelerikFont.Name}"
Size="16" />
</telerik:ButtonToolbarItem.ImageSource>
</telerik:ButtonToolbarItem>
<telerik:ButtonToolbarItem Text="Save as DOCX">
<telerik:ButtonToolbarItem.ImageSource>
<FontImageSource Glyph="{x:Static telerik:TelerikFont.IconFile}"
FontFamily="{x:Static telerik:TelerikFont.Name}"
Size="16" />
</telerik:ButtonToolbarItem.ImageSource>
</telerik:ButtonToolbarItem>
<telerik:ButtonToolbarItem Text="Save as PDF">
<telerik:ButtonToolbarItem.ImageSource>
<FontImageSource Glyph="{x:Static telerik:TelerikFont.IconFile}"
FontFamily="{x:Static telerik:TelerikFont.Name}"
Size="16" />
</telerik:ButtonToolbarItem.ImageSource>
</telerik:ButtonToolbarItem>
</telerik:SplitButtonToolbarItem>
Styling
SplitButtonToolbarItem has Style property with target type SplitButtonToolbarItemView.
The properties that can be applied through style are the properties applicable for DropDownButtonToolbarItemView, ButtonToolbarItemView, ToolbarItemView and LabelToolbarItemView.
Here is an example of how to style the
SplitButtonToolbarItemand setting the visual states:
<Style TargetType="telerik:SplitButtonToolbarItemView" x:Key="splitButtonItemStyle">
<Setter Property="CornerRadius" Value="4" />
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<VisualState.Setters>
<Setter Property="TextColor" Value="#1188FF" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="PointerOver">
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="#E6F2FF" />
<Setter Property="TextColor" Value="#0A5CBF" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Property="TextColor" Value="#B0B0B0" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>