Table of Contents

Class MarkupMember

Namespace
Icy.Markup
Assembly
IcyUI.dll

A property the loader can read or write, resolved either through the property registry or through plain reflection.

public sealed class MarkupMember
Inheritance
MarkupMember
Inherited Members
Extension Methods

Remarks

Markup needs both paths. A registered property (RegisterReferenceAttribute) is preferred, because writing through its IPropertyReference puts the value into the same precedence system styles, visual states, and animations use - a markup-assigned value is a local one and outranks all of them, exactly as a code-assigned value does.

But the registry only ever contains writable properties of types that opted in, and markup has to reach two kinds of property it therefore never sees: read-only collections that content and property elements populate (Children, ColumnDefinitions), and plain data objects that are not DependencyObjects at all (Width). Those resolve to a PropertyInfo instead.

Properties

CanSet

Gets a value indicating whether this property can be assigned to.

public bool CanSet { get; }

Property Value

bool

Remarks

A read-only collection property is readable but not settable - it is populated by adding to the collection it already holds.

IsRegistered

Gets a value indicating whether writes go through the property registry rather than plain reflection.

public bool IsRegistered { get; }

Property Value

bool

Name

Gets the property's name.

public string Name { get; }

Property Value

string

PropertyType

Gets the property's declared type.

public Type PropertyType { get; }

Property Value

Type

Reference

Gets the registered property reference, when IsRegistered is true.

public IPropertyReference? Reference { get; }

Property Value

IPropertyReference

Remarks

Exposed for callers that need the reference itself rather than the get/set indirection this class provides - BindingExtension is the reason this exists, since Binding binds against an IPropertyReference, not a name.

Methods

EnumerateNames(Type, PropertyRegistry)

Enumerates the names markup could have meant on targetType, for error suggestions.

public static IEnumerable<string> EnumerateNames(Type targetType, PropertyRegistry registry)

Parameters

targetType Type

The type whose properties should be listed.

registry PropertyRegistry

The registry to enumerate registered properties from.

Returns

IEnumerable<string>

Every settable public property name, registered or not.

FromReference(IPropertyReference)

Wraps an already-resolved IPropertyReference as a MarkupMember.

public static MarkupMember FromReference(IPropertyReference reference)

Parameters

reference IPropertyReference

The property reference to wrap.

Returns

MarkupMember

A member that writes through reference.

Remarks

Lets attached-property assignment (which already has the reference from a qualified lookup) share the same value-assignment path - markup extensions included - as an ordinary named property.

GetValue(object)

Reads the property's current value from target.

public object? GetValue(object target)

Parameters

target object

The object to read from.

Returns

object

The current value.

Resolve(Type, string, PropertyRegistry)

Resolves a property on targetType, preferring a registered one.

public static MarkupMember? Resolve(Type targetType, string name, PropertyRegistry registry)

Parameters

targetType Type

The type declaring the property.

name string

The property's name.

registry PropertyRegistry

The registry to resolve registered properties through.

Returns

MarkupMember

The resolved property, or null when the type has no such public property.

SetValue(object, object?)

Assigns value to the property on target.

public void SetValue(object target, object? value)

Parameters

target object

The object to assign to.

value object

The value to assign.

Exceptions

InvalidOperationException

The property has no setter.