Webview does not load content properly when disabling its scrolling through script


  • I have an App in which I need to show some html content in a page but I have given my App's scrolling in it. So whole page needs to scroll combined. To achieve this I use two WebViews to navigate to string and get height of content by javascript from first webview and assign it to second webview and then disable it's default scrolling. I have taken a rectangle over it to allow user to scroll in page. This strategy works fine where content is low but if the content is large in webview it shows blank page in top and down and shows some content in middle. Sometimes it does not show content but Height gets assigned. I tried using RichTextBlock but it does not parse all type of tags and I don't want WebView to scroll but to adjust it's height according to content. can anybody provide any help?

    Link to my code App2

    Thursday, January 15, 2015 12:44 PM


  • Hi RohitrkKUmar,

    After looking into your sample project, I found you are nesting unnecessary Grid and making thing complex. Using fixed height in the second grid and the app will use scroll bar if the height of content is longer than the grid. I make some changes according to my understanding, you can try the following code snippet.

    <Grid x:Name="LayoutRoot" Background="White">
                    <EntranceThemeTransition x:Name="Animation"/>
                <RowDefinition Height="50"/>
                <RowDefinition Height="500"/>
                <RowDefinition Height="auto" />
            <TextBlock Grid.Row="0" Text="Demo App" VerticalAlignment="Center" Foreground="Black" FontSize="24" HorizontalAlignment="Center"/>
            <StackPanel Grid.Row="1">
                <TextBlock Name="demoText"  Foreground="White" Width="Auto" Height="Auto" TextWrapping="WrapWholeWords"/>
                <WebView Visibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollMode="Auto" ScrollViewer.ZoomMode="Disabled" DefaultBackgroundColor="Aqua" Margin="10" Name="aboutDescript" DOMContentLoaded="aboutDescript_DOMContentLoaded" />
                <Rectangle Width="auto" Name="wbRect" Fill="Transparent"/>
            <TextBox Grid.Row="2" Text="something else"></TextBox>

    Please feel free to let me know if you have any concerns.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    Friday, January 16, 2015 9:13 AM