Skip to content

Latest commit

 

History

History
39 lines (27 loc) · 1.61 KB

WeakEventListener.md

File metadata and controls

39 lines (27 loc) · 1.61 KB
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

WeakEventListener

The WeakEventListener allows the owner to be garbage collected if its only remaining link is an event handler.

Properties

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

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

Sample Code

You can find examples of WeakEventListener in our unit tests

Requirements

Device family Universal, 10.0.16299.0 or higher
Namespace Microsoft.Toolkit.Uwp
NuGet package Microsoft.Toolkit.Uwp

API Source Code