我正在尝试在 Windows Universal 应用程序中为我的图像定义源,但出现以下错误:
Invalid URI: The format of the URI could not be determined.
imagePath = "Assets/Category-other-dark.png";
Uri uri = new Uri(imagePath, UriKind.Absolute);
ImageSource imgSource = new BitmapImage(uri);
imgCategory.Source = imgSource;
我搜索了很多论坛并尝试了很多东西,但没有任何效果。谢谢。
最佳答案
将其更改为:
imagePath = "ms-appx:///Assets/Category-other-dark.png";
Uri uri = new Uri(imagePath, UriKind.RelativeOrAbsolute);
ImageSource imgSource = new BitmapImage(uri);
imgCategory.Source = imgSource;
关于C# - Windows 通用应用程序 - 图像源不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30921191/