Quantcast
Channel: Xamarin.Mac — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 1429

NSButton Title is not visible while CALayer is set to the NSButton Layer in Xamarin.Mac

$
0
0

I have struck with NSButton Title visibility. What I have done is, I have taken CALayer and arrange background color, corner radius and border width for that layer. Finally this layer is set to the NSButton Layer But after doing this Title of the NSButton is not visible. Please suggest any idea. Thanks in advance.

Here my code, What I have tried.

    var wordButton = new NSButton(new CGRect(20, 0, tableColumn.Width - 70, 30));

    CALayer layer = new CALayer();

    layer.CornerRadius = 5f;

    layer.BorderWidth = 1f;

    layer.BackgroundColor = NSColor.FromRgba(0.70f, 0.87f, 0.86f, 1.0f).CGColor;

    wordButton.WantsLayer = true;

    wordButton.Layer = layer;

    wordButton.Title = "Test";

    wordButton.SetButtonType(NSButtonType.MomentaryPushIn);

    wordButton.BezelStyle = NSBezelStyle.SmallSquare;

    ![](https://us.v-cdn.net/5019960/uploads/editor/nm/zpzzbcdf1ike.png "")

Viewing all articles
Browse latest Browse all 1429

Trending Articles