-
Notifications
You must be signed in to change notification settings - Fork 76
HtmlView
Rico Suter edited this page Jan 13, 2016
·
12 revisions
- Package: MyToolkit.Extended
- Platforms: WP7SL, WP8SL, WinRT, UWP
With this control you can display HTML without using the WebBrowser control. The control uses an extendable parser which generates native controls.
The following UI control generators are implemented:
- Paragraph (
p
andh1/h2/h3
tags): ParagraphGenerator - Italic and bold font (
em
andstrong
tag) - Link (
a
tag) - Image (
img
tag) - Unordered lists (
ul
andli
tags)
If you need scrollbars, use the ScrollableHtmlView control for much better performance (instead of putting the HtmlView into a ScrollViewer).
The generated HTML elements can be enhanced or changed by adding or modifying existing generators:
MyHtmlView.GetGenerator<ParagraphGenerator>("h1").FontWeight = FontWeights.Bold;
MyHtmlView.GetGenerator<ParagraphGenerator>("h2").FontWeight = FontWeights.Bold;
MyHtmlView.GetGenerator<ParagraphGenerator>("h3").FontWeight = FontWeights.Bold;
It is also possible to implement new generators for other HTML tags. If the generators are changed when the HTML is already set, call MyHtmlView.Refresh()
to rerender the HTML.
HtmlView.GetGenerator<LinkGenerator>("a").Foreground =
(Brush) Resources["ApplicationForegroundThemeBrush"];
- Some generators are missing in the WinRT version.