NSWindow TitlebarAppearsTransparent titlebar corner does not change color

XavierFortinXavierFortin USMember ✭✭

Hi,

This is kind of a weird issue. I get a different UI behavior between a Xamarin project and a native XCode project if I set the TitlebarAppearsTransparent of an NSWindow.

Here is what the window looks like in the Xamarin project:

And here is what I get in the XCode project:

The XCode behavior is obviously what is to be expected.

The code between the two projects is as similar as it can possibly be.

C#:

public partial class MainWindowController : NSWindowController
{
    public MainWindowController (IntPtr handle) : base (handle)
    {
    }

    public override void WindowDidLoad()
    {
        base.WindowDidLoad();

        this.Window.TitlebarAppearsTransparent = true;
        this.Window.MovableByWindowBackground = true;

        this.Window.BackgroundColor = NSColor.Blue;
    }
}

Swift:

class MainWindowController: NSWindowController
{
    override func windowDidLoad()
    {
        super.windowDidLoad();

        self.window?.titlebarAppearsTransparent = true;
        self.window?.isMovableByWindowBackground = true;

        self.window?.backgroundColor = NSColor.blue;
    }
}

Any idea why I get this behavior?

I've attached my two test project.

Best Answers

Answers

  • XavierFortinXavierFortin USMember ✭✭

    Well, I'll be damned. That was it.

    Though, isn't that weird that setting the wantsLayer property on a view would effect the titlebar appearance of it's window?

    And is it intentional that the default wantsLayer value of a newly created project differs between a Xamarin project and an XCode project? I'm pretty sure I didn't touch that settings.

  • ChrisHamonsChrisHamons USForum Administrator, Xamarin Team Xamurai

    I completely agree that is not expected Cocoa drawing behavior (crazy!).

    And no, it is not intentional. We have "template" storyboard files we generate in new projects, and it appears Apple silently updated theirs. I've filed a bug:

    https://bugzilla.xamarin.com/show_bug.cgi?id=58250

  • XavierFortinXavierFortin USMember ✭✭

    Good to hear it.

    Thanks to both of you.

Sign In or Register to comment.