Bug 45874 - Effect not attaching to ScrollView
Summary: Effect not attaching to ScrollView
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.2
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL: https://github.com/kristofberge/Scrol...
Depends on:
Reported: 2016-10-25 12:00 UTC by Kristof Bergé
Modified: 2017-07-05 10:22 UTC (History)
7 users (show)

Tags: ScrollView, Effects
Is this bug a regression?: Yes
Last known good build:

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 on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Kristof Bergé 2016-10-25 12:00:10 UTC
I'm trying to create an Effect and attach it to a ScrollView, but the effect is never attached. The effect is correctly instantiated and resolved to the appropriate PlatformEffect, but it is never attached to the ScrollView (OnAttached is never called). When I try to attach the same Effect in the same way to a different view (in this case a Label), the Effect is attached correctly.

NOTE: In the example I attach the effects in xaml, but the effect is the same when I try it in code-behind.

Creating the RoutingEffect:

public class TestEffect : RoutingEffect
    public TestEffect() : base("ScrollViewTest.TestEffect")
Creating the PlatformEffect (similar on iOS and Android):

[assembly: ResolutionGroupName("ScrollViewTest")]
[assembly: ExportEffect(typeof(TestEffectiOS), "TestEffect")]
namespace ScrollViewTest.iOS
public class TestEffectiOS : PlatformEffect

    protected override void OnAttached()
        Debug.WriteLine($"Effect attached to {Element.GetType().ToString()}");

    protected override void OnDetached()
        Debug.WriteLine($"Effect detached from {Element.GetType().ToString()}");

Attaching the effects in xaml:

        Text="Welcome to Xamarin Forms!"
            <local:TestEffect />
        <local:TestEffect />

Here's a test app that reproduces this on iOS and Android: https://github.com/kristofberge/ScrollViewTest
Comment 1 adrianknight89 2016-12-13 03:53:56 UTC
See https://github.com/xamarin/Xamarin.Forms/pull/641
Comment 2 Rui Marinho 2017-01-09 10:58:52 UTC
Should be fixed in 2.3.4-pre2
Comment 3 Parmendra Kumar 2017-02-06 16:33:08 UTC
I have checked this issue with Xamarin.Forms and observed that this issue has been resolved with iOS and I am still getting issue with Android.

Screencast: https://www.screencast.com/t/ocyUWQtH

Application output:
Android: https://gist.github.com/Parmendrak/cf7d0094957420bf58d6b0e04c128181
iOS: https://gist.github.com/Parmendrak/ad403243bf2cf35be6c97440aad9eef4

Hence reopened this issue with respect to Android.

Comment 4 Samantha Houts [MSFT] 2017-03-22 21:02:48 UTC
Comment 5 Samantha Houts [MSFT] 2017-03-29 18:39:41 UTC
Should be fixed in 2.3.5-pre1. Thank you!
Comment 6 Saurabh Paunikar 2017-07-05 10:22:12 UTC
Verified on xamarin.form version

ScreenCast link: https://www.screencast.com/t/svkVafCX3Tv