Search code examples
xamarin.formsxamarin.android

Access Page Elements by Item Names


In windows forms i access the all elements on page by these codes.(by names)

                            for (int ix = 1; ix < 31; ix++)
                        {
                            string name = string.Format("{0}{1}", "lbl", ix);
                            var nesne = this.Controls[name] as Label;
                            nesne.BackgroundColor = Color.FromHex("54C642");
                        }

How can i do on Xamarin?


Solution

  • use FindByName

    var element = FindByName("myControlName");