我有一個包含圖像列表的類。Windows Phone綁定列表框Listbbx
public class RSSClass
{
public string Title { get; set; }
public string Summary { get; set; }
public string PubDate { get; set; }
public List<ImageData> ImagePath { get; set; }
public class ImageData
{
public Uri ImageLocation
{
get;
set;
}
}
}
赫斯的XAML
<ListBox Name="lstRSS">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<StackPanel.Resources>
</StackPanel.Resources>
<TextBlock Text="{Binding Path=Title}"> </TextBlock>
<TextBlock Text="{Binding Path=PubDate}"></TextBlock>
<TextBlock Text="{Binding Path=Summary}"></TextBlock>
<ListBox x:Name="ImageListBox" ItemsSource="{Binding ImagePath}">
<DataTemplate>
<Image x:Name="image1" Source="{Binding}" MaxHeight="80" MaxWidth="120" Margin="0"></Image>
</DataTemplate>
</ListBox>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
內部列表框,ImageListBox,結合並示出了URI的字符串值。我只是不知道如何綁定內部列表框image1中的圖像?
任何幫助非常感謝。
問候 羅斯
您是否試過Source =「{Binding ImageLocation}」? – 2012-04-28 16:21:24
試過這個隊友,沒有運氣,謝謝你的建議! – user746585 2012-04-28 16:34:17
您是否嘗試過使用字符串作爲ImageLocation而不是Uri? – 2012-04-28 17:08:49