I need to port classic ListView to WPF version, I googled a lot, however I couldn't find a simple code snippet. All I need is emulating LargeImageList to show dynamic/webc开发者_如何学编程am captured (Image) pictures.
.net 3.5
Then just use StackPanel
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Top">
<Border Margin="5" CornerRadius="5" Height="40" Width ="45" >
<Image Source="Images/Desert.jpg"></Image>
</Border>
<Border Margin="5" CornerRadius="5" Height="40" Width ="45" >
<Image Source="Images/Desert.jpg"></Image>
</Border>
<Border Margin="5" CornerRadius="5" Height="40" Width ="45" >
<Image Source="Images/Desert.jpg"></Image>
</Border>
</StackPanel>
Actually what you want to use is a wrap panel:
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
...
</ListView>
Also if your images aren't already the same size you can use the trick written in this article to make them all the same size: http://joshsmithonwpf.wordpress.com/2008/09/06/synchronizing-the-width-of-elements-in-an-itemscontrol/
精彩评论