I need to display HTML content inside the WPF. Here is my XAML code:
<WebBrowser Source="Views/Sample.html"></WebBrowser>
Thanks.
I need to display HTML content inside the WPF. Here is my XAML code:
<WebBrowser Source="Views/Sample.html"></WebBrowser>
Thanks.
Hi I am updating the answer better
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
var exePath = AppDomain.CurrentDomain.BaseDirectory;
var pagesFolder = Directory.GetParent(exePath).Parent.Parent;
string homePageFullPath = pagesFolder.FullName + "\\Pages\\Home.html";
WebBrowser1.Source = new Uri(homePageFullPath);
}
}
You need to have the home.html in the bin folder where the wpf exe is located. You can make the "Copy To Output Directory" as "Copy Always"
The above one is working for me.
If the file is in a different folder please have the absolute path