<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        x:Class="VirtualizationDemo.MainWindow"
        Title="AvaloniaUI Virtualization Test"
        Width="800"
        Height="600">
    <DockPanel LastChildFill="True" Margin="16">
        <StackPanel DockPanel.Dock="Right" 
                    Margin="16 0 0 0" 
                    MinWidth="150"
                    Spacing="4">
            <ComboBox Items="{Binding VirtualizationModes}"
                      SelectedItem="{Binding VirtualizationMode}"/>
            <ComboBox Items="{Binding Orientations}"
                      SelectedItem="{Binding Orientation}"/>
            <TextBox Watermark="Item Count"
                     UseFloatingWatermark="True"
                     Text="{Binding ItemCount}"/>
            <TextBox Watermark="Extent"
                     UseFloatingWatermark="True"
                     Text="{Binding #listBox.Scroll.Extent, Mode=OneWay}"/>
            <TextBox Watermark="Offset"
                     UseFloatingWatermark="True"
                     Text="{Binding #listBox.Scroll.Offset, Mode=OneWay}"/>
            <TextBox Watermark="Viewport"
                     UseFloatingWatermark="True"
                     Text="{Binding #listBox.Scroll.Viewport, Mode=OneWay}"/>
            <TextBlock>Horiz. ScrollBar</TextBlock>
            <ComboBox Items="{Binding ScrollBarVisibilities}"
                      SelectedItem="{Binding HorizontalScrollBarVisibility}"/>
            <TextBlock>Vert. ScrollBar</TextBlock>
            <ComboBox Items="{Binding ScrollBarVisibilities}"
                      SelectedItem="{Binding VerticalScrollBarVisibility}"/>
            <TextBox Watermark="Item to Create"
                     UseFloatingWatermark="True"
                     Text="{Binding NewItemString}"/>
            <Button Command="{Binding AddItemCommand}">Add Item</Button>
            <Button Command="{Binding RemoveItemCommand}">Remove Item</Button>
            <Button Command="{Binding RecreateCommand}">Recreate</Button>
            <Button Command="{Binding SelectFirstCommand}">Select First</Button>
            <Button Command="{Binding SelectLastCommand}">Select Last</Button>
            <Button Command="{Binding RandomizeSize}">Randomize Size</Button>
            <Button Command="{Binding ResetSize}">Reset Size</Button>
        </StackPanel>

        <ListBox Name="listBox" 
                 Items="{Binding Items}" 
                 Selection="{Binding Selection}"
                 SelectionMode="Multiple"
                 VirtualizationMode="{Binding VirtualizationMode}"
                 ScrollViewer.HorizontalScrollBarVisibility="{Binding HorizontalScrollBarVisibility, Mode=TwoWay}"
                 ScrollViewer.VerticalScrollBarVisibility="{Binding VerticalScrollBarVisibility, Mode=TwoWay}">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <VirtualizingStackPanel Orientation="{Binding Orientation}"/>
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Header}" Height="{Binding Height}" TextWrapping="Wrap"/>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </DockPanel>
</Window>
