adding an element to a VerticalStackLayout in c# doesnt work as expected
hi!
so i wanted to add a visual element (in my case a ContentView) to a VerticalStackLayout that i declared in the xaml file and exposed it via
x:Name="Stack"
i tried doing Stack.Add(MyView)
in the cs file, it did add it, i checked the "count" variable in the stack and it did increment but it is not visible. when i resize the window the elements pops into existence. obviously i'd love it if it did render without needing to resize 😅1 Reply
You'd probably need to share the entire XAML. And maybe a reproducible source code.
I suspect the height of the parent of your stacklayout is 0. Also, .NET 7 or .NET 8. .NET 8 fixed lots of MAUI issues.