How to access child stacklayout into c#

In Xaml, I took one parent stacklayout and inside it, I took another child stacklayout. In c#, I can access parent Stacklayout but i am unable to access child stacklayout. how to access child stack layout in c#. Any suggestion please?

Best Answer

  • ShantimohanElchuriShantimohanElchuri US ✭✭✭✭✭
    Accepted Answer

    @Swagatika said:
    In Xaml, I took one parent stacklayout and inside it, I took another child stacklayout. In c#, I can access parent Stacklayout but i am unable to access child stacklayout. how to access child stack layout in c#. Any suggestion please?

    StackLayout.Children is an array. If you have named the parent StackLayout, say x:Name="sl", then sl.Children[2] as StackLayout will get them.

Answers

  • JohnHardmanJohnHardman GBUniversity mod

    @Swagatika - Post your Xaml

  • ShantimohanElchuriShantimohanElchuri USMember ✭✭✭✭✭
    Accepted Answer

    @Swagatika said:
    In Xaml, I took one parent stacklayout and inside it, I took another child stacklayout. In c#, I can access parent Stacklayout but i am unable to access child stacklayout. how to access child stack layout in c#. Any suggestion please?

    StackLayout.Children is an array. If you have named the parent StackLayout, say x:Name="sl", then sl.Children[2] as StackLayout will get them.

Sign In or Register to comment.