You can use lite asp:Xaml component without waiting for Asp.Net 3.5 Extensions.
Here you can download Elisy.Web.Silverlight server control that simplifies rendering
of Silverlight html and js code. It was tested with Silverlight version 1.1 only.
- Copy Elisy.Web.dll assembly into Bin folder
- Add <%@ Register Assembly="Elisy.Web" Namespace="Elisy.Web" TagPrefix="els" %>
construction into your aspx-file
- Add control into aspx-file in the following format: <els:Silverlight Version="1.1"
ID="Silverlight1" runat="server" Background="#0000FF00" Width="300" Height="300"
Source="Sample.xaml" />
- Create Sample.xaml (in the root for this example)
Or see the "Www" example in the zip-file.
Server control – Silverlight control properties reflection table:
|
Silverlight Property
|
ASP.Net control property
|
Description (from Silverlight SDK documentation)
|
|
source
|
Source
|
Refers to the XAML content file
|
|
id
|
ID + "Control"
|
Refers to the unique identifier of the instantiated Silverlight plug-in within the
HTML DOM.
|
|
width
|
Width
|
Defines the width of the rectangular region that displays the Silverlight content.
|
|
height
|
Height
|
Defines the height of the rectangular region that displays the Silverlight content.
|
|
version
|
Version
|
Specifies the Silverlight version required to run the application. The version initialization
parameter is compared with the version of the currently installed Silverlight runtime.
|
|
background
|
Background
|
Specifies the background color of the rectangular region that displays XAML content.
|
|
isWindowless
|
IsWindowless
|
Determines whether the plug-in displays as a windowless plug-in.
|
|
enableHtmlAccess
|
EnableHtmlAccess
|
Determines whether the plug-in has access to the browser DOM.
|
In HTML page the resulting code will be like this:
<script src="/Www/WebResource.axd?d=up3euxHNl5PE1F6F1HHQovCWPIJ-v9hLoidDBzrEQD4vipEt5Tat0f2w4agOP9gR0&t=633380923580000000"
type="text/javascript"></script>
<div id="Silverlight1Host" style="width:300px;height:300px;">
<script type="text/javascript"> Silverlight.createObjectEx({ source: "Sample.xaml",
parentElement: document.getElementById("Silverlight1Host"), id: "Silverlight1Control",
properties: { width: "300", height: "300", version: "1.1", background: "#0000FF00",
isWindowless: "true", enableHtmlAccess: "true"}, events: {}}); </script> </div>
silverlight-server-control.zip (14.48 kb)
Currently rated 5.0 by 4 people
- Currently 5/5 Stars.
- 1
- 2
- 3
- 4
- 5