Xamarin.forms: [macOS] Button Released not being triggered

Created on 1 Feb 2018  路  4Comments  路  Source: xamarin/Xamarin.Forms

Bug report best practices: https://github.com/xamarin/Xamarin.Forms/wiki/Submitting-Issues

Description

Xamarin.Forms for macOS is not triggering Released when a button is clicked.

Steps to Reproduce

  1. Create a custom Button
  2. Add as a named element in a xaml layout
  3. Add an event to the Released EventHandler
  4. Check for calling of event

Expected Behavior

Event is triggered

Actual Behavior

Event is never triggered

Basic Information

  • Version with issue: 2.5.0.122203
  • Last known good version: Unknown
  • IDE: Visual Studio for Mac Enterprise 7.3.3 (build 12)
  • Platform Target Frameworks: MacOS

    • macOS: 10.13 (17C76)

  • Android Support Library Version: N/A
  • Nuget Packages:
  • Affected Devices: MacBookPro11,5

Screenshots

None

Reproduction Link

None

macOS bug

All 4 comments

Adding small app to repo report.

Forms-Issue-1776.zip

This is likely not a bug, but a side effect of NSButton. NSButton does not trigger mouseUp in any way by default. NSButton appears to use a Mouse-Tracking Loop approach as there is documentation about being able to periodically triggering a method as long as the button is held. To get around this, custom NSButton and ViewRenderer implementations can be used where the custom NSButton uses the Three-Method Approach, allowing the button to fire mouse-up, mouse-down, and drag actions. This means using non-standard event handlers to handle each of the mouse event types though. If the team accepts this as the answer, close the issue.

Attaching updated app for example of custom NSButton

Forms-Issue-1776 2.zip

I will be attempting a fix to properly trigger the button pressed and button released for mac OS

Was this page helpful?
0 / 5 - 0 ratings

Related issues

deakjahn picture deakjahn  路  3Comments

rmarinho picture rmarinho  路  3Comments

Papirosnik picture Papirosnik  路  3Comments

EmilAlipiev picture EmilAlipiev  路  3Comments

joseluisct picture joseluisct  路  3Comments