Plugin.Maui.Pionexia.Rating 1.0.0

dotnet add package Plugin.Maui.Pionexia.Rating --version 1.0.0
                    
NuGet\Install-Package Plugin.Maui.Pionexia.Rating -Version 1.0.0
                    
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.Pionexia.Rating" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Plugin.Maui.Pionexia.Rating" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Plugin.Maui.Pionexia.Rating" />
                    
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 Plugin.Maui.Pionexia.Rating --version 1.0.0
                    
#r "nuget: Plugin.Maui.Pionexia.Rating, 1.0.0"
                    
#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 Plugin.Maui.Pionexia.Rating@1.0.0
                    
#: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=Plugin.Maui.Pionexia.Rating&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Plugin.Maui.Pionexia.Rating&version=1.0.0
                    
Install as a Cake Tool

Pionexia.Maui.Rating

NuGet NuGet Downloads License: MIT

A customizable rating control for .NET MAUI with support for half-stars, custom icons, tap and swipe gestures, animations, and RTL layouts.

Features

  • Configurable Star Count - Set any number of stars (default 5)
  • Half-Star Support - Allow half-star ratings (0, 0.5, 1, 1.5, etc.)
  • Tap to Rate - Simple tap interaction
  • Swipe/Drag to Rate - Smooth gesture-based rating
  • Read-Only Mode - Display ratings without user interaction
  • Custom Icons - Use your own images for filled, empty, and half-filled states
  • Customizable Colors - Configure filled, empty, and outline colors
  • Adjustable Size - Control star size and spacing
  • RTL Support - Full right-to-left layout support
  • Smooth Animations - Animated transitions on tap
  • MVVM Friendly - Full binding support with Command pattern
  • Cross-Platform - Works on Android, iOS, Mac Catalyst, and Windows

Installation

Install via NuGet Package Manager:

dotnet add package Pionexia.Maui.Rating

Or add the package reference to your .csproj:

<PackageReference Include="Pionexia.Maui.Rating" Version="1.0.0" />

Getting Started

1. Register the Control

In your MauiProgram.cs, add the following:

using Pionexia.Maui.Rating;

public static class MauiProgram
{
    public static MauiApp CreateMauiApp()
    {
        var builder = MauiApp.CreateBuilder();
        builder
            .UseMauiApp<App>()
            .UsePionexiaRating(); // Add this line

        return builder.Build();
    }
}

2. Add the Namespace

In your XAML page, add the namespace:

xmlns:rating="clr-namespace:Pionexia.Maui.Rating.Controls;assembly=Pionexia.Maui.Rating"

3. Use the Control

<rating:RatingControl
    Value="3.5"
    MaxValue="5"
    AllowHalfStars="True"
    FilledColor="Gold"
    ItemSize="40" />

Quick Start 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:rating="clr-namespace:Pionexia.Maui.Rating.Controls;assembly=Pionexia.Maui.Rating"
             x:Class="MyApp.MainPage">

    <VerticalStackLayout Padding="20" Spacing="20">

        
        <Label Text="Rate this product:" />
        <rating:RatingControl
            x:Name="ProductRating"
            Value="0"
            MaxValue="5"
            AllowHalfStars="True"
            FilledColor="#FFD700"
            EmptyColor="#E0E0E0"
            ItemSize="40"
            ItemSpacing="8" />

        
        <Label Text="{Binding Source={x:Reference ProductRating}, Path=Value, StringFormat='Rating: {0:F1}/5'}" />

    </VerticalStackLayout>

</ContentPage>

C# with ViewModel

using System.Windows.Input;
using Pionexia.Maui.Rating.Controls;

public class ProductViewModel : INotifyPropertyChanged
{
    private double _rating;

    public double Rating
    {
        get => _rating;
        set
        {
            _rating = value;
            OnPropertyChanged();
        }
    }

    public ICommand RatingChangedCommand { get; }

    public ProductViewModel()
    {
        RatingChangedCommand = new Command(() =>
        {
            // Handle rating change
            Debug.WriteLine($"New rating: {Rating}");
        });
    }

