|
@@ -16,7 +16,22 @@ namespace InABox.DynamicGrid
|
|
|
//DynamicEditorControlFactory.Register<CurrencyEditorControl, CurrencyEditor>();
|
|
|
}
|
|
|
|
|
|
- private CurrencyTextBox Editor;
|
|
|
+ private CurrencyTextBox? Editor;
|
|
|
+
|
|
|
+ private String _currencySymbol = "";
|
|
|
+
|
|
|
+ public String CurrencySymbol
|
|
|
+ {
|
|
|
+ get => _currencySymbol;
|
|
|
+ set
|
|
|
+ {
|
|
|
+ _currencySymbol = value;
|
|
|
+ if (Editor != null)
|
|
|
+ Editor.CurrencySymbol = String.IsNullOrEmpty(value)
|
|
|
+ ? "$" :
|
|
|
+ $"{value} ";
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
public CurrencyEditorControl()
|
|
|
{
|
|
@@ -47,7 +62,7 @@ namespace InABox.DynamicGrid
|
|
|
VerticalAlignment = VerticalAlignment.Stretch,
|
|
|
VerticalContentAlignment = VerticalAlignment.Center,
|
|
|
HorizontalContentAlignment = HorizontalAlignment.Center,
|
|
|
- CurrencyDecimalDigits = (EditorDefinition as CurrencyEditor).Digits
|
|
|
+ CurrencyDecimalDigits = EditorDefinition.Digits
|
|
|
};
|
|
|
Editor.ValueChanged += (o, e) => { CheckChanged(); };
|
|
|
Editor.SetValue(DockPanel.DockProperty, Dock.Left);
|
|
@@ -58,6 +73,10 @@ namespace InABox.DynamicGrid
|
|
|
Editor.IsEnabled = false;
|
|
|
}
|
|
|
|
|
|
+ Editor.CurrencySymbol = String.IsNullOrEmpty(EditorDefinition.CurrencySymbol)
|
|
|
+ ? "$" :
|
|
|
+ $"{EditorDefinition.CurrencySymbol} ";
|
|
|
+
|
|
|
DockPanel.Children.Add(Editor);
|
|
|
|
|
|
|
|
@@ -86,7 +105,15 @@ namespace InABox.DynamicGrid
|
|
|
|
|
|
protected override void UpdateValue(double value)
|
|
|
{
|
|
|
- Editor.Value = Convert.ToDecimal(value);
|
|
|
+ try
|
|
|
+ {
|
|
|
+ Editor.Value = Convert.ToDecimal(value);
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ Editor.Value = 0m;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public override void SetFocus()
|