Monthly Archives: October 2011

InvalidOperationException in Silverlight designer

After creating a BasePage for all my pages and moving the DomainContext initialization to the base class, I got this design time error:

The current instance of WebContext is not available. You must instantiate a WebContext and add it to Application.ApplicationLifetimeObjects within the default App constructor.

Looks like a Silverlight bug, but all I did is checking the design time at the beginning of the constructor:

public BasePage()
{
   if (DesignerProperties.IsInDesignTool) return;
   ...
}

That’s it!

RTL richtext support in Silverlight

Well, the bottom line – there is no proper solution for a HTML like RTL support in Silverlight.
I’ve checked several approaches:

  • Using Telerik RadRichTextBox
  • Trying to implement it using embedded HTML browser control

It is possible to make RTL richtext working in Silverlight, but there remains one serious issue – mixed RTL and LTR support

Using Telerik RadRichTextBox
For some strange reason Telerik actually supported RTL richtext till Q2 release where they seriously messed up. If you download the Q1 2011 version, you will be able to use the RTL support without any problems. Telerik support admitted that it’s a bug, but in order to fix it, people should vote for it. Sounds weird, right?
So Telerik controls are off the table.
Read more »

Create base page for Silverlight Page

If you would like to create a base page with common functionality – create your own base page and derive each new page from the base class.

Create BasePage.cs

namespace MyApp.Views
{
    public class BasePage:Page
    {
    }
}

Derive the real page from the BasePage.cs

namespace MyApp.Views
{
    public partial class NewPage: BasePage
    {
    }
}

Now if you compile the project you will get the following error:
Partial declarations of ‘MyApp.Views.NewPage’ must not specify different base classes

Here you should do two more steps: Read more »