


























首先在VS2008中新建一个silverlight工程,假定叫Test打开它。
一般默认会有四个文件,App.xaml,App.xaml.cs,Page.xaml,Page.xaml.cs.App.xaml 文件一般用来声明可在整个应用中共享的资源。App.xaml的后台Application类可用来处理应用级的事件,象Application_Startup, Application_Exit 和Application_UnhandledException。
在App.xaml中,
<Application x:Class="Test.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="XXX.xaml">
<Application.Resources>
</Application.Resources>
</Application>
x:Class="Test.App"指定了对应此XAML文件的后台类,格式为ProjectName.ClassName,
StartupUri="Page.xaml"指定了启动时加载的第一个xaml文件,这里是Page.xaml.
在Page.xaml中,
<Window x:Class="Test.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainPage" Height="300" Width="300">
<Grid>
</Grid>
</Window>
x:Class="Test.MainPage"与上面的意思一样。
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。