Friday 3 April 2015

Rating control for Windows Phone 8.1 and Windows 8.1

Wonder how to make Rating control in Windows phone 8.1  as there is no toolkit support available for Windows RT apps :(

But No worry We have solutions for this.

Get the Rating control from Nuget.
It's available for Windows RT apps (aka Windows phone 8.1 and Windows 8.1)

Now How to use
  • It works in same way as Windows phone toolkit rating control works.

 <Page  
   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
   xmlns:local="using:App3"  
   xmlns:d="http://schemas.microsoft.com/expression/blend/2008"  
   xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"  
   xmlns:RatingControl="using:JISoft.RatingControl"  
   x:Class="App3.Page1"  
   mc:Ignorable="d">  
   <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">  
     <RatingControl:Rating HorizontalAlignment="Center" VerticalAlignment="Center"   
                AllowSelectingZero="True" ReadOnly="True"  
                RatingItemCount="5" Value="3">  
       <RatingControl:Rating.FilledItemStyle>  
         <Style TargetType="RatingControl:RatingItem">  
           <Setter Property="Background" Value="Goldenrod"/>  
         </Style>  
       </RatingControl:Rating.FilledItemStyle>  
       <RatingControl:Rating.UnfilledItemStyle>  
         <Style TargetType="RatingControl:RatingItem">  
           <Setter Property="Background" Value="Black"/>  
         </Style>  
       </RatingControl:Rating.UnfilledItemStyle>  
     </RatingControl:Rating>  
   </Grid>  
 </Page>  

  • It's complete code for Rating control, once u will put this code in XAML file it will start rendering the rating control
  • Following properties are supported now
    • RatingItemCount - max no of Stars
    • Value - Allocated rating
    • FilledItemStyle - Rating field style
    • UnFilledItemStyle - Rating Empty style
    • AllowSelecteingZero - Can user give zero rating
    • ReadOnly - User allowed to Rate
The Half-Increment of star in not stable so Working on it.. Stay tuned for next update.

18 comments:

  1. Hi,
    Can we set rating from its UI, if yes, please specify the property, I need that, thanks.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. "RatingCount" property will set max no of star
    "Value" property will set the rating
    Both of these property can be set from UI.

    ReplyDelete
  4. Hi,
    Can I set value by clicking?

    ReplyDelete
  5. set "ReadOnly" to false - then user can set by tapping/clicking.

    ReplyDelete
    Replies
    1. Ok, but how can I know which value I click?

      Delete
  6. so after clicking u will get the data from "Value" property

    ReplyDelete
  7. Hi

    How do I let the user select a rating by clicking a star instead of dragging from left to right?

    ReplyDelete
  8. Hey!
    When I set "ReadOnly" to false than I can set the rating by swiping, but tapping is not possible. Is there a way to do this?

    ReplyDelete
  9. Hey, I wanna have a tapped rating control rather than a slider rating.Can you please help???

    ReplyDelete
  10. Hi there. Thanks for your Rating control.
    Jus two things I noticed... if you set the RatingItemCount less than five the control becomes stretched. And the hitbox for clicking a single item is to small... you really have to hit the middle of each star (other than swiping which works perfect).

    ReplyDelete
  11. A few problems:
    - setting explicit height deforms the control because width is not computed accodrdingly
    - when put in a viewbox to make it proportionally smaller, the stars ale aligned center, not recpecting that I set horizontal content alignment to left

    ReplyDelete
    Replies
    1. Will test it and get the solutions for these problems.
      Thank you for the valuable feedback.

      Delete
  12. Hi,

    Could you please publish your license terms for this component?

    ReplyDelete
  13. how to change that background color black

    ReplyDelete
  14. Will there be any upates to this? Would love to see the possibility to select a rating by tapping.

    ReplyDelete