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

Xamarin.Mac NSColorPanel vs NSColorPicker

$
0
0

Can somebody tell me how to use these classes? I've got this simple code and on button click, the NSColorPanel pops up, but I don't know what to do in the panel to get the Selector to be invoked. And what's NSColorPicker used for, customization? How do I use that? Xamarin documentation and samples are pretty sparse in this area.

    partial void btnSetColor(Foundation.NSObject sender)
    {
        NSColorPanel colorPanel = NSColorPanel.SharedColorPanel;
        colorPanel.WeakDelegate = this;
        colorPanel.SetAction(new ObjCRuntime.Selector("colorPickerAction"));
        colorPanel.OrderFront(this);
    }

    [Export("colorPickerAction:")]
    private void colorPickerAction(NSColorPanel panel)
    {
        var color = panel.Color;
        boxColor.FillColor = color;
    }

Thanks


Viewing all articles
Browse latest Browse all 1429

Trending Articles