Skip to main content

HighlightLayerCollection Class

Definition​

Assembly:Avalonia.Controls.Documents
Package:Avalonia.Controls.Documents

Manages a collection of highlight layers with Z-ordering. Enumeration and the indexer walk the layers in render order, lowest Avalonia.Controls.Documents.Primitives.Highlighting.IHighlightLayer.ZIndex first.

public class HighlightLayerCollection

Inheritance: object -> HighlightLayerCollection

Implements: IEnumerable<IHighlightLayer>, IReadOnlyCollection<IHighlightLayer>, IReadOnlyList<IHighlightLayer>, IEnumerable

Constructors​

NameDescription
HighlightLayerCollectionNo summary available.

HighlightLayerCollection Constructor​

public HighlightLayerCollection()

Methods​

NameDescription
AddAdds a highlight layer to the collection.
ClearClears all layers from the collection.
GetEnumeratorReturns an enumerator that walks the layers in render order.
GetLayerGets a layer by name.
GetLayersGets all layers ordered by Z-index.
RemoveRemoves a highlight layer from the collection.
RenderRenders all visible layers.

Add Method​

Adds a highlight layer to the collection.

public void Add(Avalonia.Controls.Documents.Primitives.Highlighting.IHighlightLayer layer)

Parameters​

layer Avalonia.Controls.Documents.Primitives.Highlighting.IHighlightLayer

The layer to add.

Exceptions​

Clear Method​

Clears all layers from the collection.

public void Clear()

GetEnumerator Method​

Returns an enumerator that walks the layers in render order.

public System.Collections.Generic.IEnumerator<Avalonia.Controls.Documents.Primitives.Highlighting.IHighlightLayer> GetEnumerator()

Returns​

System.Collections.Generic.IEnumerator<Avalonia.Controls.Documents.Primitives.Highlighting.IHighlightLayer>

GetLayer Method​

Gets a layer by name.

public Avalonia.Controls.Documents.Primitives.Highlighting.IHighlightLayer GetLayer(string name)

Parameters​

name string

The name of the layer.

Returns​

Avalonia.Controls.Documents.Primitives.Highlighting.IHighlightLayer

The layer with the specified name, or null if not found.

GetLayers Method​

Gets all layers ordered by Z-index.

public System.Collections.Generic.IEnumerable<Avalonia.Controls.Documents.Primitives.Highlighting.IHighlightLayer> GetLayers()

Returns​

System.Collections.Generic.IEnumerable<Avalonia.Controls.Documents.Primitives.Highlighting.IHighlightLayer>

An enumerable of layers ordered by Z-index.

Remarks​

Enumerate the collection itself, which walks the same order.

Remove Method​

Removes a highlight layer from the collection.

public bool Remove(Avalonia.Controls.Documents.Primitives.Highlighting.IHighlightLayer layer)

Parameters​

layer Avalonia.Controls.Documents.Primitives.Highlighting.IHighlightLayer

The layer to remove.

Returns​

bool

True if the layer was removed; otherwise, false.

Render Method​

Renders all visible layers.

public void Render(Avalonia.Media.DrawingContext context, Avalonia.Controls.Documents.Primitives.ITextView textView)

Parameters​

context Avalonia.Media.DrawingContext

The drawing context.

textView Avalonia.Controls.Documents.Primitives.ITextView

The text view for coordinate mapping.

Properties​

NameDescription
CountGets the number of layers in the collection.
ItemNo summary available.

Count Property​

Gets the number of layers in the collection.

public int Count { get; set; }

Item Property​

public Avalonia.Controls.Documents.Primitives.Highlighting.IHighlightLayer Item { get; set; }

Events​

NameDescription
RegionsChangedEvent raised when any layer's regions change.

RegionsChanged Event​

Event raised when any layer's regions change.

public event EventHandler RegionsChanged