| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 | using System.Windows;using System.Windows.Media;using InABox.Core;using Syncfusion.Windows.Shared;namespace InABox.DynamicGrid{    public class DoubleEditorControl : DynamicEditorControl<double>    {        private DoubleTextBox Editor;        public DoubleEditorControl()        {            Width = 150;        }        protected override FrameworkElement CreateEditor()        {            var def = EditorDefinition as DoubleEditor;            var digits = def != null ? def.Digits : 2;            Editor = new DoubleTextBox            {                VerticalAlignment = VerticalAlignment.Stretch,                VerticalContentAlignment = VerticalAlignment.Center,                HorizontalAlignment = HorizontalAlignment.Stretch,                HorizontalContentAlignment = HorizontalAlignment.Center,                NumberDecimalDigits = digits            };            Editor.ValueChanged += (o, e) => CheckChanged();            return Editor;        }        public override void Configure()        {            var def = EditorDefinition as DoubleEditor;            if (def != null)                Editor.NumberDecimalDigits = def.Digits;            base.Configure();        }        public override int DesiredHeight()        {            return 25;        }        public override int DesiredWidth()        {            return 150;        }        protected override double RetrieveValue()        {            return Editor.Value.HasValue ? Editor.Value.Value : default;        }        protected override void UpdateValue(double value)        {            Editor.Value = value;        }        public override void SetFocus()        {            Editor.Focus();        }        public override void SetColor(Color color)        {            Editor.Background = new SolidColorBrush(color);        }    }}
 |