Creating MasterPage in Silverlight


 

About how to implement MasterPage in Silverlight 2.0, most of the posts are about using “fixed” UserControls and dynamically change the content of a control in code-behind. Here is another solution where a Template will be used instead.

The ContentControl has a Template property we can use to specify the Template of the ContentControl. To create a template we can for example use the <Style> element. The Template property will have a child element of type ControlTemplate which can be used to define a template. And the ControlTemplate will have a child element of <ContentPresenter> which can be used in a similar way as <ContentPlaceholder> is used within a ASP.Net MasterPage. The Content of the <ContentPresenter> will be the Content (i.e. the page specific content) from the <ContentControl> which will use the “myMasterPage” template.

For the code please visit MasterPage and Silverlight – Fredrik Normén

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s