Skip to main content

MarkdownCodeBlock Class

Definition​

Assembly:Avalonia.Controls.Markdown
Package:Avalonia.Controls.Markdown

A Avalonia.Controls.Documents.Paragraph that represents a fenced code block. Carries the language identifier so the render layer can apply syntax highlighting without extra lookups.

public class MarkdownCodeBlock

Inheritance: object -> AvaloniaObject -> Animatable -> StyledElement -> RichTextElement -> Block -> Paragraph -> MarkdownCodeBlock

Constructors​

NameDescription
MarkdownCodeBlockNo summary available.

MarkdownCodeBlock Constructor​

public MarkdownCodeBlock()

Methods​

NameDescription
ApplyStylingApplies styling to the control if the control is initialized and styling is not already applied. Inherited from StyledElement.
BeginInitInherited from StyledElement.
Bind (8 overloads)Binds a Avalonia.AvaloniaProperty to an Avalonia.Data.BindingBase. Inherited from AvaloniaObject.
CheckAccessReturns a value indicating whether the current thread is the UI thread. Inherited from AvaloniaObject.
ClearValue (4 overloads)Clears a Avalonia.AvaloniaProperty's local value. Inherited from AvaloniaObject.
CoerceValueCoerces the specified Avalonia.AvaloniaProperty. Inherited from AvaloniaObject.
EndInitInherited from StyledElement.
EqualsCompares two objects using reference equality. Inherited from AvaloniaObject.
GetBaseValueInherited from AvaloniaObject.
GetHashCodeGets the hash code for the object. Inherited from AvaloniaObject.
GetValue (3 overloads)Gets a Avalonia.AvaloniaProperty value. Inherited from AvaloniaObject.
IsAnimatingChecks whether a Avalonia.AvaloniaProperty is animating. Inherited from AvaloniaObject.
IsSetChecks whether a Avalonia.AvaloniaProperty is set on this object. Inherited from AvaloniaObject.
SetCurrentValue (2 overloads)Sets the value of a dependency property without changing its value source. Inherited from AvaloniaObject.
SetValue (3 overloads)Sets a Avalonia.AvaloniaProperty value. Inherited from AvaloniaObject.
TryGetResourceInherited from StyledElement.
VerifyAccessChecks that the current thread is the UI thread and throws if not. Inherited from AvaloniaObject.

Properties​

