Export (0) Print
Expand All

WeakEventManager.ProtectedRemoveListener Method

Removes a previously added listener from the provided source.

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

'Declaration
Protected Sub ProtectedRemoveListener ( _
	source As Object, _
	listener As IWeakEventListener _
)

Parameters

source
Type: System.Object

The source to remove listeners from.

listener
Type: System.Windows.IWeakEventListener

The listening class (which must implement IWeakEventListener).

Call this method within your manager class RemoveListener methods on WeakEventManager implementations. RemoveListener is the suggested name for the static method you define on your manager class to enable other classes to remove a listener for your weak event pattern. RemoveListener should take two parameters: the source where the listener is removed, and the listener class. For your RemoveListener implementation, call the ProtectedRemoveListener method on the current manager and pass the same two parameters.

If a call to ProtectedRemoveListener removes the last listener in the list, ProtectedRemoveListener calls the StopListening method internally, which will call your specific StopListening override through polymorphism.

ProtectedRemoveListener removes listeners from a single internal WeakEventManager.ListenerList per source. If your manager implementation maintains more than one list of listeners for each event-source combination, do not use ProtectedRemoveListener. Instead, your implementation should create its own WeakEventManager.ListenerList instances, RemoveListener should remove listeners from the appropriate list, and events should be delivered to the appropriate listener list by calling the DeliverEventToList method instead of the DeliverEvent method.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Show:
© 2014 Microsoft