NSToolbar.Notifications.ObserveNSToolbarWillAddItem 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.
Overloads
| Name | Description |
|---|---|
| ObserveNSToolbarWillAddItem(EventHandler<NSToolbarItemEventArgs>) |
Strongly typed notification for the NSToolbarWillAddItemNotification constant. |
| ObserveNSToolbarWillAddItem(NSObject, EventHandler<NSToolbarItemEventArgs>) |
Strongly typed notification for the NSToolbarWillAddItemNotification constant. |
ObserveNSToolbarWillAddItem(EventHandler<NSToolbarItemEventArgs>)
Strongly typed notification for the NSToolbarWillAddItemNotification constant.
public static Foundation.NSObject ObserveNSToolbarWillAddItem(EventHandler<AppKit.NSToolbarItemEventArgs> handler);
static member ObserveNSToolbarWillAddItem : 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 NSToolbarWillAddItemNotification notifications.
// Listen to all notifications posted for any object
var token = NSToolbar.Notifications.ObserveNSToolbarWillAddItem ((notification) => {
Console.WriteLine ("Observed NSToolbarWillAddItemNotification!");
};
// Stop listening for notifications
token.Dispose ();
Applies to
ObserveNSToolbarWillAddItem(NSObject, EventHandler<NSToolbarItemEventArgs>)
Strongly typed notification for the NSToolbarWillAddItemNotification constant.
public static Foundation.NSObject ObserveNSToolbarWillAddItem(Foundation.NSObject objectToObserve, EventHandler<AppKit.NSToolbarItemEventArgs> handler);
static member ObserveNSToolbarWillAddItem : 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 NSToolbarWillAddItemNotification notifications.
// Listen to all notifications posted for a single object
var token = NSToolbar.Notifications.ObserveNSToolbarWillAddItem (objectToObserve, (notification) => {
Console.WriteLine ($"Observed NSToolbarWillAddItemNotification for {nameof (objectToObserve)}!");
};
// Stop listening for notifications
token.Dispose ();