locked
Rating Control RRS feed

  • Question

  • Hi,

    I have used a rating control, which is in silverlight toolkit released on july 2009. In that binding is not working. Can u please help me in this.

    Here is my xaml code,

    <inputToolkit:Rating Margin="0,10,0,0" x:Name="Rating" ItemCount="5" Value="{Binding Ratings}" IsReadOnly="True"/>

    It marks all the star, not depending upon the rating value.

    Thanks..
    Saturday, September 26, 2009 12:59 AM

Answers

  • As you can see in my first post the value must between 0 and 1 (where 0 means  0%  and 1 means 100%)

    Saturday, September 26, 2009 12:24 PM

All replies

  • Hi

    Did you set the DataContext ?

    <inputToolkit:Rating x:Name="Rating" Value="{Binding Rating, Mode=TwoWay, UpdateSourceTrigger=Default}" />

    public class RatingClass
    {
         public double Rating { get; set; }
    }

    void MainPage_Loaded(object sender, RoutedEventArgs e)
    {
         var rc = new RatingClass();
         rc.Rating = 0.6;
         this.Rating.DataContext = rc;
         /*or
         this.DataContext = rc;
         */
    }

    Hope it helps Wolfgang (SWO)

    Saturday, September 26, 2009 7:36 AM
  • Hi,

    What does UpdateSourceTrigger will do..

    Thanks..
    Saturday, September 26, 2009 8:17 AM
  • It works without too

    <inputToolkit:Rating x:Name="Rating" Value="{Binding Rating}" >

     

    Saturday, September 26, 2009 8:33 AM
  • Hi,

    This is my coding,

    XAML:

    <ListBox Height="129" Margin="80,31,100,0" x:Name="TopRated_Listbox">
    <ListBox.ItemTemplate>
    <DataTemplate>
    <StackPanel Orientation="Vertical" Margin="10,0,0,0">
    <Image Margin="5,0,0,0" Source="{Binding PhotoLocation}"/>
    <inputToolkit:Rating Margin="0,10,0,0" ItemCount="5" Value="{Binding Ratings}" IsReadOnly="True"/>
    </StackPanel>
    </DataTemplate>
    </ListBox.ItemTemplate>
    </ListBox>

    C#:
    void TopRated_GetTopRatedPhotoCompleted(object sender, GetTopRatedPhotoCompletedEventArgs e)
    {
    if (e.Error == null)
    TopRated_Listbox.ItemsSource = e.Result;
    else
    MessageBox.Show("Error: " + e.Error);
    }

    How can i modify this..

    Thanks...

    Saturday, September 26, 2009 10:01 AM
  • Hi

    How does your "Ratings" from Value="{Binding Ratings}"  looks like ?

    How does your  GetTopRatedPhotoCompletedEventArgs  looks like ?

    Saturday, September 26, 2009 11:02 AM
  • All the stars are marked always.. It doesn't mark depending upon the value..

    For example if there are 5 stars, all the stars are marked, eventhough the rating value is 3.
    Saturday, September 26, 2009 11:23 AM
  • As you can see in my first post the value must between 0 and 1 (where 0 means  0%  and 1 means 100%)

    Saturday, September 26, 2009 12:24 PM
  • Hi,

    Thanks it works..
    Tuesday, September 29, 2009 12:42 AM