1
0

ComboBoxPageViewModel.cs 1013 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System;
  2. using System.Collections.ObjectModel;
  3. using System.Linq;
  4. using Avalonia.Controls;
  5. using Avalonia.Controls.Selection;
  6. using MiniMvvm;
  7. namespace ControlCatalog.ViewModels
  8. {
  9. public class ComboBoxPageViewModel : ViewModelBase
  10. {
  11. private bool _wrapSelection;
  12. public bool WrapSelection
  13. {
  14. get => _wrapSelection;
  15. set => this.RaiseAndSetIfChanged(ref _wrapSelection, value);
  16. }
  17. public ObservableCollection<IdAndName> Values { get; set; } = new ObservableCollection<IdAndName>
  18. {
  19. new IdAndName(){ Id = "Id 1", Name = "Name 1" },
  20. new IdAndName(){ Id = "Id 2", Name = "Name 2" },
  21. new IdAndName(){ Id = "Id 3", Name = "Name 3" },
  22. new IdAndName(){ Id = "Id 4", Name = "Name 4" },
  23. new IdAndName(){ Id = "Id 5", Name = "Name 5" },
  24. };
  25. }
  26. public class IdAndName
  27. {
  28. public string? Id { get; set; }
  29. public string? Name { get; set; }
  30. }
  31. }