我正在做一个项目,我在listview
中添加项目,但项目是网站,那么有没有办法可以通过我的代码在listViewItem
中添加超链接?
答案 0 :(得分:1)
我对XAML-for-Windows-Store没有太多经验,但我知道它与WPF非常相似:只为listview定义<ItemTemplate>
:
<ListView>
<ListView.ItemTemplate>
<DataTemplate>
<HyperlinkButton Content="{Binding Path=DisplayText}" NavigateUri="{Binding Path=Href}" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
此代码假定您添加到ListView的项目有两个字符串属性:DisplayText
和Href
。