File -> New Project, Choose Silverlight project type

Add ASP.NET Web Application Project

Right click and Build Solution

Paste code below to Page.xaml
<Grid x:Name="LayoutRoot" Background="White">
<Button Height="56" HorizontalAlignment="Left" Margin="38,0,0,67" VerticalAlignment="Bottom" Width="116" Content="Button" x:Name="btnSayHello"/>
<TextBox Height="46" Margin="38.049,44,0,0" VerticalAlignment="Top" Text="TextBox" TextWrapping="Wrap" HorizontalAlignment="Left" Width="150.5" Background="#FFFFFFFF" x:Name="txtMessage"/>
</Grid>
|
Paste code below to Page.xaml.cs
public Page()
{
InitializeComponent();
btnSayHello.Click += new RoutedEventHandler(btnSayHello_Click);
}
private void btnSayHello_Click(object sender, RoutedEventArgs e)
{
txtMessage.Text = "Milk It Does Body Good!";
}
|
Right click on CreatingSilverlightAppTestPage.aspx and select Set As Start Page
Right click on CreatingSilverlightApp.Web and select Set As StartUp Project
Hit F5

File -> New Project, Choose Silverlight project type

Add ASP.NET Web Application Project

Right click and Build Solution

Paste code below to Page.xaml
<Grid x:Name="LayoutRoot" Background="White">
<Button Height="56" HorizontalAlignment="Left" Margin="38,0,0,67" VerticalAlignment="Bottom" Width="116" Content="Button" x:Name="btnSayHello"/>
<TextBox Height="46" Margin="38.049,44,0,0" VerticalAlignment="Top" Text="TextBox" TextWrapping="Wrap" HorizontalAlignment="Left" Width="150.5" Background="#FFFFFFFF" x:Name="txtMessage"/>
</Grid>
|
Paste code below to Page.xaml.cs
public Page()
{
InitializeComponent();
btnSayHello.Click += new RoutedEventHandler(btnSayHello_Click);
}
private void btnSayHello_Click(object sender, RoutedEventArgs e)
{
txtMessage.Text = "Milk It Does Body Good!";
}
|
Right click on CreatingSilverlightAppTestPage.aspx and select Set As Start Page
Right click on CreatingSilverlightApp.Web and select Set As StartUp Project
Hit F5
