Commits

Mark Heath committed 6bec54f

track list shows ratings out of 10

Comments (0)

Files changed (3)

MusicRater/DummyViewModels/DummyTrackListControlViewModel.cs

         public Track Build()
         {
             var t = new Track();
-            t.Rating = random.Next(10);
+            t.Rating = random.Next(20);
             t.Author = "Someone";
             t.Listens = random.Next(10);
             t.Title = "Track " + (++track).ToString();

MusicRater/ViewModels/TrackViewModel.cs

                 {
                     track.Rating = value;
                     RaisePropertyChanged("Rating");
+                    RaisePropertyChanged("DisplayRating");
                 }
             }
         }
 
+        public decimal DisplayRating
+        {
+            get { return track.Rating/2M; }
+        }
+
         public int Listens
         {
             get

MusicRater/Views/TrackListControl.xaml

                         <TextBlock Text="{Binding DisplayAuthor}" Foreground="{Binding TextBrush}" FontWeight="Bold" Width="120"/>
                         <TextBlock Text="{Binding Title}" Foreground="{Binding TextBrush}" Width="220"/>
                         <!--<ProgressBar Minimum="0" Maximum="100" Width="100" Value="{Binding Rating}" />-->
-                        <TextBlock Margin="5,0" Text="{Binding Rating, StringFormat=\{0:0.\}%}" FontWeight="Bold" Foreground="{Binding TextBrush}" Width="30" />
+                        <TextBlock Margin="5,0" Text="{Binding DisplayRating}" FontWeight="Bold" Foreground="{Binding TextBrush}" Width="30" />
                     </StackPanel>
                 </DataTemplate>
             </ListBox.ItemTemplate>