Vincent Leung .NET Tech Clips

Creating MasterPage in Silverlight

Advertisements

 

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

Advertisements