ListBoxPage.xaml 1.3 KB

123456789101112131415161718192021222324252627282930
  1. <UserControl xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. x:Class="ControlCatalog.Pages.ListBoxPage">
  4. <StackPanel Orientation="Vertical" Spacing="4">
  5. <TextBlock Classes="h1">ListBox</TextBlock>
  6. <TextBlock Classes="h2">Hosts a collection of ListBoxItem.</TextBlock>
  7. <StackPanel Orientation="Horizontal"
  8. Margin="0,16,0,0"
  9. HorizontalAlignment="Center"
  10. Spacing="16">
  11. <StackPanel Orientation="Vertical" Spacing="8">
  12. <ListBox Items="{Binding Items}" SelectedItem="{Binding SelectedItem}" AutoScrollToSelectedItem="True" SelectionMode="{Binding SelectionMode}" Width="250" Height="350"></ListBox>
  13. <Button Command="{Binding AddItemCommand}">Add</Button>
  14. <Button Command="{Binding RemoveItemCommand}">Remove</Button>
  15. <Button Command="{Binding SelectRandomItemCommand}">Select Random Item</Button>
  16. <ComboBox SelectedIndex="{Binding SelectionMode, Mode=TwoWay}">
  17. <ComboBoxItem>Single</ComboBoxItem>
  18. <ComboBoxItem>Multiple</ComboBoxItem>
  19. <ComboBoxItem>Toggle</ComboBoxItem>
  20. <ComboBoxItem>AlwaysSelected</ComboBoxItem>
  21. </ComboBox>
  22. </StackPanel>
  23. </StackPanel>
  24. </StackPanel>
  25. </UserControl>