Jan*_*upa 3 c# windows windows-phone win-universal-app
我正在尝试在Windows Universal应用程序中为我的图像定义源代码,但它给我提供了以下错误:
无效的URI:无法确定URI的格式.
imagePath = "Assets/Category-other-dark.png";
Uri uri = new Uri(imagePath, UriKind.Absolute);
ImageSource imgSource = new BitmapImage(uri);
imgCategory.Source = imgSource;
Run Code Online (Sandbox Code Playgroud)
我搜索了许多论坛并尝试了很多东西,但没有任何作用.谢谢.
将其更改为:
imagePath = "ms-appx:///Assets/Category-other-dark.png";
Uri uri = new Uri(imagePath, UriKind.RelativeOrAbsolute);
ImageSource imgSource = new BitmapImage(uri);
imgCategory.Source = imgSource;
Run Code Online (Sandbox Code Playgroud)