ComboBoxPageViewModel.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  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", SearchText = "A" },
  20. new IdAndName(){ Id = "Id 2", Name = "Name 2", SearchText = "B" },
  21. new IdAndName(){ Id = "Id 3", Name = "Name 3", SearchText = "C" },
  22. new IdAndName(){ Id = "Id 4", Name = "Name 4", SearchText = "D" },
  23. new IdAndName(){ Id = "Id 5", Name = "Name 5", SearchText = "E" },
  24. };
  25. }
  26. public class IdAndName
  27. {
  28. public string? Id { get; set; }
  29. public string? Name { get; set; }
  30. public string? SearchText { get; set; }
  31. }
  32. }