NameDescription
ActualThemeVariantGets the UI theme that is currently used by the element, which might be different than the RequestedThemeVariantProperty. Inherited from StyledElement.
BackgroundGets or sets the brush used to fill the background of the control. Inherited from RichTextElement.
BorderBrushGets or sets the brush used to paint the block border. Inherited from Block.
BorderThicknessGets or sets the thickness of the block border. Inherited from Block.
BreakPageBeforeGets or sets whether paginated output (print/PDF export) starts a new page before this block. The continuous on-screen flow ignores it. Inherited from Block.
ClassesGets or sets the styled element's classes. Inherited from StyledElement.
ContentEndGets a text pointer to the end of the content in the document. Inherited from RichTextElement.
ContentLengthGets the length, in characters, that is covered by this element. Inherited from RichTextElement.
ContentRangeGets the range of text that represents the entire content, or null if the content is empty or unavailable. Inherited from RichTextElement.
ContentStartGets a text pointer to the start of the content in the document. Inherited from RichTextElement.
CornerRadiusGets or sets the corner radius of the block border. Inherited from Block.
DataContextGets or sets the control's data context. Inherited from StyledElement.
DispatcherReturns the Avalonia.AvaloniaObject.Dispatcher that this Avalonia.AvaloniaObject is associated with. Inherited from AvaloniaObject.
FirstChildElementGets the first direct child element in the document tree, or if none exists. Inherited from RichTextElement.
FlowDirectionGets or sets the flow direction for text within the block. Inherited from Block.
FontFamilyGets or sets the font family used to display text. Inherited from RichTextElement.
FontFeaturesGets or sets the collection of font features to apply to the text. Inherited from RichTextElement.
FontSizeGets or sets the size of the font used to display text. Inherited from RichTextElement.
FontStretchGets or sets the degree to which the font is stretched horizontally. Inherited from RichTextElement.
FontStyleGets or sets the font style used to display the text. Inherited from RichTextElement.
FontWeightGets or sets the weight or thickness of the font used to display text. Inherited from RichTextElement.
ForegroundGets or sets the brush used to paint the foreground of the control. Inherited from RichTextElement.
HighlighterGets or sets the Avalonia.Controls.CodeHighlighter used to render syntax-highlighted code. Falls back to the Avalonia.Controls.Markdown.CodeHighlighter the containing control supplies when this block sets none of its own.
InfoArgumentsGets or sets the remainder of the fence's info string after the language identifier (title=foo in ````text title=foo), or null` when the fence carried none. Preserved so the writer can reproduce the original info string, including any directives it carried.
InlinesGets the inlines that make up this paragraph. Inherited from Paragraph.
IsAttachedToDocumentGets a value indicating whether this element is currently attached to a Avalonia.Controls.Documents.TextModel.TextDocument. Inherited from RichTextElement.
IsInitializedGets a value that indicates whether the element has finished initialization. Inherited from StyledElement.
ItemInherited from AvaloniaObject.
KeepTogetherGets or sets whether paginated output (print/PDF export) avoids splitting this block across pages. Best effort: a block taller than one page still splits. The continuous on-screen flow ignores it. Inherited from Block.
KeepWithNextGets or sets whether paginated output keeps this block's end on the same page as the start of the following block. Consecutive flagged blocks move as one chain, giving up when the chain exceeds a page. The continuous on-screen flow ignores it. Inherited from Block.
LanguageIdGets or sets the language identifier string (e.g. "csharp") for syntax highlighting.
LastChildElementGets the last direct child element in the document tree, or if none exists. Inherited from RichTextElement.
LetterSpacingGets or sets the letter spacing. Inherited from RichTextElement.
LineHeightGets or sets the minimum line height for text lines in the block. Inherited from Block.
MarginGets or sets the margin applied outside the block. Inherited from Block.
NameGets or sets the name of the styled element. Inherited from StyledElement.
NextElementGets the next sibling element in the document tree, or if none exists. Inherited from RichTextElement.
PaddingGets or sets the padding applied inside the block border. Inherited from Block.
ParentGets the styled element's logical parent. Inherited from StyledElement.
PreviousElementGets the previous sibling element in the document tree, or if none exists. Inherited from RichTextElement.
ResourcesGets or sets the styled element's resource dictionary. Inherited from StyledElement.
StyleKeyGets the type by which the element is styled. Inherited from StyledElement.
StylesGets the styles for the styled element. Inherited from StyledElement.
TabStopPositionsGets or sets the block's custom tab stop positions in device-independent pixels, measured from the content edge. Null (the default) means the block uses the default tab interval. Maps to Word's w:tabs and RTF \tx. Inherited from Block.
TemplatedParentGets the styled element whose lookless template this styled element is part of. Inherited from StyledElement.
TextAlignmentGets or sets the horizontal alignment of text within the block. Inherited from Block.
TextDecorationsGets or sets the text decoration collection applied to the paragraph text. Inherited from Paragraph.
TextDocumentGets the Avalonia.Controls.Documents.TextModel.TextDocument this element is attached to, or if not attached. Inherited from RichTextElement.
TextIndentGets or sets the first-line indent in device-independent pixels; a negative value is a hanging indent. double.NaN (the default) means not set. Maps to Word's w:ind w:firstLine/w:hanging and RTF \fi. Inherited from Block.
ThemeGets or sets the theme to be applied to the element. Inherited from StyledElement.
TransitionsGets or sets the property transitions for the control. Inherited from Animatable.
WidowControlGets or sets whether paginated output (print/PDF export) avoids stranding a single line of this paragraph on either side of a page break: at least two lines stay and at least two lines move, so a three-line paragraph never splits. On by default (Word's default). The continuous on-screen flow ignores it. Inherited from Paragraph.

Highlighter Property​

Gets or sets the Avalonia.Controls.CodeHighlighter used to render syntax-highlighted code. Falls back to the Avalonia.Controls.Markdown.CodeHighlighter the containing control supplies when this block sets none of its own.

public Avalonia.Controls.CodeHighlighter Highlighter { get; set; }

InfoArguments Property​

Gets or sets the remainder of the fence's info string after the language identifier (title=foo in ````text title=foo), or null` when the fence carried none. Preserved so the writer can reproduce the original info string, including any directives it carried.

public string InfoArguments { get; set; }

LanguageId Property​

Gets or sets the language identifier string (e.g. "csharp") for syntax highlighting.

public string LanguageId { get; set; }

Fields​

NameDescription
BackgroundPropertyDefines the Avalonia.Controls.Documents.RichTextElement.Background property. Inherited from RichTextElement.
BorderBrushPropertyDefines the Avalonia.Controls.Documents.Block.BorderBrush property. Inherited from Block.
BorderThicknessPropertyDefines the Avalonia.Controls.Documents.Block.BorderThickness property. Inherited from Block.
BreakPageBeforePropertyDefines the Avalonia.Controls.Documents.Block.BreakPageBefore property. Inherited from Block.
CornerRadiusPropertyDefines the Avalonia.Controls.Documents.Block.CornerRadius property. Inherited from Block.
DataContextPropertyDefines the Avalonia.StyledElement.DataContext property. Inherited from StyledElement.
FlowDirectionPropertyDefines the Avalonia.Controls.Documents.Block.FlowDirection property. Inherited from Block.
FontFamilyPropertyDefines the Avalonia.Controls.Documents.RichTextElement.FontFamily property. Inherited from RichTextElement.
FontFeaturesPropertyDefines the Avalonia.Controls.Documents.RichTextElement.FontFeatures property. Inherited from RichTextElement.
FontSizePropertyDefines the Avalonia.Controls.Documents.RichTextElement.FontSize property. Inherited from RichTextElement.
FontStretchPropertyDefines the Avalonia.Controls.Documents.RichTextElement.FontStretch property. Inherited from RichTextElement.
FontStylePropertyDefines the Avalonia.Controls.Documents.RichTextElement.FontStyle property. Inherited from RichTextElement.
FontWeightPropertyDefines the Avalonia.Controls.Documents.RichTextElement.FontWeight property. Inherited from RichTextElement.
ForegroundPropertyDefines the Avalonia.Controls.Documents.RichTextElement.Foreground property. Inherited from RichTextElement.
HighlighterPropertyDefines the Avalonia.Controls.Documents.MarkdownCodeBlock.Highlighter property.
InfoArgumentsPropertyDefines the Avalonia.Controls.Documents.MarkdownCodeBlock.InfoArguments property.
KeepTogetherPropertyDefines the Avalonia.Controls.Documents.Block.KeepTogether property. Inherited from Block.
KeepWithNextPropertyDefines the Avalonia.Controls.Documents.Block.KeepWithNext property. Inherited from Block.
LanguageIdPropertyDefines the Avalonia.Controls.Documents.MarkdownCodeBlock.LanguageId property.
LetterSpacingPropertyDefines the Avalonia.Controls.Documents.RichTextElement.LetterSpacing property. Inherited from RichTextElement.
LineHeightPropertyDefines the Avalonia.Controls.Documents.Block.LineHeight property. Inherited from Block.
MarginPropertyDefines the Avalonia.Controls.Documents.Block.Margin property. Inherited from Block.
NamePropertyDefines the Avalonia.StyledElement.Name property. Inherited from StyledElement.
PaddingPropertyDefines the Avalonia.Controls.Documents.Block.Padding property. Inherited from Block.
ParentPropertyDefines the Avalonia.StyledElement.Parent property. Inherited from StyledElement.
TabStopPositionsPropertyDefines the Avalonia.Controls.Documents.Block.TabStopPositions property. Inherited from Block.
TemplatedParentPropertyDefines the Avalonia.StyledElement.TemplatedParent property. Inherited from StyledElement.
TextAlignmentPropertyDefines the Avalonia.Controls.Documents.Block.TextAlignment property. Inherited from Block.
TextDecorationsPropertyDefines the Avalonia.Controls.Documents.Paragraph.TextDecorations property. Inherited from Paragraph.
TextIndentPropertyDefines the Avalonia.Controls.Documents.Block.TextIndent property. Inherited from Block.
ThemePropertyDefines the Avalonia.StyledElement.Theme property. Inherited from StyledElement.
TransitionsPropertyDefines the Avalonia.Animation.Animatable.Transitions property. Inherited from Animatable.
WidowControlPropertyDefines the Avalonia.Controls.Documents.Paragraph.WidowControl property. Inherited from Paragraph.

HighlighterProperty Field​

Defines the Avalonia.Controls.Documents.MarkdownCodeBlock.Highlighter property.

public Avalonia.StyledProperty<Avalonia.Controls.CodeHighlighter> HighlighterProperty

InfoArgumentsProperty Field​

Defines the Avalonia.Controls.Documents.MarkdownCodeBlock.InfoArguments property.

public Avalonia.StyledProperty<string> InfoArgumentsProperty

LanguageIdProperty Field​

Defines the Avalonia.Controls.Documents.MarkdownCodeBlock.LanguageId property.

public Avalonia.StyledProperty<string> LanguageIdProperty

Events​

NameDescription
ActualThemeVariantChangedRaised when the theme variant is changed on the element or an ancestor of the element. Inherited from StyledElement.
AttachedToLogicalTreeRaised when the styled element is attached to a rooted logical tree. Inherited from StyledElement.
DataContextChangedOccurs when the Avalonia.StyledElement.DataContext property changes. Inherited from StyledElement.
DetachedFromLogicalTreeRaised when the styled element is detached from a rooted logical tree. Inherited from StyledElement.
InitializedOccurs when the styled element has finished initialization. Inherited from StyledElement.
PropertyChangedRaised when a Avalonia.AvaloniaProperty value changes on this object. Inherited from AvaloniaObject.
ResourcesChangedOccurs when a resource in this styled element or a parent styled element has changed. Inherited from StyledElement.