using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;

namespace DependencyPropertyExample
{
    // Example 18-10. Automatic visual invalidation

    public class Star : FrameworkElement
    {
        public static readonly DependencyProperty PointsProperty;

        public int Points
        {
            get { return (int) GetValue(PointsProperty); }
            set { SetValue(PointsProperty, value); }
        }

        static Star()
        {
            FrameworkPropertyMetadata pointsMetadata =
                new FrameworkPropertyMetadata(5, // default value
                       FrameworkPropertyMetadataOptions.AffectsRender);

            PointsProperty = DependencyProperty.Register("Points",
                typeof(int), typeof(Star), pointsMetadata);
        }
    }

    // End of Example 18-10
}
