1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Media;
- namespace InABox.DynamicGrid
- {
- public class CheckBoxEditorControl : DynamicEditorControl<bool>
- {
- 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);
- }
- }
- }
|