Step 2 of 3: Adding Code to the Application

In the last step you set up a Silverlight application, but if you run your application the button and text box currently do nothing. In this step you'll continue by adding code to add functionality to the application.

Complete the following steps:

1.   Navigate to the Solution Explorer, right-click MainPage.xaml file, and select View Code to switch to Code view.

2.   In Code view, add the following import statement to the top of the code page:

      Visual Basic

      C#

3.   Add the following event handler to the MainPage.xaml.cs file, below all the other methods in the MainPage class:

      Visual Basic

      C#

This code handles the button's Click event and customizes the C1HtmlHost control.

 What You've Accomplished

In this step you added code to add functionality to your application – now when a user enters a URL in the text box and clicks the button at run time, the C1HtmlHost control will display the selected Web site. In the next step you'll run your application and observe some of the run-time interactions possible with ComponentOne HtmlHost for Silverlight.


Send us comments about this topic.
Copyright © GrapeCity, inc. All rights reserved.