This documentation is archived and is not being maintained.

WeakEventManager.Purge Method

Removes inactive listener entries from the data list for the provided source. Returns true if some entries were actually removed from the list.

Namespace:  System.Windows
Assembly:  WindowsBase (in WindowsBase.dll)

protected virtual bool Purge(
	Object source,
	Object data,
	bool purgeAll


Type: System.Object
The source for events being listened to.
Type: System.Object
The data to check. This object is expected to be a WeakEventManager.ListenerList implementation.
Type: System.Boolean
true to stop listening to source, and completely remove all entries from data.

Return Value

Type: System.Boolean
true if some entries were actually removed; otherwise, false.

The Purge method has a default implementation that will remove all entries when data is a WeakEventManager.ListenerList.

Notes to Implementers

If the underlying type for the Item is something other than WeakEventManager.ListenerList, or contains data beyond a WeakEventManager.ListenerList, you must override the Purge method. The override should provide purge behavior for the alternate type items list. Generally, the override should provide behavior without calling the base implementation. If a specific WeakEventManager.ListenerList still needs clearing, call Purge.

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.