using System; using System.Globalization; using System.Windows; using System.Windows.Media; using Syncfusion.Windows.Shared; namespace InABox.DynamicGrid { public class IntegerEditorControl : DynamicEditorControl { private IntegerTextBox Editor; protected override FrameworkElement CreateEditor() { Editor = new IntegerTextBox { VerticalAlignment = VerticalAlignment.Stretch, VerticalContentAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Stretch, HorizontalContentAlignment = HorizontalAlignment.Center }; Editor.NumberFormat = new NumberFormatInfo { NumberGroupSeparator = "", CurrencyGroupSeparator = "", PercentGroupSeparator = "" }; Editor.ValueChanged += (o, e) => CheckChanged(); return Editor; } public override int DesiredHeight() { return 25; } public override int DesiredWidth() { return 150; } protected override int RetrieveValue() { return Convert.ToInt32(Editor.Value.HasValue ? Editor.Value.Value : default(int)); } protected override void UpdateValue(int value) { Editor.Value = value; } public override void SetFocus() { Editor.Focus(); } public override void SetColor(Color color) { Editor.Background = new SolidColorBrush(color); } } }