WinForms property reference
Documentation index · Methods · Enums
All members are in CODE.Editor.WinForms. TextEditor is a sealed UserControl. The following tables cover its editor-specific properties; ordinary inherited WinForms layout properties such as Dock, Size, and Visible retain their normal meanings.
State and initialization
| Property | Type/default | Meaning |
|---|---|---|
EditorText |
string, empty |
Cached serialized value; assignment queues a load after initialization |
Options |
Read-only EditorOptions instance |
Mutable settings object, exposed for designer expansion |
IsReady |
Read-only bool |
Successful browser/editor initialization |
IsDirty |
Read-only bool |
Last confirmed dirty state |
Revision |
Read-only int |
Last confirmed model revision |
SessionId |
Read-only string |
Current session identifier |
Selection |
Read-only EditorSelection |
Last confirmed flat selection |
LastError |
Read-only nullable Exception |
Last reported control error |
UserDataFolder |
Nullable string |
WebView2 profile folder; set before initialization |
LocalImageFolder |
Nullable string |
Folder mapped to TextEditor.LocalImageOrigin; set before initialization |
LocalImageOrigin is a public constant: https://code-editor-assets.example. Mapping a folder does not save images; provide an import event handler. Set pre-initialization properties before adding/showing the control if that could create its handle.
Document and view
These settings are available both directly on the control and on Options.
| Property | Type/default | JavaScript key | Meaning |
|---|---|---|---|
Format |
EditorFormat.Markdown |
format |
Stored representation |
ViewMode |
EditorViewMode.Visual |
mode |
Source/Visual experience |
Language |
EditorLanguage.Markdown |
language |
Source coloring/comments |
ReadOnly |
false |
readOnly |
Prevent editing |
WordWrap |
true |
wrap |
Source wrapping |
LineNumbers |
true |
lineNumbers |
Source gutter |
SyntaxHighlighting |
true |
decorated |
Lexical decoration |
TabWidth |
4 |
tabWidth |
Valid values 2, 4, 8 |
IndentWithTabs |
false |
indentWithTabs |
Tabs versus spaces |
TabIndents |
true |
tabIndents |
Tab editing interaction |
TypingRules |
true |
typingRules |
Visual input shortcuts |
Setting Format to PlainText forces Source; RichJson forces Visual. Incompatible explicit ViewMode assignments throw. To load a new document atomically with format/view/language, use LoadAsync. To convert an existing document, use ConvertFormatAsync.
Presentation and preview
| Property | Type/default | JavaScript key | Meaning |
|---|---|---|---|
Theme |
EditorTheme.Light |
theme |
Light/dark presentation |
DisplayFontFamily |
"Segoe UI, sans-serif" |
fontFamily |
Editing surface CSS font family |
DisplayFontSize |
16 |
fontSize |
CSS pixels, 10–48 |
Placeholder |
Empty string | placeholder |
Empty-content hint |
AccessibleLabel |
"Text editor" |
label |
Accessibility label |
PreviewVisible |
false |
Host preview visibility | Show optional pane |
PreviewSync |
true |
previewSync |
Follow editor scroll/caret |
PreviewSplit |
0.5 |
previewSplit |
Editor's share, finite 0.2–0.8; layout may impose tighter visual limits |
PreviewCss |
Empty string | previewCss |
Stylesheet text isolated to preview |
FindEnabled |
true |
Control-shell option | Enable internal find UI |
ReplaceEnabled |
true |
Control-shell option | Enable replacement UI |
Display fonts do not change document formatting. Use content-formatting methods for stored rich styles. PreviewCss is separate from both. When the user resizes the divider, PreviewSplit is updated and PreviewResized fires.
Policy and image settings
| Property | Type/default | JavaScript key | Meaning |
|---|---|---|---|
Preset |
EditorPreset.Full |
preset |
Starting feature policy |
AllowEmbeddedHtml |
true |
allowEmbeddedHtml |
Supported HTML extensions in Markdown |
AllowSourceView |
true |
allowSourceView |
Source access |
UnsupportedContent |
UnsupportedContentHandling.Preserve |
unsupportedContent |
Preserve/reject/convert |
MaxListDepth |
8 |
maxListDepth |
Allowed nesting 0–8 |
AllowRemoteImages |
false |
allowRemoteImages |
Broad HTTP(S) image display |
ExternalImages |
ExternalImageHandling.Reference |
externalImages |
Pasted reference handling |
MaxImageBytes |
10485760 |
maxImageBytes |
Per-file bytes, allowed 1–104857600 |
Collection settings on Options
These do not have additional direct TextEditor forwarding properties:
| Member | Default and rules |
|---|---|
Options.HeadingLevels |
int[] of 1–6; duplicates removed; values outside 1–6 rejected; empty allowed |
Options.ImageOrigins |
Empty string[]; exact absolute HTTP(S) origins with no path or trailing slash |
Options.ImageTypes |
PNG/JPEG/GIF/WebP MIME strings; unsupported MIME values rejected |
Options.Features |
Read-only dictionary of explicitly assigned EditorFeature overrides |
Options.SetFeature(feature, enabled) |
Add/change a feature override |
Options.ResetFeatures() |
Clear explicit overrides |
Options.PropertyChanged |
INotifyPropertyChanged notification for setting changes |
Options.ToString() |
Human-readable format/view description, useful in designer UI |
Array getters return copies. Reassign an edited array rather than modifying a retrieved array and expecting live updates. Features is the override set; GetCapabilitiesAsync returns the effective policy after preset and format restrictions.
Update semantics
Use the owning UI thread. Settings changed before initialization form startup configuration; later changes are sent through the operation queue. Local range/enum checks throw synchronously, while browser policy/configuration checks may fail asynchronously and report through EditorError. A property can therefore hold a requested setting that the browser has not yet accepted. FlushAsync helps await queued work, and capability/snapshot queries establish accepted state.
Avoid a sequence of temporarily incompatible policy settings on a loaded document. Configure before loading where possible. Policy changes reset undo/redo. Clearing presentation strings is not uniformly implemented by the underlying truthy-only JavaScript setters; recreating an instance may be necessary to fully reset certain presentation overrides in this preview version.