SegmentedControl.Maui
1.0.2
dotnet add package SegmentedControl.Maui --version 1.0.2
NuGet\Install-Package SegmentedControl.Maui -Version 1.0.2
<PackageReference Include="SegmentedControl.Maui" Version="1.0.2" />
<PackageVersion Include="SegmentedControl.Maui" Version="1.0.2" />
<PackageReference Include="SegmentedControl.Maui" />
paket add SegmentedControl.Maui --version 1.0.2
#r "nuget: SegmentedControl.Maui, 1.0.2"
#:package SegmentedControl.Maui@1.0.2
#addin nuget:?package=SegmentedControl.Maui&version=1.0.2
#tool nuget:?package=SegmentedControl.Maui&version=1.0.2
SegmentedControl.Maui
This plugin provides a customizable segmented control for .NET MAUI, supporting Android, iOS, and MacCatalyst platforms. It allows users to switch between different segments, useful in scenarios where multiple views or actions can be toggled.
Features
- Supports Android, iOS, and MacCatalyst.
- Customizable segments: Background, borders, and text styles can be customized.
- Smooth segment transitions.
- Native look and feel for each platform.
- No support for Windows yet (work in progress).
Installation
Install the plugin via NuGet:
dotnet add package SegmentedControl.Maui
Or use the NuGet package manager to search for SegmentedControl.Maui and install it into your .NET MAUI project.
Setup
- To use the segmented control, make sure to call UseSegmentedControl() in the MauiProgram.cs file:
using SegmentedControl.Maui; // Add the necessary using directive
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.UseSegmentedControl() // Register the segmented control here
....
return builder.Build();
}
}
Usage
You can add the segmented control in your XAML or C# code.
Example XAML
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:controls="clr-namespace:SegmentedControl.Maui;assembly=SegmentedControl.Maui"
x:Class="YourAppNamespace.MainPage">
<ContentPage.Content>
<VerticalStackLayout Padding="20">
<Label Text="Choose an option:"
FontSize="18"
HorizontalOptions="Center"
VerticalOptions="Start" />
<controls:SegmentedControl x:Name="red" Margin="10"
SelectedSegmentIndex="0"
BorderColor="Blue" BorderThickness="2"
BackgroundColor="lime" HorizontalOptions="Fill"
TextColor="Black" SegmentSelectedCommandParameter="{Binding .}"
SelectedItemBackgroundColor="Yellow"
SegmentSelectedCommand="{Binding MyCommand}">
<controls:Segment Text="Item 1" />
<controls:Segment Text="Itme 2" />
<controls:Segment Text="Itme 3" />
</controls:SegmentedControl>
</VerticalStackLayout>
</ContentPage.Content>
</ContentPage>
Same can be done using C# if required.
License
This project is licensed under the MIT License - see the LICENSE file for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0-android34.0 is compatible. net8.0-ios17.5 is compatible. net8.0-maccatalyst17.5 is compatible. net8.0-windows10.0.19041 is compatible. net9.0-android was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-windows was computed. net10.0-android was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-windows was computed. |
-
net8.0-android34.0
- Microsoft.Maui.Controls (>= 8.0.3)
-
net8.0-ios17.5
- Microsoft.Maui.Controls (>= 8.0.3)
-
net8.0-maccatalyst17.5
- Microsoft.Maui.Controls (>= 8.0.3)
-
net8.0-windows10.0.19041
- Microsoft.Maui.Controls (>= 8.0.3)
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.2 | 174 | 10/22/2024 |