Skip to content

This repository contains examples for the SfRating control in .NET MAUI (Multi-platform App UI) applications.

Notifications You must be signed in to change notification settings

SyncfusionExamples/maui-rating-samples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

maui-rating-samples

Contains samples for .NET MAUI Rating control

How to run the sample

  1. Clone the sample and open it in Visual Studio.

    Note: If you download the sample using the "Download ZIP" option, right-click it, select Properties, and then select Unblock.

  2. Register your license key in the App.cs file as demonstrated in the following code.

     public App()
     {
         //Register Syncfusion license
         Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY");
    
         InitializeComponent();
    
         MainPage = new NavigationPage(new MainPage());
     }
    
  3. Set any one of the platform specific projects (iOS, Android or UWP) as a start-up project.

  4. Clean and build the application.

  5. Run the application.

License

Syncfusion has no liability for any damage or consequence that may arise by using or viewing the samples. The samples are for demonstrative purposes, and if you choose to use or access the samples, you agree to not hold Syncfusion liable, in any form, for any damage that is related to use, for accessing, or viewing the samples. By accessing, viewing, or seeing the samples, you acknowledge and agree Syncfusion’s samples will not allow you seek injunctive relief in any form for any claim related to the sample. If you do not agree to this, do not view, access, utilize, or otherwise do anything with Syncfusion’s samples.

Adding a .NET MAUI Rating reference

Syncfusion .NET MAUI controls are available in Nuget.org. To add .NET MAUI Rating control to your project, open the NuGet package manager in Visual Studio, search for Syncfusion.Maui.Inputs and then install it.

Step 1: Create a .NET MAUI application project in Visual Studio 2022.

Step 2: Add the Syncfusion.Maui.Core Nuget to the project from nuget.org.

Step 3: In the MauiProgram.cs file, register the Syncfusion.Maui.Core handler as follows.

C#

using Syncfusion.Maui.Core.Hosting;
namespace Rating;
public static class MauiProgram
{
    public static MauiApp CreateMauiApp()
    {
        var builder = MauiApp.CreateBuilder();
        builder
            .UseMauiApp<App>()
            .ConfigureSyncfusionCore()
            .ConfigureFonts(fonts =>
            {
                fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
            });
        return builder.Build();
    }
}

Customization in Rating control

To modify space between rating items

XAML

<ContentPage.Content>
       <rating:SfRating Value="3"
                        ItemSpacing="20"/>
</ContentPage.Content>

OUTPUT

kbrating.png

To change the color of rating items

XAML

<ContentPage.Content>
    <rating:SfRating Value="3">
       <rating:SfRating.RatingSettings>
           <rating:RatingSettings RatedFill="Red" UnratedFill="Black"/>
       </rating:SfRating.RatingSettings>
   </rating:SfRating>
</ContentPage.Content>

OUTPUT

ratedcolorKB.jpg

About

This repository contains examples for the SfRating control in .NET MAUI (Multi-platform App UI) applications.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages