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

            s._rating = (int)e.NewValue;
            s.UpdateControlVisualState();
        }
        /// <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();
            }
        }