WeakEventManager.ProtectedRemoveListener(Object, IWeakEventListener) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Removes a previously added listener from the provided source.
protected:
void ProtectedRemoveListener(System::Object ^ source, System::Windows::IWeakEventListener ^ listener);
protected void ProtectedRemoveListener (object source, System.Windows.IWeakEventListener listener);
member this.ProtectedRemoveListener : obj * System.Windows.IWeakEventListener -> unit
Protected Sub ProtectedRemoveListener (source As Object, listener As IWeakEventListener)
Parameters
- source
- Object
The source to remove listeners from.
- listener
- IWeakEventListener
The listening class (which must implement IWeakEventListener).
Remarks
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.
Applies to
See also
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기