Showing posts with label Silverlight Designer Error. Show all posts
Showing posts with label Silverlight Designer Error. Show all posts

Thursday, April 19, 2012

Silverlight Designer Error

Silverlight Problem in Design Mode:

When Created Control in Silverlight I found error in design mode:


System.Reflection.TargetInvocationException

[Async_ExceptionOccurred]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=4.0.50401.0&File=System.dll&Key=Async_ExceptionOccurred


After many invesigation I discovered I used HtmlPage object (Need browser to execute this line of code).
To fix this didn't execute Html object in design mode example:


if (!DesignerProperties.IsInDesignTool)
{
var height = HtmlPage.Document.Body.GetProperty("clientHeight");
var width = HtmlPage.Document.Body.GetProperty("clientWidth");
this.LayoutRoot.Width = double.Parse(width.ToString());
this.LayoutRoot.Height = double.Parse(height.ToString());
}