我将
HTML-Source字符串保存在HTMLReport字段中称为“Report”的SQL Server表中(字段类型为NTEXT).现在我需要显示存储的HTML
进入WPF窗口.需要在此WPF窗口上解释HTML标记和内联CSS.
有人可以帮我完成这段代码吗?
HTMLView.xaml
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
Title="HTML View" Height="454" Width="787"
>
HTMLViewModel.cs
namespace MyProject
{
public class HTMLViewModel: ViewModelBase
{
public HTMLViewModel()
{
//Reading from SQL Server table
//SELECT HTMLReport FROM Report WHERE ID=123
//OK, I have HTMLString from database over here
//Now I am assigning that to DisplayHTML Property
DisplayHTML ="
This text should be in table with bold fond |
}
private string _displayHTML;
public string DisplayHTML
{
get
{
return _displayHTML;
}
set
{
if (_displayHTML!= value)
{
_displayHTML= value;
OnPropertyChanged("DisplayHTML");
}
}
}
}