小编joh*_*est的帖子

是否可以在加载内容之前更改WebBrowser控件的背景颜色?

我有一个页面,其中包含一个WebBrowser经常更新内容的控件.我使用的是黑色背景,但加载内容之前的默认颜色WebBrowser是白色.我可以通过加载一个背景设置为黑色的小HTML字符串来更改它,但仍然有一段时间WebBrowser显示为白色,因此会出现一种闪烁效果.

我的问题是:有没有办法改变底层控制的颜色WebBrowser

我已经尝试了一些解决方案,比如隐藏WebBrowser内容,直到内容被加载,但这些都没有感觉非常优雅,并且不能很好地工作.

c# silverlight windows-phone-7

12
推荐指数
1
解决办法
1万
查看次数

Windows Phone 7中的XDocument.Parse是否有所不同?

我在WP7应用程序和C#3.5应用程序中运行完全相同的代码.在WP7应用程序将引发NotSupportedException在调用XDocument.Parse(),而C#3.5应用程序解析没有问题的XML.以下是使用的代码:

WebClient client = new WebClient();
client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(DownloadThreadsComplete);
client.DownloadStringAsync(new Uri("http://us.battle.net/sc2/en/forum/40568/", UriKind.Absolute));

...

private static void DownloadThreadsComplete(object sender, DownloadStringCompletedEventArgs e)
{
    var doc = XDocument.Parse(e.Result);
}
Run Code Online (Sandbox Code Playgroud)

知道为什么会这样吗?奇怪的是,当一个魔兽世界论坛工作得很好时(http://us.battle.net/wow/en/forum/984270/)尝试解析SC2论坛时失败了.

编辑:

异常消息是"NotSupportedException".这是完整的堆栈跟踪:

   at System.Xml.XmlTextReaderImpl.ParseDoctypeDecl()
   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
   at System.Xml.XmlTextReaderImpl.Read()
   at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
   at System.Xml.Linq.XDocument.Parse(String text, LoadOptions options)
   at System.Xml.Linq.XDocument.Parse(String text)
   at SC2ForumReader.Pages.ForumViewerPage.DownloadThreadsComplete(Object sender, DownloadStringCompletedEventArgs e)
   at System.Net.WebClient.OnDownloadStringCompleted(DownloadStringCompletedEventArgs e)
   at System.Net.WebClient.DownloadStringOperationCompleted(Object arg)
   at System.Reflection.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi, Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly …
Run Code Online (Sandbox Code Playgroud)

c# silverlight windows-phone-7

3
推荐指数
1
解决办法
2205
查看次数

标签 统计

c# ×2

silverlight ×2

windows-phone-7 ×2