using System.Windows; using System.Windows.Controls; using System.Windows.Media; namespace InABox.DynamicGrid { public class CheckBoxEditorControl : DynamicEditorControl { private CheckBox Editor; protected override FrameworkElement CreateEditor() { Editor = new CheckBox { VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Stretch }; Editor.Checked += (o, e) => CheckChanged(); Editor.Unchecked += (o, e) => CheckChanged(); return Editor; } public override int DesiredHeight() { return 25; } public override int DesiredWidth() { return 25; } protected override bool RetrieveValue() { return Editor.IsChecked == true; } protected override void UpdateValue(bool value) { Editor.IsChecked = value; } public override void SetFocus() { Editor.Focus(); } public override void SetColor(Color color) { Editor.Background = new SolidColorBrush(color); } } }