-
Notifications
You must be signed in to change notification settings - Fork 75
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 (
pandh1/h2/h3tags): ParagraphGenerator - Italic and bold font (
emandstrongtag) - Link (
atag) - Image (
imgtag) - Unordered lists (
ulandlitags)
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.