EnumViewModel.cs 674 B

123456789101112131415161718192021222324
  1. using Avalonia.Collections;
  2. using System;
  3. using System.ComponentModel;
  4. using System.Reflection;
  5. namespace SukiUI.Controls
  6. {
  7. public sealed class EnumViewModel : PropertyViewModelBase<Enum?>
  8. {
  9. public IAvaloniaReadOnlyList<object> Values { get; }
  10. public EnumViewModel(INotifyPropertyChanged viewmodel, string displayName, PropertyInfo propertyInfo)
  11. : base(viewmodel, displayName, propertyInfo)
  12. {
  13. var temp = new AvaloniaList<object>();
  14. foreach (var item in Enum.GetValues(propertyInfo.PropertyType))
  15. {
  16. temp.Add(item);
  17. }
  18. Values = temp;
  19. }
  20. }
  21. }