Class EventTriggerBase<T>
Represents a trigger that can listen to an element other than its AssociatedObject.
Inheritance
Implements
Inherited Members
Namespace: System.Windows.Interactivity
Assembly: OpenSilver.Interactivity.dll
Syntax
public abstract class EventTriggerBase<T> : EventTriggerBase, IAttachedObject where T : class
Type Parameters
Name | Description |
---|---|
T | The type that this trigger can be associated with. |
Remarks
EventTriggerBase extends TriggerBase to add knowledge of another object than the one it is attached to. This allows a user to attach a Trigger/Action pair to one element and invoke the Action in response to a change in another object somewhere else. Override OnSourceChanged to hook or unhook handlers on the source element, and OnAttached/OnDetaching for the associated element. The type of the Source element can be constrained by the generic type parameter. If you need control over the type of the AssociatedObject, set a TypeConstraintAttribute on your derived type.
Constructors
| Improve this Doc View SourceEventTriggerBase()
Initializes a new instance of the EventTriggerBase<T> class.
Declaration
protected EventTriggerBase()
Properties
| Improve this Doc View SourceSource
Gets the resolved source. If is not set or cannot be resolved, defaults to AssociatedObject.
Declaration
public T Source { get; }
Property Value
Type | Description |
---|---|
T | The resolved source object. |
Remarks
In general, this property should be used in place of AssociatedObject in derived classes.
Methods
| Improve this Doc View SourceOnSourceChanged(T, T)
Called when the source property changes.
Declaration
protected virtual void OnSourceChanged(T oldSource, T newSource)
Parameters
Type | Name | Description |
---|---|---|
T | oldSource | The old source. |
T | newSource | The new source. |
Remarks
Override this to hook functionality to and unhook functionality from the specified source, rather than the AssociatedObject.