I have a simple wpf window which has a Scrollviewer and inside it a Web Browser.
<Window x:Class="WpfApplication9.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525" Background="Gainsboro">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="300"/>
</Grid.ColumnDefinitions>
<ScrollViewer Width="300" Grid.Column="1" Height="200" HorizontalScrollBarVisibility="Auto">
<WebBrowser Width="400" Margin="2" Source="C:\Users\Public\Pictures\Sample Pictures\Chrysanthemum.jpg" />
</ScrollViewer>
</Grid>
As i have given a Width to the browser which is more than the width of the Scroll Viewer i expect the scroll viewer to show the horizontal scroll bar and show the web browser within the Scroll Viewer.
But when i horizontally scroll to the right , the web browser moves out of the scroll viwer.
Am i doing something wrong? Or is there any workaround for this?
Any help is highly appreciated. Thanks.
The WPF web browser control is actually an ActiveX component so it doesn't quite play nice with the rest of the framework. As far as I can tell, the browser gets pasted on top of your application and you will always see all of it, regardless of the underlying container.
You could try to use something like WPF Chromium instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With