Table of Contents

Class RDFormsCaption

Namespace
RDCore.Forms.Avalonia.Controls
Assembly
RDCore.Forms.Avalonia.dll

A caption's access key, read as VB reads it, and the control that draws the caption.

public static class RDFormsCaption
Inheritance
RDFormsCaption
Inherited Members

Remarks

VB shows && as one &. A single & is hidden and marks the character after it; a trailing &, with nothing to mark, is not shown; and _ is an ordinary character. Where a caption marks more than one character, a control underlines the last, and a menu answers only to the first.

Avalonia's Avalonia.Controls.Primitives.AccessText marks its key with _ and draws __ as one underscore, but takes its key from the first underscore in its text, doubled or not. So only a caption whose key comes before every underscore it shows is drawn as an Avalonia.Controls.Primitives.AccessText. Any other is drawn as plain text, with no key, so that it does not answer to a key VB does not give it.

Methods

AsShown(string)

A caption as shown.

public static string AsShown(string caption)

Parameters

caption string

The caption.

Returns

string

The caption with its & markers read: E&xit is Exit.

Parse(string, KeyChoice)

Reads a caption as VB reads it.

public static RDFormsCaption.Parsed Parse(string caption, RDFormsCaption.KeyChoice choice = KeyChoice.Last)

Parameters

caption string

The caption.

choice RDFormsCaption.KeyChoice

Which marked character is the key, where it marks more than one.

Returns

RDFormsCaption.Parsed

The caption as shown, and its key: E&xit shows Exit with x its key, Tom && Jerry shows Tom & Jerry with no key, and Trail& shows Trail.

Present(string, KeyChoice)

The control that draws a caption: an Avalonia.Controls.Primitives.AccessText where the caption FitsAccessText, a Avalonia.Controls.TextBlock where it does not.

public static TextBlock Present(string caption, RDFormsCaption.KeyChoice choice = KeyChoice.Last)

Parameters

caption string

The caption.

choice RDFormsCaption.KeyChoice

Which marked character is the key, where it marks more than one.

Returns

TextBlock

The control.