NSPressureGestureRecognizer on BoxView Renderer (Cocoa)

JohnErnestJohnErnest USMember ✭✭

I have this nice little control I'm making it's a user control in XAML composed of a few custom rendered controls (a custom shape control and a custom label control both with custom renderers) contained within a custom rendered BoxView that I call a DecoratedBoxView.

What I want is to make it so that whenever the user clicks the blue background under say "Banana" up there it triggers a press gesture. Is that possible with a subclassed BoxView? I can add a gesture recognizer to it, but it doesn't seem to get called with BoxRenderer as it does with a subclass of ImageRenderer. It would be nice though to make the whole container clickable like a button without a native-specific button interface. If not, could I maybe add a transparent subview to it and make that clickable?

Tagged:

Posts

  • JohnErnestJohnErnest USMember ✭✭
    After a while of searching I saw that BoxRenderer uses NSView while ImageRenderer uses NSImageView. The NSView doesn’t seem to respond to mousedown events only mouseup. Any way to fix that behavior?
  • ChrisHamonsChrisHamons USForum Administrator, Xamarin Team Xamurai

    You may have to subclass NSView and provide all of the behavior yourself. Cocoa is rather unflexable and requires subclassing in many cases.

Sign In or Register to comment.