In this step you'll create a Silverlight application in Visual Studio which will use HtmlHost for Silverlight to display a Web site. You'll create a new Silverlight project and add controls to your application.
To set up and add controls to your application, complete the following steps:
<StackPanel Name="StackPanel1" Margin="10" Orientation="Vertical"></StackPanel>
This markup adds a margin and sets the panel's orientation.
<c1:C1HtmlHost Name="C1HtmlHost1" Margin="5" SourceUri="http://www.componentone.com" />
This markup names the control, adds a margin, and sets the C1HtmlHost.SourceUri property which sets the Web site or page that will initially appear in the C1HtmlHost control when the application is loaded.
XAML Copy Code <StackPanel Name="StackPanel2" Orientation="Horizontal"> <TextBlock Height="23" HorizontalAlignment="Left" Margin="5" Name="TextBlock1" Text="Source URI:" VerticalAlignment="Top" /> <TextBox Height="23" Name="TextBox1" Width="200" Margin="5" Text="http://www.componentone.com" /> <Button Content="Set Source URI" Height="23" Name="Button1" Margin="5" /> </StackPanel>
The markup above adds a StackPanel that contains a TextBlock, TextBox, and Button. When the user enters a URL in the text box at run time and presses the button, the C1HtmlHost control will display the entered Web site. Your markup will now appear similar to the following:
XAML Copy Code <Grid x:Name="LayoutRoot" Background="White"> <StackPanel Margin="10" Name="StackPanel1" Orientation="Vertical"> <c1:C1HtmlHost Name="C1HtmlHost1" Margin="5" SourceUri="http://www.componentone.com" c1:C1NagScreen.Nag="True" /> <StackPanel Name="StackPanel2" Orientation="Horizontal"> <TextBlock Height="23" HorizontalAlignment="Left" Margin="5" Name="TextBlock1" Text="Source URI:" VerticalAlignment="Top" /> <TextBox Height="23" Name="TextBox1" Width="200" Margin="5" Text="http://www.componentone.com" /> <Button Content="Set Source URI" Height="23" Name="Button1" Margin="5" /> </StackPanel> </StackPanel> </Grid>
XAML Copy Code <param name="windowless" value="true" />
What You've Accomplished
You've successfully created and set up a Silverlight application and added controls, including a C1HtmlHost control, to the page. In the next step you'll add code to add functionality to your application.