dimanche 4 mai 2014

Changer la source de l'image à l'aide de c# - Stack Overflow


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




Use


cloud.Source = new BitmapImage(new Uri("ms-appx:/Assets/cloud1.png", UriKind.Relative));

instead.



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



Use


cloud.Source = new BitmapImage(new Uri("ms-appx:/Assets/cloud1.png", UriKind.Relative));

instead.


0 commentaires:

Enregistrer un commentaire