    // INotifyPropertyChanged implementation
    public event PropertyChangedEventHandler PropertyChanged;
    protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
    {
        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
    }
}
<rating:RatingControl
    Value="{Binding Rating}"
    Command="{Binding RatingChangedCommand}"
    MaxValue="5"
    AllowHalfStars="True" />

API Documentation

Properties

Property Type Default Description
Value double 0.0 The current rating value (supports two-way binding)
MaxValue int 5 Maximum rating value (number of stars)
AllowHalfStars bool true Whether half-star ratings are allowed
IsReadOnly bool false Whether the control is read-only (display only)
FilledColor Color #FFD700 (Gold) Color for filled stars
EmptyColor Color #E0E0E0 (Light Gray) Color for empty stars
OutlineColor Color Transparent Outline color for stars
ItemSize double 32.0 Size of each star in device-independent units
ItemSpacing double 4.0 Spacing between stars
FilledIcon ImageSource null Custom image for filled stars (uses default if null)
EmptyIcon ImageSource null Custom image for empty stars (uses default if null)
HalfFilledIcon ImageSource null Custom image for half-filled stars (uses default if null)
Command ICommand null Command executed when rating changes
CommandParameter object null Parameter passed to the command

Events

Event Type Description
ValueChanged EventHandler<ValueChangedEventArgs> Raised when the rating value changes

ValueChangedEventArgs

public class ValueChangedEventArgs : EventArgs
{
    public double OldValue { get; }
    public double NewValue { get; }
}

Customization Examples

Read-Only Display

Perfect for showing average ratings:

<rating:RatingControl
    Value="4.5"
    IsReadOnly="True"
    FilledColor="Orange"
    ItemSize="24" />

Custom Colors

<rating:RatingControl
    Value="3"
    FilledColor="#FF6B6B"
    EmptyColor="#4ECDC4"
    OutlineColor="#1A535C"
    ItemSize="48" />

Different Sizes


<rating:RatingControl Value="4" ItemSize="20" ItemSpacing="2" />


<rating:RatingControl Value="4" ItemSize="32" ItemSpacing="4" />


<rating:RatingControl Value="4" ItemSize="48" ItemSpacing="8" />

Custom Icons

<rating:RatingControl
    Value="3.5"
    AllowHalfStars="True"
    FilledIcon="heart_filled.png"
    HalfFilledIcon="heart_half.png"
    EmptyIcon="heart_empty.png"
    ItemSize="40" />

Custom Star Count


<rating:RatingControl
    Value="7.5"
    MaxValue="10"
    AllowHalfStars="True" />

With Command Binding

<rating:RatingControl
    Value="{Binding UserRating}"
    Command="{Binding SubmitRatingCommand}"
    CommandParameter="{Binding ProductId}"
    MaxValue="5" />

Handling ValueChanged Event

// In code-behind
var ratingControl = new RatingControl();
ratingControl.ValueChanged += (sender, args) =>
{
    Debug.WriteLine($"Rating changed from {args.OldValue} to {args.NewValue}");
};

RTL Support

The control automatically respects the device's FlowDirection:

<rating:RatingControl
    FlowDirection="RightToLeft"
    Value="4" />

Requirements

  • .NET 9.0 or later
  • .NET MAUI 9.0 or later

Platform Support

  • ✅ Android 5.0 (API 21) or later
  • ✅ iOS 15.0 or later
  • ✅ Mac Catalyst 15.0 or later
  • ✅ Windows 10.0.17763.0 or later

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Built with ❤️ by Pionexia

Support

If you encounter any issues or have questions, please open an issue on GitHub.

Product Compatible and additional computed target framework versions.
.NET net9.0-android35.0 is compatible.  net9.0-maccatalyst18.0 is compatible.  net10.0-android was computed.  net10.0-ios26.0 is compatible.  net10.0-maccatalyst was computed.  net10.0-windows10.0.19041 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.0 195 1/22/2026