Silverlight で遊び始めたので書いてみます。
まず、画面を定義する XAML です。
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="120"
Height="80" >
<Canvas.Background>
<LinearGradientBrush StartPoint="0,0.5"
EndPoint="1,0.5">
<LinearGradientBrush.GradientStops>
<GradientStop Color="#FF000000" Offset="0"/>
<GradientStop Color="#FFA09E9E" Offset="1"/>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Canvas.Background>
</Canvas>
ついで、全体のコンテナとなる HTML ファイルを示します。
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Weather Map</title>
<script type="text/javascript" src="Silverlight.js"></script>
</head>
<body>
<div id="silverlight"></div>
<script type="text/javascript" src="test.js">
</script>
</body>
</html>
そして、Silverlight のメインとなる ECMA Script ファイルを示します。
// Loading silverlight
var parentElement = document.getElementById("silverlight");
Silverlight.createObject(
"test.xaml",
parentElement,
"sl00",
{
width: "120",
height: "80",
background: "#FFFFFF",
version: "1.0"
},
{
onError: null,
onLoad: null
},
null,
null
);
これで、システム全体としては動きます。一応、ものを以下に張り付けておきます。

