Share via


NSOutlineView.Notifications.ObserveItemWillCollapse Method

Definition

Overloads

ObserveItemWillCollapse(EventHandler<NSOutlineViewItemEventArgs>)

Strongly typed notification for the ItemWillCollapseNotification constant.

public static Foundation.NSObject ObserveItemWillCollapse(EventHandler<AppKit.NSOutlineViewItemEventArgs> handler);
static member ObserveItemWillCollapse : 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 ItemWillCollapseNotification notifications.

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

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

Applies to

ObserveItemWillCollapse(NSObject, EventHandler<NSOutlineViewItemEventArgs>)

Strongly typed notification for the ItemWillCollapseNotification constant.

public static Foundation.NSObject ObserveItemWillCollapse(Foundation.NSObject objectToObserve, EventHandler<AppKit.NSOutlineViewItemEventArgs> handler);
static member ObserveItemWillCollapse : 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 ItemWillCollapseNotification notifications.

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

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

Applies to