Forum Xamarin.Mac

Add right and left click events to StatusBarItem?

Dutch2Dutch2 Member ✭✭

How can I add a left and right click event to a StatusBar Item?

StatusItem = NSStatusBar.SystemStatusBar.CreateStatusItem(NSStatusItemLength.Variable);
//StatusItem.Menu = barMenu;
//StatusItem.Button.Menu = barMenu;
StatusItem.Button.Activated += StatusItemClicked;

If I add the barMenu to the StatusBarItem or it's Button the menu pops up with a right or a left click and StatusItemClicked is not fired.

StatusItemClicked works great as long as I don't add a menu.

I've tried to experiment with StatusItem.Button.SendAction to add a right mouse click but no luck so far.

Any suggestions on how I can make this work?

Thanks in advance,

Sign In or Register to comment.