It can be frustrating when you are coding along in Silverlight, and you open up a UserControl in Blend only to see something like the following:

An Exception was thrown.
InvalidOperationException: HtmlPage_NotEnabled
StackTrace
InnerException: None
This is often caused by a UserControl that has a Loaded event with some code that isn't happy inside Blend's artboard. That's right - when you preview a UserControl inside Blend, the Loaded event for the control actually fires, and code in that handler is executed! You may have noticed this when you place a StoryBoard.Begin() call in the Loaded event, Blend will actually show the animation on the artboard.
So how do we workaround these exceptions? First, expand the StackTrace arrow, and you'll get some more details. In this case, we can see that the Loaded event for a UserControl named "ucResults" is the culprit:

Now that we know which Loaded event is causing the issue, take a look at the code and see what is going on. In this case, the code is accessing the HtmlPage class - which would not be available to Blend when it hosts the control on the artboard:
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;
// Did the QueryString contain an Email address?
if (HtmlPage.Document.QueryString.Keys.Contains("Email") )
txtEmailTo.Text = HtmlPage.Document.QueryString["Email"].ToString();
}