public class ImageChannel
{
public string ImagePath { get; set; }
public ImageSource Image
{
get
{
return new BitmapImage(new Uri("ms-appx://" + this.ImagePath));
}
}
public List<ImageChannel> ImageChannels
{
get
{
return new List<ImageChannel>()
{
new ImageChannel() { ImagePath="/Assets/image.png" }};
// the other images
}
}
}
<ListView ItemsSource="{Binding ImageChannels}" Margin="222,10,340,140">
<ListView.ItemTemplate>
<DataTemplate>
<Image Height="113" Source="{Binding}" Stretch="None"/>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
为什么这不起作用?我真的迷路了。我只是想在我在列表视图中添加的项目旁边添加一个图像,例如“图像”|“微软”等。谢谢!