Home > Software engineering >  How to get entry name or id when event text changed is called in xamarin?
How to get entry name or id when event text changed is called in xamarin?

Time:03-12

I have some entry with textChanged event configured in my page, now i need to know which entry is calling the event.

I tried to get entry name or id, but it was not possible. How can i do it?

CodePudding user response:

Try ClassId.

<Entry ClassId="1" TextChanged="Entry_TextChanged"/>

Your xaml.cs

private void Entry_TextChanged(object sender, TextChangedEventArgs e)
        {
            var entry = (Entry) sender;
            var classId = entry.ClassId;
        }

CodePudding user response:

The ClassID represents the collection the element belongs to. The StyleId property identifies individual elements in your application for use in UI testing and theme engines.

It can be used both ways. I primarily use StyleID for uniquely identifying an element

  • Related