Share via


NSOutlineView.Notifications.ObserveItemWillExpand Method

Definition

Overloads

ObserveItemWillExpand(EventHandler<NSOutlineViewItemEventArgs>)

Strongly typed notification for the ItemWillExpandNotification constant.

public static Foundation.NSObject ObserveItemWillExpand(EventHandler<AppKit.NSOutlineViewItemEventArgs> handler);
static member ObserveItemWillExpand : EventHandler<AppKit.NSOutlineViewItemEventArgs> -> Foundation.NSObject

Parameters

handler
EventHandler<NSOutlineViewItemEventArgs>

The handler that responds to the notification when it occurs.

Returns

Token object that can be used to stop receiving notifications by either disposing it or passing it to RemoveObservers(IEnumerable<NSObject>).

Remarks

This method can be used to subscribe to ItemWillExpandNotification notifications.

// Listen to all notifications posted for any object
var token = NSOutlineView.Notifications.ObserveItemWillExpand ((notification) => {
  Console.WriteLine ("Observed ItemWillExpandNotification!");
};

// Stop listening for notifications
token.Dispose ();

Applies to

ObserveItemWillExpand(NSObject, EventHandler<NSOutlineViewItemEventArgs>)

Strongly typed notification for the ItemWillExpandNotification constant.

public static Foundation.NSObject ObserveItemWillExpand(Foundation.NSObject objectToObserve, EventHandler<AppKit.NSOutlineViewItemEventArgs> handler);
static member ObserveItemWillExpand : Foundation.NSObject * EventHandler<AppKit.NSOutlineViewItemEventArgs> -> Foundation.NSObject

Parameters

objectToObserve
NSObject

The specific object to observe.

handler
EventHandler<NSOutlineViewItemEventArgs>

The handler that responds to the notification when it occurs.

Returns

Token object that can be used to stop receiving notifications by either disposing it or passing it to RemoveObservers(IEnumerable<NSObject>).

Remarks

This method can be used to subscribe to ItemWillExpandNotification notifications.

// Listen to all notifications posted for a single object
var token = NSOutlineView.Notifications.ObserveItemWillExpand (objectToObserve, (notification) => {
  Console.WriteLine ($"Observed ItemWillExpandNotification for {nameof (objectToObserve)}!");
};

// Stop listening for notifications
token.Dispose ();

Applies to