Reputation: 193
I'm creating a windows store app and was wondering how to change the image source using C# I have included the following directive;
using Windows.UI.Xaml.Media.Imaging;
and this is the line I have to try and change the image
cloud.Source = new BitmapImage(new Uri("Assets/cloud1.png", UriKind.Relative));
cloud is the name of the image tag and cloud1 is the source I want to change it to.. but it gives me this error...
"The given System.Uri cannot be converted into a Windows.Foundation.Uri"
Any help appreciated! thanks in advance
Upvotes: 0
Views: 61
Reputation: 1393
Use
cloud.Source = new BitmapImage(new Uri("ms-appx:/Assets/cloud1.png", UriKind.Relative));
instead.
Upvotes: 1