小编Cla*_*aut的帖子

在Android中暂时禁用互联网访问?

我想设置一个测试,看看我的代码是否在没有互联网访问时正常工作.有没有办法暂时关闭互联网访问测试?

我试着环顾四周,但我找不到它.

testing android

7
推荐指数
1
解决办法
3486
查看次数

相对 URI 在 BitmapImage 中不起作用

我有一种通过绑定加载图像供以后使用的方法。

当我按如下方式设置它时,它可以工作:

public static ImageSource LoadImage()
{
    return new BitmapImage(
        new Uri("C:/User/Name/Documents/Visual Studio 2015/Projects/Project/bin/debug/subfolder/sprite.png", UriKind.Absolute));
}
Run Code Online (Sandbox Code Playgroud)

但是,当我切换到简单地使用时:

public static ImageSource LoadImage()
{
    return new BitmapImage(
        new Uri("/subfolder/sprite.png", UriKind.Relative));
}
Run Code Online (Sandbox Code Playgroud)

XAML 不显示图像。我看了看Environment.CurrentDirectory它又回来了"C:/User/Name/Documents/Visual Studio 2015/Projects/Project/bin/debug/"

我已经用谷歌搜索了一个解决方案,但似乎什么也看不到。

c# wpf xaml

5
推荐指数
1
解决办法
1491
查看次数

标签 统计

android ×1

c# ×1

testing ×1

wpf ×1

xaml ×1