Share via


NSToolbar.Notifications.ObserveNSToolbarDidRemoveItem Method

Definition

Overloads

ObserveNSToolbarDidRemoveItem(EventHandler<NSToolbarItemEventArgs>)

Strongly typed notification for the NSToolbarDidRemoveItemNotification constant.

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

Parameters

handler
EventHandler<NSToolbarItemEventArgs>

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 NSToolbarDidRemoveItemNotification notifications.

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

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

Applies to

ObserveNSToolbarDidRemoveItem(NSObject, EventHandler<NSToolbarItemEventArgs>)

Strongly typed notification for the NSToolbarDidRemoveItemNotification constant.

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

Parameters

objectToObserve
NSObject

The specific object to observe.

handler
EventHandler<NSToolbarItemEventArgs>

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 NSToolbarDidRemoveItemNotification notifications.

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

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

Applies to