---
title: "How do I scroll a WPF WebBrowser control to the end?"  
description: "How do I scroll a WPF WebBrowser control to the end?"  
author: "Anonymous User"  
published: 2013-07-19  
updated: 2013-07-19  
canonical: https://www.mindstick.com/forum/1328/how-do-i-scroll-a-wpf-webbrowser-control-to-the-end  
category: "wpf"  
tags: ["wpf"]  
reading_time: 1 minute  

---

# How do I scroll a WPF WebBrowser control to the end?

<WebBrowser x:[Name](https://yourviews.mindstick.com/view/87450/how-to-generate-a-brand-name-using-linkedin-comprehensive-guide)="messageBufferWebBrowser"\

[controls](https://www.mindstick.com/articles/66/how-to-create-controls-at-run-time-in-csharp-dot-net):WebBrowserUtility.[Body](https://yourviews.mindstick.com/story/2120/rare-species-having-electricity-in-their-body)="{[Binding](https://www.mindstick.com/blog/146/dynamic-binding-in-c-sharp) MessageBuilder}"/>

I'm using this [class](https://www.mindstick.com/blog/165/generic-class-in-c-sharp) to enable binding to the Body of the WebBrowser [control](https://www.mindstick.com/blog/197/asp-dot-net-repeater-control)

```
public static class WebBrowserUtility{    public static readonly DependencyProperty BodyProperty =    DependencyProperty.RegisterAttached("Body", typeof(string), typeof(WebBrowserUtility), new PropertyMetadata(OnBodyChanged));    public static string GetBody(DependencyObject dependencyObject)    {        return (string)dependencyObject.GetValue(BodyProperty);    }    public static void SetBody(DependencyObject dependencyObject, string body)    {        dependencyObject.SetValue(BodyProperty, body);    }    private static void OnBodyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)    {        var webBrowser = d as WebBrowser;        if (!string.IsNullOrWhiteSpace(e.NewValue as string) && webBrowser != null)        {            if (Application.Current.MainWindow != null && !DesignerProperties.GetIsInDesignMode(Application.Current.MainWindow))            {                webBrowser.NavigateToString((string)e.NewValue);            }        }    }}
```

That's my WebBrowser, I'm binding it to a [StringBuilder](https://www.mindstick.com/forum/34633/stringbuffer-and-stringbuilder) [property](https://www.mindstick.com/blog/205/property-notification-in-c-sharp) on the ViewModel. How can I get the WebBrowser control to scroll to the [end](https://yourviews.mindstick.com/view/88503/us-iran-war-live-updates-trump-says-us-in-no-rush-to-end-iran-war)?

## Replies

### Reply by Vijay Shukla

If you cast the WebBrowser's Document property to a mshtml.HTMLDocument, then you can scroll to a specific position in the page (or the bottom by using the largest value possible):

var html = webBrowser.Document as mshtml.HTMLDocument;

html.parentWindow.scroll(0, int.MaxValue);

Note you have to add a reference to Microsoft.mshtml in your project.


---

Original Source: https://www.mindstick.com/forum/1328/how-do-i-scroll-a-wpf-webbrowser-control-to-the-end

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
