0

I'm setting up different designs for two different custom Entry LoginEntry and a CommonEntry for my application and I want to be able to override the renderer for these two different scenarios for different designs throughout the application.

I have the following code that I tried but it's getting an error for LoginEntry is a type which is not valid for this context.

protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
{    
    base.OnElementChanged(e);

    if (e.OldElement != null) return;

    if (e.NewElement == LoginEntry)
    {
        UpdateEntryStyle();
    }
}

Bug Error

CSDev
  • 3,177
  • 6
  • 19
  • 37
Mochi
  • 1,059
  • 11
  • 26

1 Answers1

2

The == operator, in C#, is used to mostly compare values (for primitive types like int and char) or references (for objects). It cannot be used to compare an object to a Type, as you're trying to do in your example.

When trying to compare types you should do a Type Check, which methods are explained here.

Mateus Wolkmer
  • 706
  • 4
  • 26