微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

vs2010+silverlight4 error

在用vs2010作silverlight4 的时候,查看设计页面出现下面问题,不知各位大仙怎么解决此问题的,谢谢。

[HtmlPage_NotEnabled]
Arguments:
Debugging resource strings are unavailable. Often the key and arguments provide sufficient @R_445_4045@ion 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 文章

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