Browse Source

NumericUpDown for ints

pull/10368/head
pr8x 4 years ago
parent
commit
2402fe07e3
  1. 10
      src/Avalonia.Diagnostics/Diagnostics/Controls/PropertyValueEditor.cs

10
src/Avalonia.Diagnostics/Diagnostics/Controls/PropertyValueEditor.cs

@ -180,8 +180,14 @@ namespace Avalonia.Diagnostics.Controls
return CreateControl<CheckBox>(ToggleButton.IsCheckedProperty);
//TODO: Infinity, NaN not working with NumericUpDown
//if (ValueType.IsPrimitive)
// return CreateControl<NumericUpDown>(NumericUpDown.ValueProperty, new ValueToDecimalConverter());
if (ValueType.IsPrimitive && ValueType != typeof(float) && ValueType != typeof(double))
return CreateControl<NumericUpDown>(NumericUpDown.ValueProperty, new ValueToDecimalConverter(), init:
n =>
{
n.Increment = 1;
n.NumberFormat = new NumberFormatInfo { NumberDecimalDigits = 0 };
n.ParsingNumberStyle = NumberStyles.Integer;
});
if (ValueType == typeof(Color))
return CreateControl<ColorPicker>(ColorView.ColorProperty);

Loading…
Cancel
Save