- Open Visual Studio and Click File->New Project… And Select Silverlight Application in Silverlight Templates. You can give a name to the project say MyFirstApplication and click OK.
- This is to select whether you need to add a web application in the solution to host the silverlight file(xap). This is optional depending upon your requirement. This is similar to adding projects to a solution.
- Drag and drop a Button and TextBlock control from the ToolBox in MainPage.xaml. You may adjust the width of TextBlock. Then double click the button to go to the ‘button1_Click’ event in the code file(MainPage.xaml.cs). You may be able to see other available events for the control in the Events tab in Properties window. Double click a event to go to the particular event.
private void button1_Click(object sender, RoutedEventArgs e)
{
textBlock1.Text = "Hello, Welcome to silverlight";
}
- Press F5 to start debugging the silverlight application.
Click here to download the sample file
Share it
No comments:
Post a Comment