I have downloaded image, class and listview with Image Control This is class which I bind to my listview:
class MagazineDownload
{
public string Title { get; set; }
public string Date { get; set; }
public BitmapImage Cover { get; set; }
public string Pdf { get; set; }
public MagazineDownload(string title, string image, string date, string pdf)
{
Title = title;
Cover = new BitmapImage();
addImage(image);
Date = date;
Pdf = pdf;
}
private async void addImage(string image)
{
StorageFile storageFile = await ApplicationData.Current.LocalFolder.GetFileAsync(image);
IAsyncOperation<IRandomAccessStream> operation = storageFile.OpenAsync(FileAccessMode.Read);
IRandomAccessStream stream = await operation;
Cover.SetSource(stream);
}
}
This is code for image binding:
<ListView
Margin="19,-23,-19.167,23.333"
AutomationProperties.AutomationId="PivotListViewSection"
SelectionMode="None"
IsItemClickEnabled="False"
ItemClick="downList_ItemClick"
ItemsSource="{Binding}"
x:Uid="downList"
x:Name="downList"
>
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image x:Name="imageDownCover" Height="100" Width="100" Stretch="Fill" Source="{Binding Cover}"/>
Everything (Title, date, pdf button tag) works except the image.
How to fix it?