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:
- DocumentStarted(MarkupLoadScope), once.
- 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.
- 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
Methods
DocumentCompleted(MarkupLoadScope, object)
Called when an observed load completes successfully.
void DocumentCompleted(MarkupLoadScope scope, object root)
Parameters
scopeMarkupLoadScopeThe load's scope.
rootobjectThe 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
scopeMarkupLoadScopeThe load's scope.
errorMarkupExceptionThe error the load is about to throw.
DocumentStarted(MarkupLoadScope)
Called when an observed load starts.
void DocumentStarted(MarkupLoadScope scope)
Parameters
scopeMarkupLoadScopeThe 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
scopeMarkupLoadScopeThe load's scope.
nodeXObjectThe XAttribute or XElement the value came from.
targetobjectThe object whose member was set.
memberMarkupMemberThe member that was set.
valueobjectThe value assigned, or Unset when a markup extension chose not to assign one.
bindingIBindingThe binding a markup extension such as
{Binding}attached totargetwhile 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
scopeMarkupLoadScopeThe load's scope.
nodeXElementThe element the object was built from.
instanceobjectThe constructed object.