All Projects → patridge → PDRating

patridge / PDRating

Licence: MIT license
Display and collect user ratings for items in your Xamarin.iOS app. Available on NuGet.

Programming Languages

C#
18002 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to PDRating

MaterialSpinner-Xamarin
Xamarin bindings for MaterialSpinner by @ganfra
Stars: ✭ 15 (-16.67%)
Mutual labels:  xamarin, xamarin-components
Xamarin.Forms-CardView
A Package to create a CardView using Xamarin.Forms that works on the three platforms (Android, iOS, UWP)
Stars: ✭ 65 (+261.11%)
Mutual labels:  xamarin, xamarin-components
xamarin-forms-wpf-samples
Xamarin.Forms WPF Samples
Stars: ✭ 14 (-22.22%)
Mutual labels:  xamarin
Xamarin-Sidebar
A slideout navigation control for Xamarin.iOS
Stars: ✭ 113 (+527.78%)
Mutual labels:  xamarin
Portable-WebDAV-Library
Moved to codeberg.org - https://codeberg.org/DecaTec/Portable-WebDAV-Library - The Portable WebDAV Library is a strongly typed, async WebDAV client library which is fully compliant to RFC 4918, RFC 4331 and "Additional WebDAV Collection Properties". It is implemented as .NETStandard 1.1 library in oder to be used on any platform supporting .NETS…
Stars: ✭ 45 (+150%)
Mutual labels:  xamarin
Chafu
A photo browser and camera library for Xamarin.iOS
Stars: ✭ 36 (+100%)
Mutual labels:  xamarin
XF MicunaFood
Xamarin.Forms UI/UX Challenges - Micuna Food
Stars: ✭ 26 (+44.44%)
Mutual labels:  xamarin
ignite2018-labs
Xamarin University Labs for Microsoft Ingite 2018
Stars: ✭ 19 (+5.56%)
Mutual labels:  xamarin
Cake.Xamarin
🍰 🧩 📱 Cake addin for building Xamarin apps
Stars: ✭ 22 (+22.22%)
Mutual labels:  xamarin
ARKitXamarinDemo
ARKit + UrhoSharp + Xamarin
Stars: ✭ 42 (+133.33%)
Mutual labels:  xamarin
Xamarin.iOS.DGActivityIndicatorView
🔰 DGActivityIndicatorView is a collection of nice loading animations for Xamarin.iOS.
Stars: ✭ 28 (+55.56%)
Mutual labels:  xamarin
VpnHood
Undetectable Fast Portable VPN
Stars: ✭ 349 (+1838.89%)
Mutual labels:  xamarin
XamarinHOL
Xamarin ハンズオン用のレポジトリ&ドキュメントです。
Stars: ✭ 52 (+188.89%)
Mutual labels:  xamarin
Xamarin-iOS
PSPDFKit for iOS wrapper for the Xamarin platform.
Stars: ✭ 14 (-22.22%)
Mutual labels:  xamarin
Nethereum.UI.Wallet.Sample
Cross platform wallet example using Nethereum, Xamarin.Forms and MvvmCross
Stars: ✭ 77 (+327.78%)
Mutual labels:  xamarin
Xamarin.Forms.TabView
The TabView is a Xamarin.Forms control to display a set of tabs and their respective content.
Stars: ✭ 56 (+211.11%)
Mutual labels:  xamarin
xamarinworkshop
A Xamarin beginner's workshop
Stars: ✭ 49 (+172.22%)
Mutual labels:  xamarin
Xalami
A delicious way to kickstart your Xamarin Forms project
Stars: ✭ 18 (+0%)
Mutual labels:  xamarin
XamarinHosting
Xamarin Forms Generic Host implementation for Microsoft.Extensions.Hosting.
Stars: ✭ 19 (+5.56%)
Mutual labels:  xamarin
FlightBookingApp
Xamarin.Forms goodlooking UI sample using the new SwipeView.
Stars: ✭ 26 (+44.44%)
Mutual labels:  xamarin

RatingView (PDRatingView)

RatingView lets you display an average rating and, optionally, collect a user's rating submission on items in your Xamarin.iOS application.

  • Custom rating images.
  • Custom rating scale.
  • Transparent background for composing.

Examples

You can use whatever images you want and whatever scale size you need. Many people use five stars.

Five star rating scale

Others have something else entirely. Perhaps you want a 10-tomato rating.

Ten tomato rating scale

Whatever you need, you give it a rectangle to fit into and it will resize things accordingly.

Six moustaches rating scale

Ratings displays are kept minimal. If you need to compose your ratings view into something else, it will overlay it just fine.

Star rating on a custom background

Usage

In any code-based UIView or UIViewController, you can add a PDRatingView to the displayed just like any other view.

using PatridgeDev;
...

PDRatingView ratingView;
public override void ViewDidLoad() {
    
    // Gather up the images to be used.
    RatingConfig ratingConfig = new RatingConfig(
        emptyImage: UIImage.FromBundle("empty"),
        filledImage: UIImage.FromBundle("filled"),
        chosenImage: UIImage.FromBundle("chosen")
    );
    
    // Create the view.
    decimal averageRating = 3.25m;
    ratingView = new PDRatingView(new CGRect(0f, 0f, View.Bounds.Width, 125f), ratingConfig, averageRating);
    
    // [Optional] Do something when the user selects a rating.
    ratingView.RatingChosen += (sender, e) => {
        (new UIAlertView("Rated!", e.Rating.ToString() + " stars", null, "Ok")).Show();
    };
    
    // [Required] Add the view to the 
    View.Add(ratingView);
}

Other Configurations Options

Between-item whitespace

Need some space between your rating items? Just set the ItemPadding in the RatingConfig object used to build the PDRatingView.

// Put a little space between the rating items.
ratingConfig.ItemPadding = 5f;

Read-only (no user rating input)

If you are showing a rating without any intention of collecting a rating from the user, you can keep the rating view from taking any user input with the default iOS setting. As a result, this will keep it from ever triggering a RatingChosen event.

// Only display the rating; don't allow user rating.
ratingView.UserInteractionEnabled = false;

Different rating scale size

Say you need users to rate things on a scale to ten. That can be changed in the RatingConfig object used to build the PDRatingView. The default is a 5-item scale of ratings.

// Allow rating on a scale of 1 to 10.
ratingConfig.ScaleSize = 10;

Rounding of ratings to whole or half stars

If you want average ratings to display in half- or whole-star increments, that isn't currently built in to the PDRatingView system directly, but you can very easily use .NET to round appropriately before setting the view's AverageRating to reproduce the same result.

decimal rating = 3.58m;
decimal halfRoundedRating = Math.Round(rating * 2m, MidpointRounding.AwayFromZero) / 2m;
decimal wholeRoundedRating = Math.Round(rating, MidpointRounding.AwayFromZero);
StarRating.AverageRating = wholeRoundedRating;
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].