Skip to content

[Proposal] RatingView proposal #1607

@Eel2000

Description

@Eel2000

Feature name

RatingView

Link to discussion

#1495

Progress tracker

  • Android Implementation
  • iOS Implementation
  • MacCatalyst Implementation
  • Windows Implementation
  • Tizen Implementation
  • Unit Tests
  • Samples
  • Documentation

Summary

Maui.RatingView - is a cross platform plugin for MAUI which allow you to use the rating capabilities in your application with ease and flexibility

Motivation

This feature aimes to add the rating capability in a maui application

Detailed Design

public class RatingView : BaseTemplateView<Grid>
{

   public static readonly BindableProperty CurrentRatingProperty;
   public static readonly BindableProperty MinimumRatingProperty;
   public static readonly BindableProperty MaximumRatingProperty;
   public static readonly BindableProperty SizeProperty ;
   public static readonly BindableProperty FilledBackgroundColorProperty;
   public static readonly BindableProperty EmptyBackgroundColorProperty;
   public static readonly BindableProperty StrokeColorProperty;
   public static readonly BindableProperty StrokeThicknessProperty;
   public static readonly BindableProperty SpacingProperty;
   public static readonly BindableProperty ShouldAllowRatingProperty;
   public static readonly BindableProperty CommandProperty;
   public static readonly BindableProperty CommandParameterProperty;
   public readonly BindableProperty ShapeProperty;

    //the number of shapes filled to show the rating(default)
    public double CurrentRating
    {
        get ;
        set ;
    }
   
   //number of shapes (clickable or not) to show on the view(page) 
    public int MaximumRating
    {
        get;
        set;
    }

    public int MinimumRating
    {
        get;
        set;
    }

    public double Size
    {
        get;
        set ;
    }

    public Color FilledBackgroundColor 
    {
        get ;
        set ;
    }

    public Color EmptyBackgroundColor
    {
        get;
        set;
    }

    public Color StrokeColor
    {
        get ;
        set ;
    }

    public double StrokeThickness
    {
        get ;
        set ;
    }

    //Space between shapes
    public double Spacing
    {
        get ;
        set ;
    }
   
   //Enable user to send thier rating feedback
    public bool ShouldAllowRating
    {
        get ;
        set ;
    }

    public ICommand? Command
    {
        get ;
        set ;
    }

    public object? CommandParameter
    {
        get;
        set ;
    }

    public RatingShapes Shape
    {
        get ;
        set;
    }
}

public enum RatingShapes
{
    Star = 0,
    Heart = 1,
    Like = 2,
    Dislike = 3,
}

Usage Syntax

Here is a usage examples

 <mct:RatingView Maximum="6" Size="40" Fill="Red" Value="3" />
var rating = new RatingControl
{
    Maximum = 6,
    Value = 3,
    Size = 40,
    Fill = Colors.Red
};

Drawbacks

No response

Alternatives

No response

Unresolved Questions

No response

Metadata

Metadata

Labels

approvedThis Proposal has been approved and is ready to be added to the ToolkitchampionA member of the .NET MAUI Toolkit core team has chosen to champion this featuredocumentation approvedproposalA fully fleshed out proposal describing a new feature in syntactic and semantic detail

Type

No type

Projects

Status

Completed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions