2012-02-07 64 views

回答

2

您需要设置ItemTemplate

<ListBox> 
    <ListBox.ItemTemplate> 
    <DataTemplate> 
     <StackPanel Orientation="Horizontal"> 
     <Image Source="{Binding Path=ImageSource}"/> 
     <TextBlock Text="{Binding Path=Text"/> 
     </StackPanel> 
    </DataTemplate> 
    </ListBox.ItemTemplate> 
<ListBox> 

上面的代码假设你已经绑定列表,或设置ItemsSource,以暴露TextImageSource属性的对象的列表。

+0

如果将图像保存到存储中,可能需要查看“转换器”。因为你需要从'路径到图像'转换为'ImageSource'对象来显示 – Ku6opr 2012-02-07 11:49:58

相关问题