Table of Contents

Class PropertyPath

Namespace
Icy.Data.Bindings
Assembly
IcyUI.dll

Represents a static-typed property path.

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

Constructors

PropertyPath(string, Type, PropertyRegistry?)

Initializes a new instance of the PropertyPath class.

public PropertyPath(string path, Type typeContext, PropertyRegistry? registry = null)

Parameters

path string

The path to get the value by the property.

typeContext Type

Initial type to access the properties for.

registry PropertyRegistry

The registry to resolve registered properties through, or null to capture Current at construction time.

Remarks

The registry is captured once here and shared by every segment of the path, so a single path never straddles two registries. It is not re-resolved per call: a path built under one registry and then used against an object belonging to another still reads and writes through the captured registry's IPropertyReference, which would see a different set of precedence contributions - see the remarks on PropertyRegistry. Build paths in the same scope as the objects they target.

Properties

DisplayPath

Gets the path for this instance for the debug display.

protected string DisplayPath { get; }

Property Value

string

PathSegments

Gets the list of the part segments for this property path.

protected List<PropertyPath.PathSegment> PathSegments { get; }

Property Value

List<PropertyPath.PathSegment>

PropertyType

Gets the type of the last property in the chain.

public Type PropertyType { get; }

Property Value

Type

Methods

DependsOn(string)

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

public virtual 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.

GetValue(object)

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

public virtual object? GetValue(object source)

Parameters

source object

An object to retrieve value from.

Returns

object

The value by the specified property path.

Remarks

Returns null when a value along the path is null, the same as a DynamicPropertyPath. Exceptions thrown by a getter itself propagate.

ParsePath(string, Type, PropertyRegistry?)

Gets the list of path segments for the specified property path.

protected static List<PropertyPath.PathSegment> ParsePath(string path, Type typeContext, PropertyRegistry? registry = null)

Parameters

path string

The path string to parse.

typeContext Type

The type to get property info.

registry PropertyRegistry

The registry to resolve registered properties through, or null to use Current.

Returns

List<PropertyPath.PathSegment>

The list of PropertyPath.PathSegment with all segments of the specified path.

Exceptions

FormatException

Occurs if the indexer wasn't defined correctly.

SetValue(object, object?)

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

public virtual 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 object the last member is set on, or a value on the way to it, is null, the same as a DynamicPropertyPath. Exceptions thrown by a getter or the setter itself propagate.