title | author | description | keywords |
---|---|---|---|
WeakEventListener |
nmetulev |
The WeakEventListener allows the owner to be garbage collected if its only remaining link is an event handler. |
windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, WeakEventListener |
The WeakEventListener allows the owner to be garbage collected if its only remaining link is an event handler.
Property | Type | Description |
---|---|---|
OnDetachAction | WeakEventListener<TInstance,TSource,TEventArgs>> | Gets or sets the method to call when detaching from the event |
OnEventAction | Action<TInstance,TSource,TEventArgs> | Gets or sets the method to call when the event fires |
Methods | Return Type | Description |
---|---|---|
Detach() | void | Detaches from the subscribed event |
OnEvent(TSource, TEventArgs) | void | Handler for the subscribed event calls OnEventAction to handle it |
You can find examples of WeakEventListener in our unit tests
Device family | Universal, 10.0.16299.0 or higher |
---|---|
Namespace | Microsoft.Toolkit.Uwp |
NuGet package | Microsoft.Toolkit.Uwp |