Table of Contents

Class DynamicPropertyPath

Namespace
Icy.Data.Bindings
Assembly
IcyUI.dll

Represents the property path that is traversed dynamically, according to the provided object type.

public class DynamicPropertyPath : IPropertyPath, IReadOnlyPropertyPath
Inheritance
DynamicPropertyPath
Implements
Inherited Members
Extension Methods

Constructors

DynamicPropertyPath(string)

Initializes a new instance of the DynamicPropertyPath class.

public DynamicPropertyPath(string path)

Parameters

path string

The path to access properties.

DynamicPropertyPath(string, ILogger?)

Initializes a new instance of the DynamicPropertyPath class that warns, once, when a member of the path doesn't exist on the object it's read from.

public DynamicPropertyPath(string path, ILogger? logger)

Parameters

path string

The path to access properties.

logger ILogger

Where to warn about a member the source doesn't have, or null for no warning.

Properties

PropertyType

Gets the type of the last property in the chain.

public Type PropertyType { get; }

Property Value

Type

Remarks

A dynamic path doesn't know its types until it walks a source object, so this is always object. Use GetPropertyType(object) to resolve the real type.

Methods

DependsOn(string)

Determines whether a change of the specified property on the source object can change this path's value.

public bool DependsOn(string propertyName)

Parameters

propertyName string

The name of the changed property, as reported by INotifyPropertyChanged.

Returns

bool

true if the path starts with the specified property, or if it can't tell; otherwise, false. The default implementation always returns true.

Remarks

A Binding uses this to ignore change notifications for unrelated properties of its source, so they don't overwrite the text a user is typing.

GetPropertyType(object)

Gets the type of the last property in the chain, resolved against the specified source object.

public Type GetPropertyType(object source)

Parameters

source object

An object the path starts from.

Returns

Type

The declared type of the last property in the chain. The default implementation returns PropertyType.

Remarks

Paths that only learn their types at runtime, such as DynamicPropertyPath, override this method to report the real property type, so a Binding can convert typed text into it.

GetValue(object)

Gets the value by calling the property chain for the specified source object.

public object? GetValue(object source)

Parameters

source object

An object to retrieve value from.

Returns

object

The value by the specified property path.

SetValue(object, object?)

Sets the value by calling the property chain for the specified target object.

public void SetValue(object target, object? value)

Parameters

target object

An object to set the value to.

value object

The value to set to the property.

Remarks

Does nothing when the path can't be resolved: an intermediate value is null, or a property along the path doesn't exist.

Exceptions from the final write itself propagate: the setter rejecting the value (wrapped in a TargetInvocationException), or a value of the wrong type (ArgumentException).