Amin
Amin

Reputation: 1923

Set source image of image control

I programming for Windows Phone 8.1. I use this way to create image and set source of image:

Dim AgreeBitmapImage As BitmapImage = New BitmapImage()
AgreeBitmapImage.setsource(New Uri("Assets/Image/Agree.png", UriKind.Relative))
//Above line gives an error
imgAccept = New Image
imgAccept.Height = 40
imgAccept.Width = 40
imgAccept.Source = AgreeBitmapImage

When I start the emulator, it doesn't work. Why? (Say error)

Upvotes: 1

Views: 950

Answers (1)

Chris Shao
Chris Shao

Reputation: 8231

In Windows Phone 8.1, the resources like png should be get using ms-appx:

AgreeBitmapImage.UriSource = 
    New Uri("ms-appx:///Assets/Image/Agree.png", UriKind.Absolute) 

Upvotes: 2

Related Questions