Plugin.Maui.SegmentedControl
2.0.0
dotnet add package Plugin.Maui.SegmentedControl --version 2.0.0
NuGet\Install-Package Plugin.Maui.SegmentedControl -Version 2.0.0
<PackageReference Include="Plugin.Maui.SegmentedControl" Version="2.0.0" />
<PackageVersion Include="Plugin.Maui.SegmentedControl" Version="2.0.0" />
<PackageReference Include="Plugin.Maui.SegmentedControl" />
paket add Plugin.Maui.SegmentedControl --version 2.0.0
#r "nuget: Plugin.Maui.SegmentedControl, 2.0.0"
#:package Plugin.Maui.SegmentedControl@2.0.0
#addin nuget:?package=Plugin.Maui.SegmentedControl&version=2.0.0
#tool nuget:?package=Plugin.Maui.SegmentedControl&version=2.0.0
Plugin.Maui.SegmentedControl
.NET MAUI Port of Alex Rainman XF Segmented control https://github.com/alexrainman/SegmentedControl
Setup
- Available on NuGet: https://www.nuget.org/packages/Plugin.Maui.SegmentedControl/
Platform Support
| Platform | Supported | Version | Renderer |
|---|---|---|---|
| iOS Unified | Yes | iOS 8.1+ | UISegmentedControl |
| Android | Yes | API 18+ | RadioGroup |
| Mac OS | Yes | 11.0+ | UISegmentedControl |
Screenshot
Usage
In your MaiuProgram file call:
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.UseSegmentedControl();
XAML
xmlns:controls="clr-namespace:Plugin.Maui.SegmentedControl;assembly=Plugin.Maui.SegmentedControl"
<controls:SegmentedControl x:Name="SegControl" TintColor="#007AFF" SelectedSegment="0">
<controls:SegmentedControl.Children>
<controls:SegmentedControlOption Text="Tab 1" />
<controls:SegmentedControlOption Text="Tab 2" />
<controls:SegmentedControlOption Text="Tab 3" />
<controls:SegmentedControlOption Text="Tab 4" />
</controls:SegmentedControl.Children>
</controls:SegmentedControl>
<StackLayout x:Name="SegContent">
</StackLayout>
Event handler
public void Handle_ValueChanged(object o, int e)
{
SegContent.Children.Clear();
switch (e)
{
case 0:
SegContent.Children.Add(new Label() { Text="Tab 1 selected" });
break;
case 1:
SegContent.Children.Add(new Label() { Text = "Tab 2 selected" });
break;
case 2:
SegContent.Children.Add(new Label() { Text = "Tab 3 selected" });
break;
case 3:
SegContent.Children.Add(new Label() { Text = "Tab 4 selected" });
break;
}
}
Bindable Properties
TintColor: Fill color for the control (Color, default #007AFF)
SelectedTextColor: Selected segment text color (Color, default #FFFFFF)
TextColor: Text color for unselected segments (Color, default #000000)
SelectedSegment: Selected segment index (int, default 0)
FontSize: Font size for segment text (double, default 14.0)
Padding: Padding for segment content (Thickness, default 0)
DisabledBackgroundColor: Background color for disabled unselected segments (Color, default Gray)
DisabledTextColor: Text color for disabled segments (Color, default Gray)
DisabledTintColor: Tint color for disabled selected segments (Color, default Gray)
Event Handlers
ValueChanged: Called when a segment is selected.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-android36.0 is compatible. net10.0-browser was computed. net10.0-ios was computed. net10.0-ios26.0 is compatible. net10.0-maccatalyst was computed. net10.0-maccatalyst26.0 is compatible. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Maui.Controls (>= 10.0.10)
-
net10.0-android36.0
- Microsoft.Maui.Controls (>= 10.0.10)
-
net10.0-ios26.0
- Microsoft.Maui.Controls (>= 10.0.10)
-
net10.0-maccatalyst26.0
- Microsoft.Maui.Controls (>= 10.0.10)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Updated to .net 10