binding windows phone c#
本文关键字:phone windows binding | 更新日期: 2023-09-27 18:20:29
我需要将标题和链接与我的Xaml绑定,这是我的codeehind:
private void DownLoadCompleted(object sender, HtmlDocumentLoadCompleted e)
{
_popVideos = new List<PopularVideos>();
var imgs = e.Document.DocumentNode.SelectNodes(@"//img[@src]")
.Select(img => new
{
Link = img.Attributes["src"].Value,
Title = img.Attributes["alt"].Value,
}).ToList();
this.listBoxPopular.ItemsSource = imgs;
}
我的Xaml是这样的:
<ListBox Name="listBoxPopular">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<Image Name="imagem" Source="{Binding Path=alt}"/>
<TextBlock Text="{Binding Path=Title}" Tap="HyperlinkButton_Tap" Tag="{Binding Path=Url}" FontSize="30" Foreground="#FF159DDE" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
是否检查
imgs
里面有东西。