IntegerPropertyEditor.cs 809 B

12345678910111213141516171819202122232425262728293031
  1. using System.Windows;
  2. namespace HandyControl.Controls
  3. {
  4. public class NumberPropertyEditor : PropertyEditorBase
  5. {
  6. public NumberPropertyEditor(double minimum, double maximum)
  7. {
  8. Minimum = minimum;
  9. Maximum = maximum;
  10. }
  11. public double Minimum { get; set; }
  12. public double Maximum { get; set; }
  13. public override FrameworkElement CreateElement(PropertyItem propertyItem)
  14. {
  15. var numericUpDown = new NumericUpDown
  16. {
  17. IsReadOnly = propertyItem.IsReadOnly,
  18. Minimum = Minimum,
  19. Maximum = Maximum
  20. };
  21. numericUpDown.SetBinding(NumericUpDown.ValueProperty, CreateBinding(propertyItem));
  22. return numericUpDown;
  23. }
  24. }
  25. }