Table of Contents

Class EventObserver

Namespace
Microsoft.Xaml.Behaviors
Assembly
Microsoft.Xaml.Behaviors.dll

EventObserver is designed to help manage event handlers by detatching when disposed. Creating this object will also attach in the constructor.

public sealed class EventObserver : IDisposable
Inheritance
EventObserver
Implements
Inherited Members

Constructors

EventObserver(EventInfo, object, Delegate)

Creates an instance of EventObserver and attaches to the supplied event on the supplied target. Call dispose to detach.

public EventObserver(EventInfo eventInfo, object target, Delegate handler)

Parameters

eventInfo EventInfo

The event to attach and detach from.

target object

The target object the event is defined on. Null if the method is static.

handler Delegate

The delegate to attach to the event.

Methods

Dispose()

Detaches the handler from the event.

public void Dispose()