Bug 38739 - Effects on Cells
Summary: Effects on Cells
Status: CONFIRMED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.0.0
Hardware: PC Windows
: Normal enhancement
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-02-13 13:13 UTC by Michael Rumpler
Modified: 2016-12-20 22:53 UTC (History)
9 users (show)

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


Attachments
sample project (296.65 KB, application/x-zip-compressed)
2016-02-13 13:13 UTC, Michael Rumpler
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 38739 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description Michael Rumpler 2016-02-13 13:13:05 UTC
Created attachment 15034 [details]
sample project

I tried to apply an Effect to a Cell, but that doesn't seem to work. My OnAttached method in the Effect is never called.

I tried this with XF 2.1.0-pre4 on iOS, Android, UWP and WinRT desktop.

I'm pretty sure, that I configured the Effect correctly. In the 2nd sample project for bug #33450 I tried to apply the same Effect to a ListView and a Cell. The OnAttached method was called for the ListView, but not for the Cell.
Comment 1 Keith Rome 2016-05-01 21:53:38 UTC
Ran into the same thing today. Posted a simple repro of the issue on the forums here: https://forums.xamarin.com/discussion/65809/custom-effects-api-and-listview-cells
Comment 2 Tiffany 2016-10-04 13:46:41 UTC
I ran into the same issue today as well.
I can attach the effect using code behind or XAML but the OnAttached method is never called.

My details:

=== Xamarin Studio Enterprise ===

Version 6.1.1 (build 15)
Installation UUID: e4bb5169-0b81-4f08-894d-b923b012af71
Runtime:
	Mono 4.6.1 (mono-4.6.0-branch-c8sr0/abb06f1) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 406010003

=== NuGet ===

Version: 3.4.3.0

=== Xamarin.Profiler ===

Version: 0.32.0
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 8.0 (11246)
Build 8A218a

=== Xamarin.Android ===

Version: 7.0.1.2 (Xamarin Enterprise)
Android SDK: /Users/tiffany_ip/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3 (API level 15)
		4.4   (API level 19)
		5.1   (API level 22)
		6.0   (API level 23)
		7.0   (API level 24)

SDK Tools Version: 25.2.2
SDK Platform Tools Version: 24.0.3
SDK Build Tools Version: 24.0.2

Java SDK: /usr
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin Android Player ===

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

=== Xamarin.Mac ===

Version: 2.10.0.103 (Xamarin Enterprise)

=== Xamarin.iOS ===

Version: 10.0.1.8 (Xamarin Enterprise)
Hash: 3983064
Branch: cycle8-sr0-xi
Build date: 2016-09-23 15:34:54-0400

=== Xamarin Inspector ===

Version: 0.9.0.14
Hash: 4d868da
Branch: master
Build date: Mon Jun 13 19:14:13 UTC 2016

=== Build Information ===

Release ID: 601010015
Git revision: fa52f02641726146e2589ed86ec4097fbe101888
Build date: 2016-09-22 08:03:02-04
Xamarin addins: 75d65712af93d54dc39ae4c42b21dfa574859fd6
Build lane: monodevelop-lion-cycle8-sr0

=== Operating System ===

Mac OS X 10.11.6
Darwin mt-mac-tiffanyip.local 15.6.0 Darwin Kernel Version 15.6.0
    Mon Aug 29 20:21:34 PDT 2016
    root:xnu-3248.60.11~1/RELEASE_X86_64 x86_64

=== Enabled user installed addins ===

Xamarin Inspector 0.9.0.14
Comment 3 adrianknight89 2016-10-18 02:33:24 UTC
Effects are designed to give you access to the native view as well as the PCL view. They are similar to custom renderers. The problem is cells are not visual elements hence do not implement IVisualElementRenderer. That means cells do not have a mechanism to show you the native cell renderer as well as the native cell.

When you add an effect, it gets translated to a PlatformEffect in native. It expects properties that relate to the native fields so you can use them in the effect implementations. When you attach an effect to a non-visual element, while the constructor will be executed, OnAttached() and OnDetached() won't because there is no effect control provider for Element.

To cut it short, right now, it is not possible to attach effects to views that are not VisualElements.

This could; however, be considered as an enhancement. I'm not sure how much re-architecting would be required for this.
Comment 4 Michael Rumpler 2016-10-18 07:32:57 UTC
Thanks for the analysis, Adrian. I was already suspecting that the root of the problem is once again, that Cells are only Elements, but no VisualElements or Views.

However, as the Effects collection is a property in Element you can add Effects to Cells. If the API allows to add them but they don't work, then it is a bug and no enhancement. Xamarin also advertised Effects to be used on all controls and never mentioned Cells to be excluded from that.

In https://forums.xamarin.com/discussion/comment/183254/#Comment_183254 Jason Smith wrote on March, 2nd 2016:

> ... we will be adding support for that in a very near term point release that can start the -pre cycle again.
Comment 5 Paul DiPietro [MSFT] 2016-12-20 22:53:54 UTC
This might be a good piece of subject matter for the evolution forum (https://forums.xamarin.com/categories/xamarin-forms-evolution).