开发者

How to display an xhtml file?

开发者 https://www.devze.com 2023-04-06 18:20 出处:网络
I have a TreeView that represents a book. Each chapter of the book is in xhtml format (unzipped from epub). The paths of the chapters are stored as Tags of the TreeView items. I need to display a sele

I have a TreeView that represents a book. Each chapter of the book is in xhtml format (unzipped from epub). The paths of the chapters are stored as Tags of the TreeView items. I need to display a selected chapter upon click on a TreeView element.

Could you开发者_开发问答 please tell what is the best way to display an xhtml document? What control is the best for this purpose?


You can use the a WebBrowser control and then set the Source property to your XHTML file url. If the tag is not pointing to a XHTML file but directly to raw HTML text, you maybe need to create this file as the Source property is a Uri object.

That is definitely the way to display HTML in WPF.


Microsoft has a demo of how to convert XAML to XHTML and vice-versa. This should get you most of the way to where you're going.

0

精彩评论

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

关注公众号