Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 用于显示htmlcode的Wpf控件_C#_Asp.net_.net_Html_Wpf - Fatal编程技术网

C# 用于显示htmlcode的Wpf控件

C# 用于显示htmlcode的Wpf控件,c#,asp.net,.net,html,wpf,C#,Asp.net,.net,Html,Wpf,我正在使用Hit-on服务器并在拖缆中获取内容。 然后我使用一个字符串来获取网站的Html代码。 我必须在WPF应用程序中使用它。 我应该使用哪个控件来放置包含html代码的url以显示在我的wpf中,以及如何使用 string urlcode; HttpWebRequest request = WebRequest.Create("http://google.com/") as HttpWebRequest; HttpWebResponse re

我正在使用Hit-on服务器并在
拖缆中获取内容。
然后我使用一个字符串来获取网站的Html代码。
我必须在WPF应用程序中使用它。
我应该使用哪个控件来放置包含html代码的url以显示在我的wpf中,以及如何使用

        string urlcode;
        HttpWebRequest request = WebRequest.Create("http://google.com/") as HttpWebRequest;
        HttpWebResponse response = request.GetResponse() as HttpWebResponse;
        StreamReader streamr = new StreamReader(response.GetResponseStream());
        urlcode = streamr.ReadToEnd();

使用
导航窗口
包含页面。然后可以调用
Navigate(Uri)
方法从一页遍历到另一页

使用控件及其方法:

XAML:


这是一个简化的例子。导航完成后,您至少必须关闭/处理响应对象。

您可以使用web浏览器控件,将包含HTML控件的字符串传递给其NavigateToString方法

  webB.NavigateToString(@"<html>HTML code go here </html>");
webB.NavigateToString(@“HTML代码转到此处”);

在预览选项卡上嵌入WebBrowser控件,并使用NavigateToString或NavigateToStream方法将HTML传递到其中。

此处无新闻。为什么你要回答别人以前回答过的问题?
WebRequest request = WebRequest.Create("http://google.com");
webBrower.NavigateToStream(request.GetResponse().GetResponseStream());
  webB.NavigateToString(@"<html>HTML code go here </html>");