Table of Contents

Interface IMarkupLoadObserver

Namespace
Icy.Markup
Assembly
IcyUI.dll

Receives notifications about what MarkupLoader builds, and from which markup node.

public interface IMarkupLoadObserver
Extension Methods

Remarks

Install one through LoadObserver. Design tooling uses it to map each live object back to the markup it came from. When no observer is installed (the default), the loader does no extra work and allocates nothing extra.

For every observed load the calls arrive on the loading thread, in this order:

  1. DocumentStarted(MarkupLoadScope), once.
  2. ObjectCreated(MarkupLoadScope, XElement, object) for each element, before any of its attributes are applied, then MemberApplied(MarkupLoadScope, XObject, object, MarkupMember, object?, IBinding?) for each attribute or property element applied to it, in document order.
  3. DocumentCompleted(MarkupLoadScope, object) or DocumentFailed(MarkupLoadScope, MarkupException), once.

Calls made through IMarkupBuilder report ObjectCreated(MarkupLoadScope, XElement, object) and MemberApplied(MarkupLoadScope, XObject, object, MarkupMember, object?, IBinding?) against the scope that was passed in, without a start or completion.

Every node's IXmlLineInfo points at the first character of its name.

Properties

ObservedKinds

Gets the kinds of load this observer wants to hear about. The loader creates no scope and makes no call for any other kind.

MarkupLoadScopeKind ObservedKinds { get; }

Property Value

MarkupLoadScopeKind

Methods

DocumentCompleted(MarkupLoadScope, object)

Called when an observed load completes successfully.

void DocumentCompleted(MarkupLoadScope scope, object root)

Parameters

scope MarkupLoadScope

The load's scope.

root object

The root object the load produced.

DocumentFailed(MarkupLoadScope, MarkupException)

Called when an observed load fails, just before the loader rethrows error.

void DocumentFailed(MarkupLoadScope scope, MarkupException error)

Parameters

scope MarkupLoadScope

The load's scope.

error MarkupException

The error the load is about to throw.

DocumentStarted(MarkupLoadScope)

Called when an observed load starts.

void DocumentStarted(MarkupLoadScope scope)

Parameters

scope MarkupLoadScope

The new load's scope.

MemberApplied(MarkupLoadScope, XObject, object, MarkupMember, object?, IBinding?)

Called right after an attribute, property element or element text is applied to a member.

void MemberApplied(MarkupLoadScope scope, XObject node, object target, MarkupMember member, object? value, IBinding? binding)

Parameters

scope MarkupLoadScope

The load's scope.

node XObject

The XAttribute or XElement the value came from.

target object

The object whose member was set.

member MarkupMember

The member that was set.

value object

The value assigned, or Unset when a markup extension chose not to assign one.

binding IBinding

The binding a markup extension such as {Binding} attached to target while resolving this value, or null when it attached none.

ObjectCreated(MarkupLoadScope, XElement, object)

Called right after an element's object is constructed, before its attributes are applied.

void ObjectCreated(MarkupLoadScope scope, XElement node, object instance)

Parameters

scope MarkupLoadScope

The load's scope.

node XElement

The element the object was built from.

instance object

The constructed object.