Mrainy
Mrainy

Reputation: 65

How to insert HTML content into Silverlight? Is it possible?

I have some html documents like this:

<HTML>
  <BODY>
    <p style="text-align:Left;font-size:20;font-family:Calibri;font-weight:normal;font-style:normal;color:#000000;">
      <span>asfsdf</span>
    </p>
  </BODY>
</HTML>

I'd like to display them in Silverlight 4. They would be some read-only content. Is it possible?

In our Silverlight application we have some ChildWindow. Also, I have a HTML to XAML converter but I don't want to display it after converting.

Upvotes: 2

Views: 5508

Answers (2)

Vladimir Dorokhov
Vladimir Dorokhov

Reputation: 3839

Here I've detailed written about edit and view rich text formats in Silverlight 4. You can implement your own HtmlViewer control, which will work in windowless mode of silverlight or use one of those third party controls. Good luck!

Upvotes: 0

Jeff Yates
Jeff Yates

Reputation: 62367

There are two ways to achieve this, depending on where Silverlight is hosted.

  1. Out-of-browser
    You can use the WebBrowser control.

  2. In-browser
    You can float HTML over the top of your Silverlight control to make it appear as though the content is in your control. You have to set windowless to true for this to work. This blog has a nice explanation on how to use this approach.

Upvotes: 3

Related Questions