Bug 45054 - Xamarin.Forms.VisualElement.IsEnabled property is not correctly propagated to the Android.Views.View.Enabled property
Summary: Xamarin.Forms.VisualElement.IsEnabled property is not correctly propagated to...
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.3.2
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-10-05 13:00 UTC by Evgeniy Zverev
Modified: 2017-11-23 11:36 UTC (History)
8 users (show)

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

repro solution (793.93 KB, application/x-zip-compressed)
2016-10-12 12:47 UTC, Evgeniy Zverev

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 45054 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:

Description Evgeniy Zverev 2016-10-05 13:00:16 UTC
I have a custom renderer for Android for one of my Xamarin.Forms visual elements:


public class UCControl : ContentView


[assembly: ExportRenderer(typeof(UCControl), typeof(CRenderer))]

public class CRenderer : VisualElementRenderer<VisualElement>
    protected override void OnElementChanged(ElementChangedEventArgs<VisualElement> iArgs)

        if (iArgs.NewElement != null)
            this.Touch += CRenderer_Touch;

    private void CRenderer_Touch(object sender, TouchEventArgs e)
        System.Diagnostics.Debug.WriteLine("CRenderer_Touch " + DateTime.UtcNow.ToLongTimeString());

The problem occurs when my UCControl needs to appear Disabled (IsEnabled = false) on page creation (it gets enabled after some user interaction).

So if I instantiate the UCControl as follows:

UCControl control = new UCControl();
control.IsEnabled = false;

than its renderer never receives the Touch event (CRenderer_Touch event handler never launches).

My investigations show that the Android.Views.View.Enabled property value is False for this case and does not change when I alter the UCControl.IsEnabled property value. 

As a workaround I can override the OnElementPropertyChanged method in my renderer but anyway this seems to be a bug that initial IsEnabled value is respected but all the following changes to this property are ignored by Android renderer.
Comment 1 adrianknight89 2016-10-11 20:35:17 UTC
Can you attach a complete repro project?
Comment 2 Evgeniy Zverev 2016-10-12 12:47:50 UTC
Created attachment 17996 [details]
repro solution

repro description:

There are 3 active elements in the repro app:

1. Button for altering the IsEnabled property.
2. "Bad" control which has IsEnabled property value "false" by default.
3. "Good" control which has IsEnabled property value "true" by default.

When the altering Button is clicked the "IsEnabled" property value is altered for both Good and Bad controls.

Both Good and Bad controls are of the same type (UCControl : ContentView) and there is a custom renderer provided to that type (CRenderer : VisualElementRenderer<VisualElement>).

The renderer tries to catch the "this.Touch" event.

Notice that no matter what the value of xamarin IsEnabled property value is the Good control always catches the clicks and Bad one never does.

Uncomment the workaround in the renderer and click catching becomes reasonable.
Comment 3 Paul DiPietro [MSFT] 2016-10-21 15:10:26 UTC
If you really need to handle what you're doing in this manner, you can check against the VisualElement.IsEnabledProperty.PropertyName in the renderer derived from VisualElementRenderer<VisualElement> (similar to what your sample does), then set Enabled = Element.IsEnabled.
Comment 4 Evgeniy Zverev 2016-10-21 16:46:07 UTC
This is what I described as a workaround. This is still a bug.
Comment 6 Bright Lee 2017-07-07 14:42:59 UTC
This still seems a bug. right?