xamarin / mac-samples

Sample programs showing how to use Xamarin.Mac on OSX.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Help - NSMenuItem.SeparatorItem shows full height

ivancitin opened this issue · comments

Taking the example:

menu.AddItem ("Get URL", new ObjCRuntime.Selector ("getURL:"), string.Empty);

And adding this lines right after

menu.AddItem(NSMenuItem.SeparatorItem);
menu.AddItem("Second Item", new ObjCRuntime.Selector("getURL:"), string.Empty);

Places a separator item, but it shows with the full height of a regular menu item, instead of a thin line as expected.

Has anyone experienced this, is there something i can do to fix it.

I'm using Xamarin.Mac version 4.2.1.29, on a 10.12 Mac.

finder-extension-separator-item

Hi @ivancitin, I was able to reproduce this. I then tried a couple of things:

  1. I created (with Xamarin.Mac) a simple menu bar app (not a Finder Sync extension) and added a separator to its menu; this did show the horizontal line, as expected.
  2. I used Xcode to create a macOS app, and added a Finder Sync extension target to it. Then, in the Finder Sync extension's auto-generated menuForKind method, I added a separator and another menu item, and it shows also as you have described above – with a space.

I also came across a Stack Overflow post from an Objective-C developer asking the same question, and another relevant Stack Overflow post.

Unfortunately, for Finder Sync extensions, it looks like this may be the expected behavior. I'm going to close this issue, but please comment if you find an alternative. Thank you!