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