Docs / UI

Glossary: DependencyProperty<T>

The members of DependencyProperty, in alphabetical order.

Color legend plain property method event

A class. The styles page shows it in context.

Names are colored by what they are: a property, a method or an event; values and fields keep the plain color.

Properties

PostAction 馃爢

Action<T> 路 Called with the new value in effect after the element class鈥檚 own reaction (its OwnerPostAction), only when the value in effect changes (see setting a value), before OnPropertyChanged.

PreAction 馃爢

PreActionDelegate 路 Called with (ref T value, ref bool canProceed) before every value is stored, from any source: change value to correct it, or set canProceed to false to reject it. It runs after the element class鈥檚 own check (its OwnerPreAction), so it gets the value the element already corrected, and it doesn鈥檛 run for a value the element rejected (see setting a value).

Value 馃爢

T 路 Read-only. The value in effect: the one of the highest priority source, or the default when no source has one.

ValueSource 馃爢

ValueSources 路 Read-only. The source the value in effect comes from, None when the property reads its default. BaseElement.ValueSourceOf reads the same by the property鈥檚 name, without creating it.

Methods

DependencyProperty() 馃爢

DependencyProperty(BaseElement owner, Action<T> postAction = null, PreActionDelegate preAction = null) 路 Creates a stand-alone property owned by an element, with an optional post- and pre-action. Its default is default(T).

Parameter Type Description
owner BaseElement The element the property belongs to, passed to the owner actions.
postAction Action<T> Called with the new value whenever the value in effect changes. Default: null.
preAction PreActionDelegate Checks every value before it is stored: it can change the value or reject it. Default: null.

DependencyProperty(BaseElement owner, DependencyPropertyActions<T> actions) 路 Creates a property that shares the element class鈥檚 actions and default; the generated FooDP properties use it.

Parameter Type Description
owner BaseElement The element the property belongs to, passed to the owner actions.
actions DependencyPropertyActions<T> The shared actions and default of the element class鈥檚 property (FooDPActions).

Bind() 馃爢

Bind(object dataContext, string sourcePropertyName, BindingMode mode, IConverter converter = null) 路 Binds the property to a public property of dataContext, replacing any earlier binding. See bindings.

Parameter Type Description
dataContext object The source object, usually a Bindable view model, whose property changes the binding follows.
sourcePropertyName string The name of the source鈥檚 public property; nameof keeps it right.
mode BindingMode Which way the values go: OneWay (source to property), OneWayToSource (property to source) or TwoWay.
converter IConverter Converts the values between the source鈥檚 type and the property鈥檚, or null when they are the same. Default: null.

ClearValue() 馃爢

ClearValue(ValueSources valueSource) 路 Removes the value of that source. If it was the value in effect, the next source (or the default) takes over and the change is raised when the value differs.

Parameter Type Description
valueSource ValueSources The source whose value is removed.

Dispose() 馃爢

Dispose() 路 Removes the binding and the event handlers. The element calls it when it is disposed.

SetValue() 馃爢

SetValue(T value, bool checkForEquality = true, bool setSourceValue = true, ValueSources valueSource = ValueSources.ManualAssign) 路 Stores the value for the source. With checkForEquality off, the same value raises the change again. With setSourceValue off, a bound source is not written.

Parameter Type Description
value T The value to store.
checkForEquality bool Whether storing a value equal to the stored one stops there; with false the change is raised again. Default: true.
setSourceValue bool Whether a bound source property is written too (TwoWay and OneWayToSource bindings). Default: true.
valueSource ValueSources The source the value is stored for: ManualAssign (code), StyleOverride or GeneralStyle. Default: ValueSources.ManualAssign.

Events

OnPropertyChanged 馃爢

(T value) 路 The value in effect changes. The handler gets the new value.

Parameter Type Description
value T The new value in effect.

OnSourceCollectionChanged 馃爢

(CollectionChangeType changeType, int startIndex, int count) 路 The IBindableCollection held by the bound source property adds (Add) or removes (Remove) items. Not raised in OneWayToSource mode.

Parameter Type Description
changeType CollectionChangeType Whether items were added (Add) or removed (Remove).
startIndex int The index of the first item added or removed.
count int The number of items added or removed.

OnSourcePropertyChanged 馃爢

(object propertyValue) 路 The bound Bindable source reports a change of the bound property (or of all properties, with an empty name). The handler gets the source property鈥檚 value, before conversion. Not raised for the echo of the property鈥檚 own write, nor in OneWayToSource mode.

Parameter Type Description
propertyValue object The source property鈥檚 value, before conversion.