I have a list of images in my app, which are all inside a list box, I am giving the source as a URL.
Everything working fine, am able to show the image from the URL I have given.
When I change a image, and reload my ListBox that change is not reflecting on that image, it shows the old image not the new one.
I am sure, after image change I bind the new image URL to the source, but it shows the old image, I am not able to find why is this happening, here my code
<ListBox Grid.Row="1" HorizontalAlignment="Left" Margin="0,81,0,0" Name="wishListListBox" VerticalAlignment="Top" Width="480" Visibility="Visible">
<ListBox.ItemTemplate>
<DataTemplate>
<Image ImageFailed="wishlistImage_ImageFailed_1" x:Name="wishlistImage" HorizontalAlignment="Left" Width="164" Margin="12,54,0,88" Stretch="Fill">
<Image.Source>
<BitmapImage CreateOptions="DelayCreation,IgnoreImageCache" UriSource="{Binding thumb_image}" />
</Image.Source>
</Image>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
here is my class from which i set itemsource for my image
[DataContract]
public class WishListResponse : INotifyPropertyChanged
{
[DataMember]
public List<string> thumb_images { get; set; }
public string thumb_image
{
get
{
if (thumb_images.Count != 0)
return thumb_images[0];
else
return "";
}
set
{
thumb_images[0] = value;
OnPropertyChanged(thumb_images[0]);
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string name)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(name));
}
}
}
and in my main page i bind the item source like this
public static List<WishListResponse> wishlistList = new List<WishListResponse>();
wishListListBox.ItemsSource = wishlistList.ToArray();
Can anybody help me to refresh my image control. Thank you.