设置图像控制的源图像

时间:2014-08-06 07:52:59

标签: vb.net image windows-phone-8.1

我为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

当我启动模拟器时,它不起作用。为什么? (说错误)

1 个答案:

答案 0 :(得分:2)

在Windows Phone 8.1中,png等资源应该使用ms-appx

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