MainWindow.xaml 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <Window xmlns="https://github.com/avaloniaui"
  2. Title="AvaloniaUI Virtualization Test"
  3. Width="800"
  4. Height="600">
  5. <DockPanel LastChildFill="True" Margin="16">
  6. <StackPanel DockPanel.Dock="Right"
  7. Margin="16 0 0 0"
  8. MinWidth="150"
  9. Spacing="4">
  10. <DropDown Items="{Binding VirtualizationModes}"
  11. SelectedItem="{Binding VirtualizationMode}"/>
  12. <DropDown Items="{Binding Orientations}"
  13. SelectedItem="{Binding Orientation}"/>
  14. <TextBox Watermark="Item Count"
  15. UseFloatingWatermark="True"
  16. Text="{Binding ItemCount}"/>
  17. <TextBox Watermark="Extent"
  18. UseFloatingWatermark="True"
  19. Text="{Binding #listBox.Scroll.Extent, Mode=OneWay}"/>
  20. <TextBox Watermark="Offset"
  21. UseFloatingWatermark="True"
  22. Text="{Binding #listBox.Scroll.Offset, Mode=OneWay}"/>
  23. <TextBox Watermark="Viewport"
  24. UseFloatingWatermark="True"
  25. Text="{Binding #listBox.Scroll.Viewport, Mode=OneWay}"/>
  26. <TextBlock>Horiz. ScrollBar</TextBlock>
  27. <DropDown Items="{Binding ScrollBarVisibilities}"
  28. SelectedItem="{Binding HorizontalScrollBarVisibility}"/>
  29. <TextBlock>Vert. ScrollBar</TextBlock>
  30. <DropDown Items="{Binding ScrollBarVisibilities}"
  31. SelectedItem="{Binding VerticalScrollBarVisibility}"/>
  32. <TextBox Watermark="Item to Create"
  33. UseFloatingWatermark="True"
  34. Text="{Binding NewItemString}"/>
  35. <Button Command="{Binding AddItemCommand}">Add Item</Button>
  36. <Button Command="{Binding RemoveItemCommand}">Remove Item</Button>
  37. <Button Command="{Binding RecreateCommand}">Recreate</Button>
  38. <Button Command="{Binding SelectFirstCommand}">Select First</Button>
  39. <Button Command="{Binding SelectLastCommand}">Select Last</Button>
  40. </StackPanel>
  41. <ListBox Name="listBox"
  42. Items="{Binding Items}"
  43. SelectedItems="{Binding SelectedItems}"
  44. SelectionMode="Multiple"
  45. VirtualizationMode="{Binding VirtualizationMode}"
  46. ScrollViewer.HorizontalScrollBarVisibility="{Binding HorizontalScrollBarVisibility, Mode=TwoWay}"
  47. ScrollViewer.VerticalScrollBarVisibility="{Binding VerticalScrollBarVisibility, Mode=TwoWay}">
  48. <ListBox.ItemsPanel>
  49. <ItemsPanelTemplate>
  50. <VirtualizingStackPanel Orientation="{Binding Orientation}"/>
  51. </ItemsPanelTemplate>
  52. </ListBox.ItemsPanel>
  53. <ListBox.ItemTemplate>
  54. <DataTemplate>
  55. <TextBlock Text="{Binding Header}" TextWrapping="Wrap"/>
  56. </DataTemplate>
  57. </ListBox.ItemTemplate>
  58. </ListBox>
  59. </DockPanel>
  60. </Window>