我需要将经典的ListView移植到WPF版本,我搜索了很多,但是我找不到一个简单的代码片段。我需要的只是模拟LargeImageList来显示动态/网络摄像头捕捉(图像)图片。LargeImages to WPF ListView port
.NET 3.5
我需要将经典的ListView移植到WPF版本,我搜索了很多,但是我找不到一个简单的代码片段。我需要的只是模拟LargeImageList来显示动态/网络摄像头捕捉(图像)图片。LargeImages to WPF ListView port
.NET 3.5
然后,只需使用的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>
其实你想用的是一个包裹面板:
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
...
</ListView>
此外,如果你的图片AREN你已经可以使用本文所写的技巧制作相同的尺寸他们所有的大小相同: http://joshsmithonwpf.wordpress.com/2008/09/06/synchronizing-the-width-of-elements-in-an-itemscontrol/
请看到我的编辑 – Stecya 2011-05-12 14:25:57
我需要programmaticaly填充图片... – 2011-05-12 15:21:20
您可以在运行时 – Stecya 2011-05-12 15:25:34