.xam,在vs.net的解决方案浏览窗口中可以看到有两个文件,SilverlightControl1.xaml以及后台代码文件SilverlightControl1.xam.cs。
Xaml文件里面的内容是一段xaml代码,如下所示:
<UserControx:Class="Shareidea.Web.UI.Contro.Workflow.Designer.SilverlightControl1"
xmlns="http://schemas.microsoft.com/winfx/2006/xam/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xam"
Width="400" Height="300">
<Grid x:Name="LayoutRoot" Background="White">
</Grid>
</UserContro>
这个是一个标准的xaml文件,宽400高300,包含一个名称为LayoutRoot的Grid对象。
SilverlightControl1.xam.cs文件内容如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace Shareidea.Web.UI.Contro.Workflow.Designer
{
public partiaclass SilverlightControl1 : UserContro
{
public SilverlightControl1()
{
InitializeComponent();
}
}
}
开头的命名空间包含了silverlight常用的命名空间。
需要说明的有以下几点:
这个类使用了partia(部分类)的方式声明
另一个需要注意的是,构造函数内的InitializeComponent,我们使用vs.net的追踪到这个函数的实现,可以在vs.net中打开一个新的文件,文件名称为SilverlightControl1.g.cs.他的代码如下所示:
#pragma checksum "D:\webapp\AutoForm\workflow\ShareDesigner\ShareDesigner\SilverlightControl1.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "4F852CC5E0AFC0A2BA980AB6BBB4D9E6"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a too.
// Runtime Version:2.0.50727.3053
//
// Changes to this file may cause incorrect behavior and wilbe lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Automation.Peers;
using System.Windows.Automation.Provider;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Resources;
using System.Windows.Shapes;
using System.Windows.Threading;
namespace Shareidea.Web.UI.Contro.Workflow.Designer {
public partiaclass SilverlightControl1 : System.Windows.Controls.UserContro{
internaSystem.Windows.Controls.Grid LayoutRoot;
private boo_contentLoaded;
/// <summary>
/// InitializeComponent
/// </summary>
|