Bug 38823 - ActionForKey is not called for custom property
Summary: ActionForKey is not called for custom property
Status: CONFIRMED
Alias: None
Product: iOS
Classification: Xamarin
Component: General (show other bugs)
Version: XI 9.4 (iOS 9.2)
Hardware: PC Mac OS
: --- enhancement
Target Milestone: Future Cycle (TBD)
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-02-16 23:10 UTC by Cody Beyer (MSFT)
Modified: 2017-08-07 15:16 UTC (History)
3 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Sample (15.38 KB, application/zip)
2016-02-16 23:10 UTC, Cody Beyer (MSFT)
Details

Description Cody Beyer (MSFT) 2016-02-16 23:10:12 UTC
Created attachment 15070 [details]
Sample

# Description

The following sample app demonstrates an issue where ActionForKey will not fire for a custom property of a custom layer

# Sample

Attached

# Steps to Reproduce

1. Download sample
2. Set breakpoint at line 49 of TestTextFieldBorderLayer.cs
3. Run in simulator

# Expected Results

Breakpoint should hit

# Actual Results

Breakpoint does not hit

# Additional Notes

If you set the breakpoint at line 47, and repeat step 3, you will see that the event is fired for other properties

# Versions

=== Xamarin Studio ===

Version 6.0 (build 3668)
Installation UUID: f7bdaa72-7488-49e8-a5cc-72440654f7a3
Runtime:
	Mono 4.3.0 (mono-4.3.1-branch/37d269c) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 403002114

=== Xamarin.Profiler ===

Not Installed

=== Apple Developer Tools ===

Xcode 7.2.1 (9548.1)
Build 7C1002

=== Xamarin.iOS ===

Version: 9.4.1.25 (Business Edition)
Hash: 962a050
Branch: master
Build date: 2016-01-29 16:59:11-0500

=== Xamarin.Android ===

Version: 6.0.1.10 (Business Edition)
Android SDK: /Users/codybeyer/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3 (API level 15)
		4.4   (API level 19)
		6.0   (API level 23)

SDK Tools Version: 24.4.1
SDK Platform Tools Version: 23.0.1
SDK Build Tools Version: 23.0.1

Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: 2.4.1.6 (Business Edition)

=== Build Information ===

Release ID: 600003668
Git revision: 23e9d5d22133ca5a7c56b26644ab59a4626bccdb
Build date: 2016-01-20 15:12:22-05
Xamarin addins: bca6749910827de4af7eab7a925ff4ccf2bda06a
Build lane: monodevelop-lion-roslyn-dark-skin-64bit

=== Operating System ===

Mac OS X 10.11.3
Darwin clb-macbook.local 15.3.0 Darwin Kernel Version 15.3.0
	Thu Dec 10 18:40:58 PST 2015
	root:xnu-3248.30.4~1/RELEASE_X86_64 x86_64
Comment 1 Rolf Bjarne Kvinge [MSFT] 2016-02-17 16:48:29 UTC
This seems to be because we don't support anything equivalent to the Objective-C @dynamic keyword (a property without getter/setter).

Relevant reading:

http://stackoverflow.com/a/9058652/183422
https://www.objc.io/issues/12-animations/animating-custom-layer-properties/
https://forums.developer.apple.com/thread/12656
Comment 2 Rolf Bjarne Kvinge [MSFT] 2016-04-27 21:31:39 UTC
Idea how to implement:

    class MyClass : NSObject {
        [ObjectiveCProperty]
        public NSObject MyProperty {
            get { return GetObjectiveCProperty<NSObject> ("MyProperty"); }
            set { SetObjectiveCProperty ("MyProperty", value); }
        }
    }

The [ObjectiveCProperty] would tell the registrars that this needs to be an ObjC property where the data is stored in native code.

The getters/setters would be the code that users would have to write manually.

Note You need to log in before you can comment on or make changes to this bug.