Table of Contents

Class NameScope

Namespace
Avalonia.Controls
Assembly
Avalonia.Base.dll

Implements a name scope.

public class NameScope : INameScope
Inheritance
NameScope
Implements
Inherited Members
Extension Methods

Constructors

NameScope()

public NameScope()

Fields

NameScopeProperty

Defines the NameScope attached property.

public static readonly AttachedProperty<INameScope> NameScopeProperty

Field Value

AttachedProperty<INameScope>

Properties

IsCompleted

Returns whether further registrations are allowed on the scope

public bool IsCompleted { get; }

Property Value

bool

Methods

Complete()

Marks the name scope as completed, no further registrations will be allowed

public void Complete()

Find(string)

Finds a named element in the name scope, returns immediately, doesn't traverse the name scope stack

public object? Find(string name)

Parameters

name string

The name.

Returns

object

The element, or null if the name was not found.

FindAsync(string)

Finds a named element in the name scope, waits for the scope to be completely populated before returning null Returned task is configured to run any continuations synchronously.

public SynchronousCompletionAsyncResult<object?> FindAsync(string name)

Parameters

name string

The name.

Returns

SynchronousCompletionAsyncResult<object>

The element, or null if the name was not found.

GetNameScope(StyledElement)

Gets the value of the attached NameScopeProperty on a styled element.

public static INameScope GetNameScope(StyledElement styled)

Parameters

styled StyledElement

The styled element.

Returns

INameScope

The value of the NameScope attached property.

Register(string, object)

Registers an element in the name scope.

public void Register(string name, object element)

Parameters

name string

The element name.

element object

The element.

SetNameScope(StyledElement, INameScope)

Sets the value of the attached NameScopeProperty on a styled element.

public static void SetNameScope(StyledElement styled, INameScope value)

Parameters

styled StyledElement

The styled element.

value INameScope

The value to set.