Question

I am able to do this using a ListView like this.

<ListView ItemsSource="..."
    ScrollViewer.HorizontalScrollBarVisibility="Auto"
    ScrollViewer.HorizontalScrollMode="Auto"
    ScrollViewer.VerticalScrollBarVisibility="Disabled"
    ScrollViewer.VerticalScrollMode="Disabled"
    ScrollViewer.ZoomMode="Disabled"
    SelectionMode="None">
    <ListView.ItemsPanel>
        <ItemsPanelTemplate>
            <callistoControls:WrapPanel Orientation="Vertical" />
        </ItemsPanelTemplate>
    </ListView.ItemsPanel>
    <ListView.ItemTemplate>
        <DataTemplate>
            <Button Content="{Binding Title}" Command="..." CommandParameter="..."  />
        </DataTemplate>
    </ListView.ItemTemplate>
</ListView>

I don't need all the features of a ListView though. I'd rather just items an ItemsControl instead of turning off all the unwanted features in the ListView by re-doing the templates/etc.

How can I achieve this with an ItemsControl?

Was it helpful?

Solution

You can do this:

<ScrollViewer 
    HorizontalScrollBarVisibility="Auto"
    HorizontalScrollMode="Auto"
    VerticalScrollBarVisibility="Disabled"
    VerticalScrollMode="Disabled"
    ZoomMode="Disabled">
    <ItemsControl ItemsSource="...">
        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
                <callistoControls:WrapPanel Orientation="Vertical" />
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>
        <ItemsControl.ItemTemplate>
            <DataTemplate>
                <Button />
            </DataTemplate>
        </ItemsControl.ItemTemplate>
    </ItemsControl>
</ScrollViewer>

Best of luck.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top