In objective-C, I can make my subclass of NSTextField conform to the the NSTextViewDelegate protocol - like so:
@interface PasswordField : NSTextField <NSTextViewDelegate>
How can I translate this idiom to C# / monomac?
I have tried subclassing NSTextViewDelegate:
private class TextViewDelegate : NSTextViewDelegate
{}
And assigning that to the delegate property of my NSTextField subclass:
public class PasswordField : NSTextField
{
public PasswordField(NSCoder coder) : base(coder)
{
this.Delegate = new TextViewDelegate();
}
}
However, obviously this does not work since the Delegate property of NSTextField is (correctly) typed as NSTextFieldDelegate.
Error CS0029: Cannot implicitly convert type `PasswordFieldControl.PasswordField.TextViewDelegate' to `MonoMac.AppKit.NSTextFieldDelegate' (CS0029)
So how to make this work as it does in objective-C?