Class MarkupExtensionContext
- Namespace
- Icy.Markup
- Assembly
- IcyUI.dll
What a IMarkupExtension is given to resolve its value: the object and property it is being resolved for, and what the loader knows about the surrounding document.
public sealed class MarkupExtensionContext
- Inheritance
-
MarkupExtensionContext
- Inherited Members
- Extension Methods
Constructors
MarkupExtensionContext(object, MarkupMember, IcyConfiguration, MarkupNameScope, IReadOnlyList<UIElement>, IXmlLineInfo?, string?, UIElement?, Type?)
What a IMarkupExtension is given to resolve its value: the object and property it is being resolved for, and what the loader knows about the surrounding document.
public MarkupExtensionContext(object target, MarkupMember member, IcyConfiguration configuration, MarkupNameScope names, IReadOnlyList<UIElement> elementStack, IXmlLineInfo? node, string? sourcePath, UIElement? templatedControl = null, Type? dataType = null)
Parameters
targetobjectThe object whose property the extension is resolving a value for.
memberMarkupMemberThe property the extension is resolving a value for.
configurationIcyConfigurationThe configuration the loader is resolving the document through.
namesMarkupNameScopeThe document's
x:Namescope.elementStackIReadOnlyList<UIElement>The elements currently under construction, innermost last.
nodeIXmlLineInfoThe extension's position in the source document, for error reporting.
sourcePathstringThe document's path, for error reporting.
templatedControlUIElementThe control a ControlTemplate's content is being built for, when this context belongs to template content - null for an ordinary document.
dataTypeTypeThe
x:DataTypein effect where the extension is used, or null when none is declared.
Properties
Configuration
Gets the configuration the loader is resolving the document through.
public IcyConfiguration Configuration { get; }
Property Value
DataType
Gets the type the data context is declared to have where the extension is used: the x:DataType of
the nearest element, the target's own included, or null when none is declared.
public Type? DataType { get; }
Property Value
Remarks
A template (DataTemplate, ControlTemplate) is a
boundary: its content sees an x:DataType declared on the template element or inside it, never one
from outside, since its items have a data context of their own.
ElementStack
Gets the UIElements currently under construction, innermost last - see
MarkupLoader's private MarkupLoadContext.ElementStack for why this can't
simply be Parent.
public IReadOnlyList<UIElement> ElementStack { get; }
Property Value
Member
Gets the property the extension is resolving a value for.
public MarkupMember Member { get; }
Property Value
Names
Gets the document's x:Name scope, for extensions that resolve an element by name.
public MarkupNameScope Names { get; }
Property Value
Node
Gets the extension's position in the source document, for error reporting.
public IXmlLineInfo? Node { get; }
Property Value
SourcePath
Gets the document's path, for error reporting.
public string? SourcePath { get; }
Property Value
Target
Gets the object whose property the extension is resolving a value for.
public object Target { get; }
Property Value
TemplatedControl
Gets the control a ControlTemplate's content is being built for, or null when this context belongs to an ordinary (non-template) document.
public UIElement? TemplatedControl { get; }
Property Value
Remarks
This is what {TemplateBinding} (see TemplateBindingExtension)
reads as its binding source - it has no other way to reach "the control this template decorates," since
that control is never itself part of ElementStack (it isn't being constructed by the same
document load).