IEnumerable
IEnumerable

Reputation: 3790

How to display HTML content in Silverlight 5 control

I have a Silverlight project which is embedded in my Webpage.

The silverlight control must display HTML content, very basic stuff like

 <b> <font> <p> tags

However the Web browser control is only available in an out of browser app which mine isnt.

I looked for HtmlBrush as other suggested but cant find this control

So how do I add a text content control that can display HTML content?

UPDATE

I wasnt able to do this with the standard Silverlight restrictions. So what I found was a library that converted HTML,RTF to Silverlight RichText format.

The link I found is here Just in case anyone else could benifit from this.

Upvotes: 2

Views: 4462

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222522

You can make use of WebBrowser Control,

XAML:

  <Grid x:Name="LayoutRoot" Background="White">
            <Border Width="300" Height="200" BorderBrush="#000000" >
                <WebBrowser x:Name="webBrowser" />
            </Border>
     </Grid>

Code Behind:

public MainPage()
        {
            InitializeComponent();

            webBrowser.NavigateToString("<h1>HTML in Silverlight</h1><p>This is some <strong>simple HTML</strong>!</p>");
        }

read More here,

Html inside Silverlight

For browser inside application,

Not out of browser - HTML inside Silverlight

Upvotes: 3

Related Questions