private static void SelectedRatingChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            StarSelector s = d as StarSelector;

            s._rating = (int)e.NewValue;
            s.UpdateControlVisualState();
        }
 public void RatingChangedEvent()
 {
     StarSelector ss = new StarSelector();
     ss.RatingChanged += new RatingChangedEventHandler(
         (sender, e) => Assert.AreEqual(3, e.Rating));
     ss.SelectedRating = 3;
     Assert.AreEqual(3, ss.SelectedRating);
 }
        /// <summary>
        /// Invoked when the <see cref="ReadOnlyProperty"/> is changed.
        /// </summary>
        /// <param name="d">The <see cref="DependencyObject"/> that raised the event.</param>
        /// <param name="e">The <see cref="System.Windows.DependencyPropertyChangedEventArgs"/> instance containing the event data.</param>
        private static void ReadOnlyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            StarSelector s = d as StarSelector;

            if (s != null)
            {
                s.ReadOnly = (bool)e.NewValue;
                s.UpdateControlVisualState();
            }
        }
 public void SelectedRating()
 {
     StarSelector ss = new StarSelector {SelectedRating = 1};
     CreateAsyncTest(ss, () => Assert.AreEqual(1, ss.SelectedRating));
 }
 public void DefaultRating()
 {
     StarSelector ss = new StarSelector();
     CreateAsyncTest(ss, () => Assert.AreEqual(0, ss.SelectedRating));
 }
 public void CreateStarSelector()
 {
     StarSelector ss = new StarSelector();
     Assert.IsNotNull(ss);
 }
 public void ReadOnly()
 {
     StarSelector ss = new StarSelector { ReadOnly = true };
     CreateAsyncTest(ss, () => Assert.AreEqual(true, ss.ReadOnly));
 }