Sunday Okpokor
Sunday Okpokor

Reputation: 723

Webview dragging effect when scrolling

I got scrollviewer that is using horizontal scrolling, at the end i put a webview. When I scroll from left to right the Webview has an ugly dragging effect (it moves a bit more and then goes back to its position) any way to disable that effect?

Though I have seen a particular post that claims to solve it with a WebViewBrush and did not explain how.

I would like to know how to use the WebViewBrush to stop the dragging effect.?

Upvotes: 0

Views: 423

Answers (1)

Sunday Okpokor
Sunday Okpokor

Reputation: 723

Ok, first thing is that i wanted to get rid of the dragging effect the webview makes when scrolling the page, the approach i took was to use the scrollviewer's EventArgs IsIntermediate property that will be false when the user is not scrolling and true when the user is scrolling. From the result, i choose to make the webview's visible property to Visible if the user is not scrolling and to Collapsed when the user is scrolling. Here is the scrollviewer's ViewChanged event handler

private void ScrollViewer_ViewChanged(object sender, ScrollViewerViewChangedEventArgs e)
{

    if (e.IsIntermediate.Equals(false))
    {
         watchTrailerWebView.Visibility = Windows.UI.Xaml.Visibility.Visible;
         Rect1.Fill = new SolidColorBrush(Windows.UI.Colors.Transparent);        
    }
    else if (e.IsIntermediate.Equals(true))
    {
         if (Rect1.Visibility == Windows.UI.Xaml.Visibility.Visible)
         {
             WebViewBrush b = new WebViewBrush();
             b.SourceName = "watchTrailerView";
             b.Redraw();
             Rect1.Fill = b;
             watchTrailerWebView.Visibility = Windows.UI.Xaml.Visibility.Collapsed;                   
          }

     }            
 }

You could choose not to use the WebViewBrush, works fine by just making the WebView visible or collapsed

Upvotes: 1

Related Questions