Scale images in listview to fit

后端 未结 1 1222
面向向阳花
面向向阳花 2021-01-26 11:32

I\'m trying to make a listview where each item is an image. I want the listview to display the items horizontally. If the view box items won\'t fit horizontally in the window I

相关标签:
1条回答
  • 2021-01-26 11:44

    Disable the vertical ScrollBar to make the ListView scale its items vertically:

    <ListView ItemsSource="{Binding Items}"
              ItemTemplate="{StaticResource ItemTemplate}"
              ScrollViewer.VerticalScrollBarVisibility="Disabled">
        <ListView.ItemsPanel>
            <ItemsPanelTemplate>
                <StackPanel Orientation="Horizontal" />
            </ItemsPanelTemplate>
        </ListView.ItemsPanel>
    </ListView>
    

    This works as well with the more light-weight ListBox.

    0 讨论(0)
提交回复
热议问题