Class EventTriggerBase
Represents a trigger that can listen to an object other than its AssociatedObject.
Implements
Inherited Members
Namespace: System.Windows.Interactivity
Assembly: OpenSilver.Interactivity.dll
Syntax
public abstract class EventTriggerBase : TriggerBase, IAttachedObject
Remarks
This is an infrastructure class. Trigger authors should derive from EventTriggerBase<T> instead of this class.
Fields
| Improve this Doc View SourceSourceNameProperty
Declaration
public static readonly DependencyProperty SourceNameProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
SourceObjectProperty
Declaration
public static readonly DependencyProperty SourceObjectProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
Properties
| Improve this Doc View SourceAssociatedObjectTypeConstraint
Gets the type constraint of the associated object.
Declaration
protected sealed override Type AssociatedObjectTypeConstraint { get; }
Property Value
Type | Description |
---|---|
System.Type | The associated object type constraint. |
Overrides
Remarks
Define a TypeConstraintAttribute on a derived type to constrain the types it may be attached to.
Source
Gets the resolved source. If is not set or cannot be resolved, defaults to AssociatedObject.
Declaration
public object Source { get; }
Property Value
Type | Description |
---|---|
System.Object | The resolved source object. |
Remarks
In general, this property should be used in place of AssociatedObject in derived classes.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The element pointed to by |
SourceName
Gets or sets the name of the element this EventTriggerBase listens for as a source. If the name is not set or cannot be resolved, the AssociatedObject will be used. This is a dependency property.
Declaration
public string SourceName { get; set; }
Property Value
Type | Description |
---|---|
System.String | The name of the source element. |
SourceObject
Gets or sets the target object. If TargetObject is not set, the target will look for the object specified by TargetName. If an element referred to by TargetName cannot be found, the target will default to the AssociatedObject. This is a dependency property.
Declaration
public object SourceObject { get; set; }
Property Value
Type | Description |
---|---|
System.Object | The target object. |
SourceTypeConstraint
Gets the source type constraint.
Declaration
protected Type SourceTypeConstraint { get; }
Property Value
Type | Description |
---|---|
System.Type | The source type constraint. |
Methods
| Improve this Doc View SourceGetEventName()
Specifies the name of the Event this EventTriggerBase is listening for.
Declaration
protected abstract string GetEventName()
Returns
Type | Description |
---|---|
System.String |
OnAttached()
Called after the trigger is attached to an AssociatedObject.
Declaration
protected override void OnAttached()
Overrides
| Improve this Doc View SourceOnDetaching()
Called when the trigger is being detached from its AssociatedObject, but before it has actually occurred.
Declaration
protected override void OnDetaching()
Overrides
| Improve this Doc View SourceOnEvent(EventArgs)
Called when the event associated with this EventTriggerBase is fired. By default, this will invoke all actions on the trigger.
Declaration
protected virtual void OnEvent(EventArgs eventArgs)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | eventArgs | The System.EventArgs instance containing the event data. |
Remarks
Override this to provide more granular control over when actions associated with this trigger will be invoked.