Table of Contents

Class HtmlBuilder

Namespace
SharpConsoleUI.Builders
Assembly
SharpConsoleUI.dll

Fluent builder for HtmlControl

public sealed class HtmlBuilder : IControlBuilder<HtmlControl>
Inheritance
HtmlBuilder
Implements
Inherited Members
Extension Methods

Methods

Build()

Builds the HtmlControl.

public HtmlControl Build()

Returns

HtmlControl

Create()

Creates a new HtmlBuilder instance.

public static HtmlBuilder Create()

Returns

HtmlBuilder

OnContentLoaded(EventHandler)

Sets the ContentLoaded event handler. Fires after the text layout of a fetched page has been committed — before images finish loading. Use OnLoadingCompleted(EventHandler) to wait for everything.

public HtmlBuilder OnContentLoaded(EventHandler handler)

Parameters

handler EventHandler

Returns

HtmlBuilder

OnLinkClicked(EventHandler<LinkClickedEventArgs>)

Sets the LinkClicked event handler.

public HtmlBuilder OnLinkClicked(EventHandler<LinkClickedEventArgs> handler)

Parameters

handler EventHandler<LinkClickedEventArgs>

Returns

HtmlBuilder

OnLinkHover(EventHandler<LinkHoverEventArgs>)

Sets the LinkHover event handler.

public HtmlBuilder OnLinkHover(EventHandler<LinkHoverEventArgs> handler)

Parameters

handler EventHandler<LinkHoverEventArgs>

Returns

HtmlBuilder

OnLoadError(EventHandler<LoadErrorEventArgs>)

Sets the LoadError event handler.

public HtmlBuilder OnLoadError(EventHandler<LoadErrorEventArgs> handler)

Parameters

handler EventHandler<LoadErrorEventArgs>

Returns

HtmlBuilder

OnLoadingCompleted(EventHandler)

Sets the LoadingCompleted event handler. Fires exactly once per LoadUrlAsync call when every phase of loading has finished (including progressive image loading) — on success, cancellation, or error.

public HtmlBuilder OnLoadingCompleted(EventHandler handler)

Parameters

handler EventHandler

Returns

HtmlBuilder

WithBackgroundColor(Color)

Sets the background color.

public HtmlBuilder WithBackgroundColor(Color color)

Parameters

color Color

Returns

HtmlBuilder

WithBaseUrl(string)

Sets the base URL for resolving relative links.

public HtmlBuilder WithBaseUrl(string baseUrl)

Parameters

baseUrl string

Returns

HtmlBuilder

WithBlockSpacing(int)

Sets the spacing between block elements.

public HtmlBuilder WithBlockSpacing(int spacing)

Parameters

spacing int

Returns

HtmlBuilder

WithColors(Color, Color)

Sets both foreground and background colors.

public HtmlBuilder WithColors(Color foreground, Color background)

Parameters

foreground Color
background Color

Returns

HtmlBuilder

WithContent(string)

Sets the HTML content to display.

public HtmlBuilder WithContent(string content)

Parameters

content string

Returns

HtmlBuilder

WithContent(string, string)

Sets the HTML content with a base URL for resolving relative links.

public HtmlBuilder WithContent(string content, string baseUrl)

Parameters

content string
baseUrl string

Returns

HtmlBuilder

WithForegroundColor(Color)

Sets the foreground color.

public HtmlBuilder WithForegroundColor(Color color)

Parameters

color Color

Returns

HtmlBuilder

WithHeight(int)

Sets the height.

public HtmlBuilder WithHeight(int height)

Parameters

height int

Returns

HtmlBuilder

WithHorizontalAlignment(HorizontalAlignment)

Sets the horizontal alignment.

public HtmlBuilder WithHorizontalAlignment(HorizontalAlignment alignment)

Parameters

alignment HorizontalAlignment

Returns

HtmlBuilder

WithLinkColor(Color)

Sets the color used for unvisited links.

public HtmlBuilder WithLinkColor(Color color)

Parameters

color Color

Returns

HtmlBuilder

WithLoadingText(string)

Sets the text displayed while content is loading.

public HtmlBuilder WithLoadingText(string loadingText)

Parameters

loadingText string

Returns

HtmlBuilder

WithMargin(int)

Sets uniform margin.

public HtmlBuilder WithMargin(int margin)

Parameters

margin int

Returns

HtmlBuilder

WithMargin(int, int, int, int)

Sets the margin.

public HtmlBuilder WithMargin(int left, int top, int right, int bottom)

Parameters

left int
top int
right int
bottom int

Returns

HtmlBuilder

WithName(string)

Sets the control name for lookup.

public HtmlBuilder WithName(string name)

Parameters

name string

Returns

HtmlBuilder

WithScrollbarVisibility(ScrollbarVisibility)

Sets when the vertical scrollbar should be displayed.

public HtmlBuilder WithScrollbarVisibility(ScrollbarVisibility visibility)

Parameters

visibility ScrollbarVisibility

Returns

HtmlBuilder

WithShowBulletPoints(bool)

Sets whether bullet points are rendered for lists.

public HtmlBuilder WithShowBulletPoints(bool show = true)

Parameters

show bool

Returns

HtmlBuilder

WithShowImages(bool)

Sets whether images are rendered (as alt text placeholders).

public HtmlBuilder WithShowImages(bool show = true)

Parameters

show bool

Returns

HtmlBuilder

WithTabSize(int)

Sets the tab size in spaces.

public HtmlBuilder WithTabSize(int tabSize)

Parameters

tabSize int

Returns

HtmlBuilder

WithTag(object)

Sets a tag object.

public HtmlBuilder WithTag(object tag)

Parameters

tag object

Returns

HtmlBuilder

WithVerticalAlignment(VerticalAlignment)

Sets the vertical alignment.

public HtmlBuilder WithVerticalAlignment(VerticalAlignment alignment)

Parameters

alignment VerticalAlignment

Returns

HtmlBuilder

WithVisible(bool)

Sets the visibility.

public HtmlBuilder WithVisible(bool visible = true)

Parameters

visible bool

Returns

HtmlBuilder

WithVisitedLinkColor(Color)

Sets the color used for visited links.

public HtmlBuilder WithVisitedLinkColor(Color color)

Parameters

color Color

Returns

HtmlBuilder

WithWidth(int)

Sets the width.

public HtmlBuilder WithWidth(int width)

Parameters

width int

Returns

HtmlBuilder

Operators

implicit operator HtmlControl(HtmlBuilder)

Implicit conversion to HtmlControl.

public static implicit operator HtmlControl(HtmlBuilder builder)

Parameters

builder HtmlBuilder

Returns

HtmlControl