StateDiagramState Class

A state of a state diagram. A state with regions is a composite state, drawn as a frame around them.

public sealed class StateDiagramState

Constructors

NameDescription
StateDiagramState(string, DiagramText?, StateKind)Initializes a new instance of the StateDiagramState class.

StateDiagramState(string, DiagramText?, StateKind)

StateDiagramState.cs

Initializes a new instance of the StateDiagramState class.

public StateDiagramState(string id, DiagramText? label = null, StateKind kind = StateKind.Normal)

Parameters

id string
The identifier, unique in the diagram, which is the name shown when there is no label.
label DiagramText?
The name shown, or null to show the identifier.
kind StateKind
The kind of the state.

Properties

NameDescription
CssClassesGets the CSS classes of the state: the names of styles of StateDiagram.ClassDefinitions.
DirectionGets or sets the direction of the content of a composite state, or null for the direction of the diagram. As in Mermaid, it applies only when no transition crosses the border of the state.
IdGets the identifier of the state.
IsCompositeGets a value that indicates whether the state has regions.
KindGets or sets the kind of the state.
LabelGets or sets the name shown, or null to show the identifier.
RegionsGets the regions of a composite state: one for a composite state, several for concurrent parts (Mermaid --).
StyleGets or sets the style of the state, which takes precedence over the style of its classes.

Gets the CSS classes of the state: the names of styles of StateDiagram.ClassDefinitions.

public IList<string> CssClasses { get; }

Property value

IList<string>

Gets or sets the direction of the content of a composite state, or null for the direction of the diagram. As in Mermaid, it applies only when no transition crosses the border of the state.

public DiagramDirection? Direction { get; set; }

Property value

DiagramDirection?

Gets the identifier of the state.

public string Id { get; }

Property value

string

Gets a value that indicates whether the state has regions.

public bool IsComposite { get; }

Property value

bool

Gets or sets the kind of the state.

public StateKind Kind { get; set; }

Property value

StateKind

Gets or sets the name shown, or null to show the identifier.

public DiagramText? Label { get; set; }

Property value

DiagramText?

Gets the regions of a composite state: one for a composite state, several for concurrent parts (Mermaid --).

public IList<StateDiagramRegion> Regions { get; }

Gets or sets the style of the state, which takes precedence over the style of its classes.

public DiagramStyle? Style { get; set; }

Property value

DiagramStyle?

Methods

NameDescription
AddState(string, DiagramText?, StateKind)Adds a state to the last region of this state, which becomes a composite state.
ToString()Returns the identifier of the state.

AddState(string, DiagramText?, StateKind)

StateDiagramState.cs

Adds a state to the last region of this state, which becomes a composite state.

public StateDiagramState AddState(string id, DiagramText? label = null, StateKind kind = StateKind.Normal)

Parameters

id string
The identifier of the state, unique in the diagram.
label DiagramText?
The name shown, or null to show the identifier.
kind StateKind
The kind of the state.

Returns

StateDiagramState The state.

Returns the identifier of the state.

public override string ToString()

Returns

string The identifier.