查看完整版本: silverlight vs2008 用VS2008进行Silverlight的开发

wpf 2008-6-12 11:25

silverlight vs2008 用VS2008进行Silverlight的开发

在Solution Explorer中,点击Show All Files按钮来查看所有VS自动生成的代码。图2显示了所有文件。中国Web技术站 [L+{'I:k n
中国Web技术站&N3i@Q~|6nEWd

({4JPe0Q)O 中国Web技术站6T-Sw7`+` CeA!i)IH
图2
`0^'nQf 中国Web技术站/s1r_(RZ ?-}d d
  下面一节包含了该Silverlight工程里的基本文件的讲解:
3gn5U3q M o8D#q9w)a4RI M 中国Web技术站f? Tw1AUm
  TestPage.html中国Web技术站L4S4w'B7ndB
中国Web技术站nJQk1sZi,I},U
  这是一个测试页,用来测试Silverlight程序。它包含了Silverlight控件并引用了两个JavaScript文件:Silverlight.js和TestPage.html.js。下面是Testpage.html的内容:
O)S1K"H.pw 中国Web技术站j3d!u J9|0v
以下是引用片段:中国Web技术站`(|8H(HX:Qn6p
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[url=http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd[/url]">
Ck]q*SI Lh N<html xmlns="[url=http://www.w3.org/1999/xhtml]http://www.w3.org/1999/xhtml[/url]" > 中国Web技术站qg%iF8Lc$rlN
<!-- saved from url=(0014)about:internet --> 中国Web技术站lZ$Z#Z*VA3v@{
<head> 中国Web技术站(^hC'X` ?
    <title>Silverlight Project Test Page </title>
7rx-F5y`U'\     
:o7E2s"J5pN    <script type="text/javascript" src="Silverlight.js"></script> 中国Web技术站0jIe'D#I
    <script type="text/javascript" src="TestPage.html.js"></script>
VB3nE(uLqQ7~"Y    <style type="text/css"> 3b/b[ _b-J|J!@
        .silverlightHost { width: 640px; height: 480px; }     </style> </head>

    <div id="SilverlightControlHost" class="silverlightHost" >
aMr;ZNY:WF ?xO$d        <script type="text/javascript"> 中国Web技术站,{{,L&X%@1rt(J
            createSilverlight(); 中国Web技术站\Ob%r:J^
        </script>
B Mr"xf"b    </div>
U5a h&fs4M"g7y</body>
SfC5FKo.FW</html>
"Em,J3o*o;d
\ TZ'w&wm T;C

  包含Siverlight控件的HTML页面页可以包含通常的HTML元素来构成一个web页面。当你双击Solution Explorer中的Testpage.html,VS2008将会在一个分离视图里展示页面,这是VS2008的新特性。使用分离视图,你可以在浏览HTML代码时同时预览它在浏览器中的效果。
页: [1]
查看完整版本: silverlight vs2008 用VS2008进行Silverlight的开发