Table of Contents

Class HtmlPanel

Namespace
TheArtOfDev.HtmlRenderer.WPF
Assembly
StockSharp.Xaml.dll

Provides HTML rendering using the text property.
WPF control that will render html content in it's client rectangle.
If the layout of the html resulted in its content beyond the client bounds of the panel it will show scrollbars (horizontal/vertical) allowing to scroll the content.
The control will handle mouse and keyboard events on it to support html text selection, copy-paste and mouse clicks.

public class HtmlPanel : HtmlControl, IAnimatable, IFrameworkInputElement, IInputElement, ISupportInitialize, IQueryAmbient
Inheritance
HtmlPanel
Implements
Inherited Members
Extension Methods

Remarks

See HtmlControl for more info.

Constructors

HtmlPanel()

Creates a new HtmlPanel and sets a basic css for it's styling.

public HtmlPanel()

Properties

VisualChildrenCount

Get visual child count of the panel.

protected override int VisualChildrenCount { get; }

Property Value

int

Methods

ArrangeOverride(Size)

After measurement arrange the scrollbars of the panel.

protected override Size ArrangeOverride(Size bounds)

Parameters

bounds Size

Returns

Size

GetVisualChild(int)

Get the visual child at the specified index.

protected override Visual GetVisualChild(int index)

Parameters

index int

Returns

Visual

HtmlHeight(Size)

Get the width the HTML has to render in (not including vertical scroll iff it is visible)

protected override double HtmlHeight(Size size)

Parameters

size Size

Returns

double

HtmlWidth(Size)

Get the width the HTML has to render in (not including vertical scroll iff it is visible)

protected override double HtmlWidth(Size size)

Parameters

size Size

Returns

double

MeasureOverride(Size)

Perform the layout of the html in the control.

protected override Size MeasureOverride(Size constraint)

Parameters

constraint Size

Returns

Size

OnKeyDown(KeyEventArgs)

Handle key down event for selection, copy and scrollbars handling.

protected override void OnKeyDown(KeyEventArgs e)

Parameters

e KeyEventArgs

OnMouseUp(MouseButtonEventArgs)

Handle mouse up to set focus on the control.

protected override void OnMouseUp(MouseButtonEventArgs e)

Parameters

e MouseButtonEventArgs

OnMouseWheel(MouseWheelEventArgs)

Handle mouse wheel for scrolling.

protected override void OnMouseWheel(MouseWheelEventArgs e)

Parameters

e MouseWheelEventArgs

OnRender(DrawingContext)

Handle minor case where both scroll are visible and create a rectangle at the bottom right corner between them.

protected override void OnRender(DrawingContext context)

Parameters

context DrawingContext

PerformHtmlLayout(Size)

Perform html container layout by the current panel client size.

protected Size PerformHtmlLayout(Size constraint)

Parameters

constraint Size

Returns

Size

ScrollToElement(string)

Adjust the scrollbar of the panel on html element by the given id.
The top of the html element rectangle will be at the top of the panel, if there is not enough height to scroll to the top the scroll will be at maximum.

public virtual void ScrollToElement(string elementId)

Parameters

elementId string

the id of the element to scroll to