//----------------------------------------------------------------------- // // Created Sept. 2009 by Nicholas Armstrong. Available online at http://nicholasarmstrong.com // // // A single box displayed in the box grid. // //----------------------------------------------------------------------- namespace NicholasArmstrong.Samples.ECE150.Loops { using System.Windows; using System.Windows.Controls; using System.Windows.Media; /// /// A single box displayed in the box grid. /// public class Box : Control { #region Fields /// /// The default highlight colour for a box. /// public static readonly Brush DefaultHighlight = Utilities.BrushFromString("#385dc9"); /// /// DependencyProperty backing store for Highlighted. /// public static readonly DependencyProperty HighlightedProperty = DependencyProperty.Register("Highlighted", typeof(bool), typeof(Box), new UIPropertyMetadata(false)); /// /// DependencyProperty backing store for HighlightColor. /// public static readonly DependencyProperty HighlightColorProperty = DependencyProperty.Register("HighlightColor", typeof(Brush), typeof(Box), new UIPropertyMetadata(DefaultHighlight)); #endregion #region Properties /// /// Gets or sets the box's position number. /// public int Number { get; set; } /// /// Gets or sets a value indicating whether this box is highlighted. /// public bool Highlighted { get { return (bool)GetValue(HighlightedProperty); } set { SetValue(HighlightedProperty, value); } } /// /// Gets or sets the box's highlight colour. /// public Brush HighlightColor { get { return (Brush)GetValue(HighlightColorProperty); } set { SetValue(HighlightColorProperty, value); } } #endregion } }