In This Article

TextStylePreview Class

Represents a syntax-highlighting code editor control.

[TemplatePart(Name = "PART_Canvas", Type = typeof(CanvasControl))]
public class TextStylePreview : Control
Inheritance:
object Visual UIElement FrameworkElement Control object

Constructors

TextStylePreview()

Initializes an instance of the class.

public TextStylePreview()

Properties

HighlightingStyle

The IHighlightingStyle to apply to the preview.

public IHighlightingStyle? HighlightingStyle { get; set; }

Property Value

IHighlightingStyle

HighlightingStyleRegistry

The optional alternate IHighlightingStyleRegistry to use.

public IHighlightingStyleRegistry? HighlightingStyleRegistry { get; set; }

Property Value

IHighlightingStyleRegistry

Remarks

If this property is null, the AmbientHighlightingStyleRegistry will be used.

Text

Text to preview.

public string Text { get; set; }

Property Value

string:

The default value is ij = I::oO(0xB81l);.

Methods

MeasureOverride(Size)

Called to remeasure a control.

protected override Size MeasureOverride(Size availableSize)
Parameter Type Description
availableSize Size

Returns

Size:

The size of the control, up to the maximum specified by constraint.

OnApplyTemplate()

When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate().

public override void OnApplyTemplate()

OnDraw(CanvasDrawEventArgs)

Occurs when the canvas should be rendered.

protected virtual void OnDraw(CanvasDrawEventArgs e)
Parameter Type Description
e CanvasDrawEventArgs

The event data.

Fields

HighlightingStyleProperty

Defines the HighlightingStyle property.

public static readonly DependencyProperty HighlightingStyleProperty

HighlightingStyleRegistryProperty

Defines the HighlightingStyleRegistry property.

public static readonly DependencyProperty HighlightingStyleRegistryProperty

TextProperty

Defines the Text property.

public static readonly DependencyProperty TextProperty

Extension Methods