Scrolling to end

Nov 16, 2015 at 3:19 PM
Edited Nov 18, 2015 at 4:00 PM
I'm having trouble implementing https://htmlrenderer.codeplex.com/discussions/442448. There is no property called AutoScrollPosition, or AutoScrolling as described in the demo.

How do I scroll an HtmlPanel to end?

I'm using it to render html content from an Xmpp server and every time I update the Text property, the panel scrolls to the top.

Also open to a better method of appending content to the HtmlPanel.

EDIT

I borrowed the ScrollToPoint code from HtmlPanel.cs.
        public void ScrollToEnd()
        {
            ScrollToPoint(_horizontalScrollBar.Minimum, _verticalScrollBar.Maximum + _verticalScrollBar.LargeChange);
        }

        /// <summary>
        /// Set the control scroll offset to the given values.
        /// </summary>
        private void ScrollToPoint(double x, double y)
        {
            _horizontalScrollBar.Value = x;
            _verticalScrollBar.Value = y;
            UpdateScrollOffsets();
        }

        /// <summary>
        /// Update the scroll offset of the HTML container and invalidate visual to re-render.
        /// </summary>
        private void UpdateScrollOffsets()
        {
            var newScrollOffset = new Point(-_horizontalScrollBar.Value, -_verticalScrollBar.Value);
            if (!newScrollOffset.Equals(_htmlContainer.ScrollOffset))
            {
                _htmlContainer.ScrollOffset = newScrollOffset;
                InvalidateVisual();
            }
        }
Marked as answer by bastien_01 on 11/16/2015 at 3:45 PM