I've been desperately looking for an easy way to display HTML in a WPF-application.
There are some options:
1) use the WPF WebBrowser Control
2) use the Frame Control
3) use a third-party control
but, i've ran into the following problems:
1) the WPF WebBrowser Control is not real WPF (it is a Winforms control wrapped in WPF). I have found a way to create a wrapper for this and use DependencyProperties to navigate to HTML text with bindings and propertychanged.
The problem with this is, if you put a Winforms control in WPF scrollviewer, it doesnt respect z-index, meaning the winform is always on top of other WPF control. This is very annoying, and I have tried to work around it by creating a WindowsFormsHost that hosts an ElemenHost etc.. but this completely breaks my binding obviously.
2) Frame Control has the same problems with displaying if it shows HTML content. Not an option.
3) I haven't found a native HTML-display for WPF. All options are winforms, and with the above mentioned problems.
the only way out I have at the moment is using Microsoft's buggy HtmlToXamlConverter, which crashes hard sometimes. (MSDN)
Does anybody have any other suggestions on how to display HTLM in WPF, without these issues?
sorry for the long question, hope anyone knows what i'm talking about...
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…