我为Windows Phone 8.1编程。我用这种方式创建图像并设置图像源:
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
当我启动模拟器时,它不起作用。为什么? (说错误)
答案 0 :(得分:2)
在Windows Phone 8.1中,png等资源应该使用ms-appx
:
AgreeBitmapImage.UriSource =
New Uri("ms-appx:///Assets/Image/Agree.png", UriKind.Absolute)