I have to display multiple HTML contents on a single window. These data come as strings. Every string represents one HTML file data.
I am using webbrowser control and stackpanel layout to display them on a single window.
<Grid >
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel Background="YellowGreen">
<WebBrowser Margin="5" Loaded="WebBrowser_Loaded"/>
<WebBrowser Margin="5" Loaded="WebBrowser_Loaded" />
<WebBrowser Margin="5" Loaded="WebBrowser_Loaded" />
</StackPanel>
</ScrollViewer>
private void WebBrowser_Loaded(object sender, RoutedEventArgs e)
{
WebBrowser web = sender as WebBrowser;
web.NavigateToString(VM.HtmlContent);
}
Problem: Webbrowser is not rendered to its content size.
Regardless of the actual content size, all webbrowsers take same amount of space in the stack panel.
Current Output Screenshot Web browsers 2nd and 3rd have not taken the required amount of space to render the content.
It seems the Webbrowser control is not giving the right information about its content size to the stack panel.
Given that, web browsers get rendered to its content size, I would like to avoid the scroll bar at the web browser level.
Any help is highly appreciated. Thank you.