Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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
In special cases on GitHub you might also want the comments:
GitHub Markdown with public comments
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.
Can you attach a complete repro project?
Created attachment 17996 [details]
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.
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.
This is what I described as a workaround. This is still a bug.
This still seems a bug. right?