Application.GetContentStream返回内容乌里空 [英] Application.GetContentStream returns null for content Uri

查看:302
本文介绍了Application.GetContentStream返回内容乌里空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的项目设置为内容文件sample.xml中。

I have file "sample.xml" in my project set as content.

我运行此code:

  Uri uri = new Uri("/sample.xml", UriKind.Relative);
  StreamResourceInfo contentStream = Application.GetContentStream(uri);

为什么返回null contentStream?

Why it returns null contentStream?

推荐答案

这意味着可能是未找到该文件。的路径是正确的吗?

It means probably that it does not find the file. Is the path correct?.

返回值

类型:System.Windows.Resources.StreamResourceInfo

Type: System.Windows.Resources.StreamResourceInfo

这包含了位于定URI的内容数据文件StreamResourceInfo。 如果没有找到一个松散的资源,则返回null。

A StreamResourceInfo that contains a content data file that is located at the specified Uri. If a loose resource is not found, null is returned.

这篇关于Application.GetContentStream返回内容乌里空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