ListBoxPage.axaml.cs 557 B

1234567891011121314151617181920212223
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using Avalonia.Controls;
  4. using Avalonia.Interactivity;
  5. namespace IntegrationTestApp.Pages;
  6. public partial class ListBoxPage : UserControl
  7. {
  8. public ListBoxPage()
  9. {
  10. InitializeComponent();
  11. ListBoxItems = Enumerable.Range(0, 100).Select(x => "Item " + x).ToList();
  12. DataContext = this;
  13. }
  14. public List<string> ListBoxItems { get; }
  15. private void ListBoxSelectionClear_Click(object? sender, RoutedEventArgs e)
  16. {
  17. BasicListBox.SelectedIndex = -1;
  18. }
  19. }