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 TextStylePreview class.

public TextStylePreview()

Properties

HighlightingStyle

Gets or sets the IHighlightingStyle to apply to the preview.

public IHighlightingStyle HighlightingStyle { get; set; }

Property Value

IHighlightingStyle:

The IHighlightingStyle to apply to the preview.

HighlightingStyleRegistry

Gets or sets the optional alternate IHighlightingStyleRegistry to use.

public IHighlightingStyleRegistry HighlightingStyleRegistry { get; set; }

Property Value

IHighlightingStyleRegistry:

The optional alternate IHighlightingStyleRegistry to use.

Remarks

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

Text

Gets or sets the text to preview.

public string Text { get; set; }

Property Value

string:

The text to preview. The default value is AaBbCcXxYyZz.

Methods

MeasureOverride(Size)

Measures the size required for the element and its child elements.

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

The available size.

Returns

Size:

The desired size.

OnApplyTemplate()

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 CanvasDrawEventArgs that contains data related to this event.

Fields

HighlightingStyleProperty

Identifies the HighlightingStyle dependency property. This field is read-only.

public static readonly DependencyProperty HighlightingStyleProperty

HighlightingStyleRegistryProperty

Identifies the HighlightingStyleRegistry dependency property. This field is read-only.

public static readonly DependencyProperty HighlightingStyleRegistryProperty

TextProperty

Identifies the Text dependency property. This field is read-only.

public static readonly DependencyProperty TextProperty