Displaying HTML Markup

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

At Design Time

To set the 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 SourceHtml property add SourceHtml to the <c1:C1HtmlHost> tag so that it appears similar to the following:

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

In Code

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

      Visual Basic

      C#

 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;".


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