SegmentedControl.Maui 1.0.2

dotnet add package SegmentedControl.Maui --version 1.0.2
                    
NuGet\Install-Package SegmentedControl.Maui -Version 1.0.2
                    
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="SegmentedControl.Maui" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SegmentedControl.Maui" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="SegmentedControl.Maui" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SegmentedControl.Maui --version 1.0.2
                    
#r "nuget: SegmentedControl.Maui, 1.0.2"
                    
#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.
#:package SegmentedControl.Maui@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SegmentedControl.Maui&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=SegmentedControl.Maui&version=1.0.2
                    
Install as a Cake Tool

SegmentedControl.Maui

NuGet

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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