Hey everyone

Can anyone give me some pointers about how to embed a SilverLight control in my EpiServer pages?

All I can find is this tutorial:

but unfortunatly it's pretty old and a lot seems to have changed with Silverlight assemblies :s


Sep 06, 2011 11:15

I've managed to figure this out, so I'll post my code here for anyone who can use it:

So I just created a User Control, frontend:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SilverlightControl.ascx.cs" 
Inherits="V.Templates.DynamicContent.SilverlightControl" %>

<div id="silverlightControlHost" runat="server">
    <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="550px" height="400px">
    <param name="source" value="/control.xap"/>
    <param name="onError" value="onSilverlightError" />
    <param name="background" value="#eeeeee" />
    <param name="minRuntimeVersion" value="4.0.50826.0" />
    <param name="autoUpgrade" value="true" />
    <a href="" style="text-decoration:none">
        <img src="" alt="Get Microsoft Silverlight" style="border-style:none"/>

    <iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe>

and backend:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using EPiServer.DynamicContent;
using EPiServer.PlugIn;

namespace V.Templates.DynamicContent
            DisplayName = "Silverlight component",
            Description = "Silverlight component",
            ViewUrl = "~/Templates/DynamicContent/SilverlightControl.ascx")]

    public partial class SilverlightControl : EPiServer.UserControlBase
        protected override void OnLoad(EventArgs e)

The position of the .xap-file is really important, so make sure you put this in the right place.

Edited, Sep 07, 2011 11:11
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.