开发者

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

开发者 https://www.devze.com 2023-02-09 10:57 出处:网络
I have some html documents like this: <HTML> <BODY> <p style=\"text-align:Left;font-size:20;font-famil开发者_JAVA百科y:Calibri;font-weight:normal;font-style:normal;color:#000000;\">

I have some html documents like this:

<HTML>
  <BODY>
    <p style="text-align:Left;font-size:20;font-famil开发者_JAVA百科y: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.


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.


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!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号