Bug 37207 - Custom EntryRenderer affects all Entry controls when applied first
Summary: Custom EntryRenderer affects all Entry controls when applied first
Status: RESOLVED ANSWERED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.0.0
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-12-21 18:21 UTC by John Miller [MSFT]
Modified: 2016-01-05 19:18 UTC (History)
3 users (show)

Tags: AC
Is this bug a regression?: ---
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:
Status:
RESOLVED ANSWERED

Description John Miller [MSFT] 2015-12-21 18:21:31 UTC
**Overview:**

   A custom renderer is used for an Entry. When implemented, all Entry controls are changed, even when they are not the custom class. 

**Steps to Reproduce:**

   1. Use the following code in an Android project for the renderer

[assembly: ExportRenderer(typeof(MyEntry), typeof(CustomEntryRenderer))]
public class CustomEntryRenderer : Xamarin.Forms.Platform.Android.EntryRenderer
{
      protected override void OnElementChanged (Xamarin.Forms.Platform.Android.ElementChangedEventArgs<Xamarin.Forms.Entry> e)
      {
			base.OnElementChanged (e);
			if (this.Control != null) {
				Control.Background.SetColorFilter (Android.Graphics.Color.Pink, PorterDuff.Mode.SrcAtop);
			}
		}
}

   2. Use the following code in the PCL/Forms project

public class MyEntry : Entry {}

MainPage = new ContentPage()
            {
                Content = new StackLayout()
                {
                    Children =
                    {
                        new MyEntry(),
                        new Entry(),
                    }
                }
            };

**Actual Results:**

   Notice that all Entry borders are pink.

**Expected Results:**

   Only 1 of the Entry borders should be pink.

**Build Date & Platform:**

   XF 2.0

**Additional Information**

Change the Children above to be like this:

Children =
{
     new Entry(), // Non custom first
     new MyEntry(),
            
 }

Now only 1 of the controls renderers pink when the custom is moved second.
Comment 1 Paul DiPietro [MSFT] 2016-01-05 19:18:46 UTC
This just has to do with how Android works and isn't a Forms issue as a result.