AcornPublishing_wpf/9780735619579-master/AppsCodeMarkup/Chapter 19/UseCustomClass/UseCustomClass.cs
//-----------------------------------------------
// UseCustomClass.cs (c) 2006 by Charles Petzold
//-----------------------------------------------
using Petzold.SelectColorFromGrid;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;

namespace Petzold.UseCustomClass
{
    public partial class UseCustomClass : Window
    {
        [STAThread]
        public static void Main()
        {
            Application app = new Application();
            app.Run(new UseCustomClass());
        }
        public UseCustomClass()
        {
            InitializeComponent();
        }
        void ColorGridBoxOnSelectionChanged(object sender,
                                            SelectionChangedEventArgs args)
        {
            ColorGridBox clrbox = args.Source as ColorGridBox;
            Background = (Brush) clrbox.SelectedValue;
        }
    }
}