Home > Software engineering >  How to get all children of a parent control in Xamarin?
How to get all children of a parent control in Xamarin?

Time:11-11

I'm looking for an code example how to get all children of parent control in Xamarin.Forms.

CodePudding user response:

Yes, you can try to use the Children property of your control.

For example,there is a grid, we can access its Children like this:

        var children = grid.Children;

        foreach(View child in children){
            if (child is Entry) {
                string value = ((Entry)child).Text;

                System.Diagnostics.Debug.WriteLine("one value is = "    value);                
            }
        }
  • Related