DocumentSettings

DocumentSettings is a struct you construct before creating a DocumentController. After creation, you can update it at any time by calling controller.ApplyDocumentSettings(newSettings).

PropertyTypeDefaultDescription
DocumentBackgroundColor SKColor White Page background color painted behind all text and images.
TextStyle IStyle Default text style applied when no explicit style exists. Set font family, size, and color here.
PageWidth float 800 Total page width in pixels (including margins).
DocumentMargins DocumentMargins default Left, right, top, and bottom margin values in pixels.
Alignment TextAlignment Left Default paragraph alignment for new paragraphs.
var settings = new DocumentSettings
{
    PageWidth               = 850f,
    DocumentBackgroundColor = SKColors.White,
    DocumentMargins         = new DocumentMargins(80, 80, 60, 60),
    TextStyle               = new Style { FontFamily = "Segoe UI", FontSize = 13 },
    Alignment               = TextAlignment.Left
};

DocumentMargins

struct

All properties are init-only and specified in pixels.

PropertyTypeDescription
LeftfloatLeft margin in pixels
RightfloatRight margin in pixels
TopfloatTop margin in pixels
BottomfloatBottom margin in pixels
// Constructor form
var margins = new DocumentMargins(80, 80, 60, 60);
// left=80, right=80, top=60, bottom=60

// Or object-initializer form
var margins = new DocumentMargins { Left = 100, Right = 100, Top = 80, Bottom = 80 };

DocumentInfo

struct

A read-only snapshot of the document's current dimensions, delivered via the OnContentSizeChanged event.

PropertyTypeDescription
WidthfloatTotal document width as measured
HeightfloatTotal document height as measured
ScrollOffsetVector2Current scroll position (X, Y)

NavigationInfo

struct

Published via DocumentController.OnNavigation when the caret moves or the style changes.

PropertyTypeDescription
StyleAtCaretIStyleFully merged text style at the current caret position
SelectionInfoSelectionInfoParagraph-level info: alignment, list type/level, line spacing
SelectionTextRangeThe current selection range (start == end when no selection)
controller.OnNavigation += (info) =>
{
    var style = info.StyleAtCaret;
    boldBtn.IsChecked   = style.FontWeight >= 700;
    italicBtn.IsChecked = style.FontItalic == true;

    var sel = info.SelectionInfo;
    alignLeft.IsChecked     = sel.Alignment == TextAlignment.Left;
    alignCenter.IsChecked   = sel.Alignment == TextAlignment.Center;
    bulletBtn.IsChecked     = sel.ListType  == ListType.Bullet;
};

IStyle Properties

IStyle is defined by Topten.RichTextKit. All properties are nullable — null means "inherit from the document default."

PropertyTypeDescription
FontFamilystring?Font family name (e.g., "Arial")
FontSizefloat?Font size in points
FontWeightint?400 = normal, 700 = bold
FontItalicbool?True for italic
TextColorSKColor?Foreground text color
BackgroundColorSKColor?Background highlight color
UnderlineUnderlineStyle?None or Solid
StrikeThroughStrikeThroughStyle?None or Solid
FontVariantFontVariant?Normal, SubScript, or SuperScript