【发布时间】:2017-12-14 04:27:49
【问题描述】:
我想在 windows 10 中将文章的图片从 rss 提要添加到 listview
我尝试这篇文章添加 rss 提要:https://code.msdn.microsoft.com/windowsapps/How-to-perform-RSS-Reader-4803093b
但我无法在列表视图中添加文章的图像
【问题讨论】:
标签: c# windows uwp win-universal-app rss-reader
我想在 windows 10 中将文章的图片从 rss 提要添加到 listview
我尝试这篇文章添加 rss 提要:https://code.msdn.microsoft.com/windowsapps/How-to-perform-RSS-Reader-4803093b
但我无法在列表视图中添加文章的图像
【问题讨论】:
标签: c# windows uwp win-universal-app rss-reader
要向您的列表视图项目添加图像,您需要将列表视图数据模板定义为如下内容:
<ListView x:Name="MyList">
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source={Binding img} Height="100"/>
<TextBlock Text="{Binding text}"/>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
然后,您可以通过从您的 RSS 提要创建项目列表,然后将您的 ListView 项目源分配给此列表,从而为每个项目提供图像源和文本。
【讨论】: