开发者

LargeImages to WPF ListView port

开发者 https://www.devze.com 2023-03-05 04:42 出处:网络
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

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>

LargeImages to WPF ListView port


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/

0

精彩评论

暂无评论...
验证码 换一张
取 消