using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Controls;
using System.Windows;
using System.Windows.Media;
using System.Windows.Input;

namespace DependencyPropertyExample
{
    // Example 18-1. Defining a dependency property

    public class MyCustomControl : ContentControl
    {

        public static readonly DependencyProperty StripeBrushProperty;

        static MyCustomControl()
        {
            PropertyMetadata stripeBrushMetadata =
                new PropertyMetadata(Brushes.Green); // default value
            StripeBrushProperty = DependencyProperty.Register("StripeBrush",
                typeof(Brush), typeof(MyCustomControl), stripeBrushMetadata);


            // Example 18-16. Adding a class-level command handler
            CommandBinding copyCommandBinding = new CommandBinding(
                ApplicationCommands.Copy,
                HandleCopyCommand);
            CommandManager.RegisterClassCommandBinding(typeof(MyCustomControl),
                copyCommandBinding);

            // End of Example 18-16.
        }

        public Brush StripeBrush
        {
            get { return (Brush) GetValue(StripeBrushProperty); }
            set { SetValue(StripeBrushProperty, value); }
        }


        private static void HandleCopyCommand(object sender, ExecutedRoutedEventArgs e)
        {
        }
    }

}
