c# - 如何打开 WPF 内容流?

标签 c# wpf stream uri

这是代码片段

String str= ??????? // I want to assign c:/my/test.html to this string
Uri uri= new Uri (str);
Stream src = Application.GetContentStream(uri).Stream;

正确的做法是什么?我收到“URI notrelative”异常抛出

最佳答案

您的问题特定于 WPF。请参阅Application.GetContentStream方法。

您将了解到此方法需要相对 URI。请参阅“WPF Application, Resource, Content and Data files”。

关于c# - 如何打开 WPF 内容流?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2861976/

相关文章:

c# - 使用 Cellular Towers C# Windows Mobile 获取位置的多个小区 ID

apache-kafka - Kafka Streams 如何获取 kafka header

objective-c - 如何在 Objective-C 中保持输出流打开?

java - 从 XML 元素内容中获取 InputStream

c# - .NET Windows 服务 (WTSSendMessage) : Displays message on XP but not Windows 7

c# - C# 对 native 互操作的限制

c# - 为什么我不能直接将自定义事件参数类传递到订阅我的事件的方法中?

c# - 按需 IEnumerable 绑定(bind)到 ListBox

c# - C# .WPF 中的线程调用

c# - WPF MVVM 代码隐藏