在用vs2010作silverlight4 的时候,查看设计页面出现下面问题,不知各位大仙怎么解决此问题的,谢谢。
[HtmlPage_NotEnabled]
Arguments:
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=8.0.50401.0&File=System.Windows.Browser.dll&Key=HtmlPage_NotEnabled
at System.Windows.Browser.HtmlPage.VerifyThreadAndEnabled()
at System.Windows.Browser.HtmlPage.get_Document()
如图所示 :
google之后,才知道出错原因是用了htmlPage这个类,然后就发现了另一个东东System.ComponentModel.DesignerProperties,试试管用,好了还是赶紧分享给大家的好:
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
// Did the QueryString contain an Email address?
if (HtmlPage.Document.QueryString.Keys.Contains("Email") )//此外为出错的地方
txtEmailTo.Text = HtmlPage.Document.QueryString["Email"].ToString();
}
Luckily, there is a special class, System.ComponentModel.DesignerProperties, which allows us to check at runtime whether we are in Design Mode or not. We can just add a check on this, and if we are in Design Mode, we get out of the Loaded event handler:
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
if (DesignerProperties.GetIsInDesignMode(this))// 在出错前加上这句判断和return语句,就ok 了
return;
// Did the QueryString contain an Email address?
if (HtmlPage.Document.QueryString.Keys.Contains("Email") )
txtEmailTo.Text = HtmlPage.Document.QueryString["Email"].ToString();
}
此解决方法原文地址:http://www.andybeaulieu.com/Home/tabid/67/EntryID/158/Default.aspx
这个地址中的:Blend Artboard Exceptions and Loaded Event 文章