【发布时间】:2011-07-11 13:36:49
【问题描述】:
我试图将图像列表绑定到列表框,但我得到的只是类型名称列表
<ListBox x:Name="PhotosListBox" ItemsSource="{Binding MyImages}" />
MyImages 是 List<BitMapImages>
现在它只返回System.Windows.Media.Imaging.BitmapImage 的列表,而不是显示图像
编辑 为了进一步参考,这里是最终代码。
<ListBox x:Name="PhotosListBox" ItemsSource="{Binding MyImages}" >
<ListBox.ItemTemplate>
<DataTemplate>
<Image Source="{Binding}" Stretch="Uniform"></Image>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
【问题讨论】:
标签: c# .net wpf xaml data-binding