NumericUpDownExtensions.cs 645 B

1234567891011121314151617181920212223
  1. using Avalonia;
  2. using Avalonia.Controls;
  3. namespace SukiUI.Theme
  4. {
  5. public class NumericUpDownExtensions
  6. {
  7. public static readonly AttachedProperty<string> UnitProperty =
  8. AvaloniaProperty.RegisterAttached<NumericUpDown, string>("Unit", typeof(NumericUpDown), defaultValue: "");
  9. public static string GetUnit(NumericUpDown textBox)
  10. {
  11. return textBox.GetValue(UnitProperty);
  12. }
  13. public static void SetUnit(NumericUpDown textBox, string value)
  14. {
  15. textBox.SetValue(UnitProperty, value);
  16. }
  17. }
  18. }