Plugin.Maui.SegmentedControl 1.0.8

dotnet add package Plugin.Maui.SegmentedControl --version 1.0.8                
NuGet\Install-Package Plugin.Maui.SegmentedControl -Version 1.0.8                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Plugin.Maui.SegmentedControl" Version="1.0.8" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Plugin.Maui.SegmentedControl --version 1.0.8                
#r "nuget: Plugin.Maui.SegmentedControl, 1.0.8"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Plugin.Maui.SegmentedControl as a Cake Addin
#addin nuget:?package=Plugin.Maui.SegmentedControl&version=1.0.8

// Install Plugin.Maui.SegmentedControl as a Cake Tool
#tool nuget:?package=Plugin.Maui.SegmentedControl&version=1.0.8                

Plugin.Maui.SegmentedControl

.NET MAUI Port of Alex Rainman XF Segmented control https://github.com/alexrainman/SegmentedControl

Setup

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

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)

SelectedSegment: Selected segment index (int, default 0).

Event Handlers

ValueChanged: Called when a segment is selected.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-android34.0 is compatible.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-ios17.2 is compatible.  net8.0-maccatalyst was computed.  net8.0-maccatalyst17.2 is compatible.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.
  • net8.0-android34.0

    • No dependencies.
  • net8.0-ios17.2

    • No dependencies.
  • net8.0-maccatalyst17.2

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.8 6,599 2/26/2024
1.0.7 1,508 11/30/2023
1.0.6 925 10/5/2023
1.0.5 158 10/3/2023
1.0.4 132 10/2/2023
1.0.3 1,182 8/2/2023
1.0.2 152 8/2/2023
1.0.1 132 8/2/2023
1.0.0 151 8/2/2023 1.0.0 is deprecated because it is no longer maintained.

Fixed crash on Android when SelectedSegmented="-1" (deselected)