ComponentOne Extended Library for WPF and Silverlight
Displaying HTML Markup
HtmlHost (Silverlight Only) > Task-Based Help > Displaying HTML Markup

HtmlHost for Silverlight supports displaying HTML markup. You set the C1HtmlHost.SourceHtml property to HTML markup that will be translated at run time; for example see the steps below.

At Design Time

To set the C1HtmlHost.SourceHtml property, complete the following steps:

  1. Click the C1HtmlHost control once to select it.
  2. Navigate to the Properties window and locate the SourceHtml item.
  3. Enter text in the text box next to the SourceHtml item; for example, enter "This is <b>HTML</b> hosted in a Browser!".

In XAML

For example, to set the C1HtmlHost.SourceHtml property add SourceHtml to the <c1:C1HtmlHost> tag so that it appears similar to the following:

XAML
Copy Code
<c1ext:C1HtmlHost Name="c1HtmlHost1" SourceHtml="This is &lt;b&gt;HTML&lt;/b&gt; hosted in a Browser!"/>

 

In Code

For example, to set the C1HtmlHost.SourceHtml property, add the following code to your project:

Visual Basic
Copy Code
Me.C1HtmlHost1.SourceHtml="This is &lt;b&gt;HTML&lt;/b&gt; hosted in a Browser!"
C#
Copy Code
this.C1HtmlHost1.SourceHtml="This is &lt;b&gt;HTML&lt;/b&gt; hosted in a Browser!";

 

 

 What You've Accomplished

The C1HtmlHost control will now display HTML text at run time. Note that in the markup above the "&lt;" and "&gt;" were used for the "<" and ">" symbols. So, for example a tag to make the text bold, which would normally appear like "<b>" is written as "&lt;b&gt;".

See Also