Vapolia.SegmentedViews 1.0.2

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Vapolia.SegmentedViews --version 1.0.2                
NuGet\Install-Package Vapolia.SegmentedViews -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="Vapolia.SegmentedViews" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Vapolia.SegmentedViews --version 1.0.2                
#r "nuget: Vapolia.SegmentedViews, 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.
// Install Vapolia.SegmentedViews as a Cake Addin
#addin nuget:?package=Vapolia.SegmentedViews&version=1.0.2

// Install Vapolia.SegmentedViews as a Cake Tool
#tool nuget:?package=Vapolia.SegmentedViews&version=1.0.2                

Vapolia.SegmentedViews

NuGet
Nuget
Publish To Nuget

dotnet add package Vapolia.SegmentedViews

builder.UseSegmentedView();

image image

Platforms:

  • Android
  • iOS

Supports both static segments and ItemsSource to build segments dynamically.

Quick start

Add the above nuget package to your Maui project
then add this line to your maui app builder:

using Vapolia.SegmentedViews;
...
builder.UseSegmentedView();

Examples

See the SampleApp in this repo.

Declare the namespace:

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
         ...
         xmlns:segmented="https://vapolia.eu/Vapolia.SegmentedViews">

Add a static segment view:

<segmented:SegmentedView  
    x:Name="TheSegmentView"
    SelectedIndex="0"
    SelectedTextColor="White" TextColor="Black" SelectedBackgroundColor="Blue" DisabledColor="LightGray"
    SelectionChangedCommand="{Binding SegmentSelectionChangedCommand}"
    SelectedItem="{Binding SegmentSelectedItem}">
    
    <segmented:Segment Item="Item1" />
    <segmented:Segment Item="Item2" />
    <segmented:Segment Item="Item3" />
    <segmented:Segment Item="Item4" />
    <segmented:Segment Item="{Binding Item5Title}" />
    
</segmented:SegmentedView>

Or a dynamic segment view:

        <segmented:SegmentedView
            ItemsSource="{Binding Persons}"
            TextPropertyName="LastName"
            SelectedIndex="0"
            SelectedItem="{Binding SegmentSelectedItem}"
            SelectedTextColor="White" TextColor="Black" SelectedBackgroundColor="Blue" DisabledColor="LightGray"
            SelectionChangedCommand="{Binding SegmentSelectionChangedCommand}" />

Width of segment items

The width of a segment can be set in the following 3 ways, in reverse order of priority:

  • On the ItemsDefaultWidth property of SegmentedView
<segmented:SegmentedView  
    x:Name="TheSegmentView"
    SelectedIndex="0"
    SelectedTextColor="White" TextColor="Black" SelectedBackgroundColor="Blue" DisabledColor="LightGray"
    SelectionChangedCommand="{Binding SegmentSelectionChangedCommand}"
    SelectedItem="{Binding SegmentSelectedItem}"
    ItemsDefaultWidth="150" />
  • On the ItemsWidthDefinitions property of SegmentedView
<segmented:SegmentedView  
    x:Name="TheSegmentView"
    SelectedIndex="0"
    SelectedTextColor="White" TextColor="Black" SelectedBackgroundColor="Blue" DisabledColor="LightGray"
    SelectionChangedCommand="{Binding SegmentSelectionChangedCommand}"
    SelectedItem="{Binding SegmentSelectedItem}"
    ItemsWidthDefinitions="150,Auto,*,2*">

This width follow the format of a Grid's ColumnsDefinition, so it should be straightforward to use.

  • Directly on the Width property of a Segment
<segmented:Segment Item="Item1" Width="150" />
<segmented:Segment Item="Item1" Width="Auto" />
Product Compatible and additional computed target framework versions.
.NET net8.0-android34.0 is compatible.  net8.0-ios17.2 is compatible. 
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.6 348 8/27/2024
1.0.5 128 8/15/2024
1.0.4 399 4/15/2024
1.0.3 124 3/31/2024
1.0.2 124 3/16/2024
1.0.1 126 3/14/2024
1.0.0 135 3/5/2024
1.0.0-ci8141352883 107 3/4/2024
1.0.0-ci8139282302 77 3/4/2024
1.0.0-ci8113045545 105 3/1/2024
1.0.0-ci8016228389 106 2/23/2024

1.0.1: Upgrade nugets. Remove dependency on maui compatibility.
1.0.0: Initial release