StackLayout organizes views in a one-dimensional line ("stack"), either horizontally or vertically. Views in a StackLayout can be sized based on the space in the layout, using layout options.
Reading this article, you will learn how to use StackLayout in Xamarin Forms applications for Android and Universal Windows Platform with XAML and Visual C# in cross platform application development.
The following important tools are required for developing UWP,
- Windows 10 (Recommended)
- Visual Studio 2015 Community Edition (It is a free software available online)
- Using Visual studio 2015 Installer, enabling the Xamarin (Cross Platform Mobile development and C#/.NET while installing/modifying Visual Studio 2015.
Step 1
Step 2
Step 3
Step 4
For Updating Xamarin Forms Reference, right click XamFormStackLayout (Portable) -> Select "Manage NuGet Packages".
For updating Xamarin Forms reference, select Xamarin Forms package and click Update.
Xamarin Forms is updated in portable project.
Similarly, update the Xamarin Forms in the XamFormStackLayout.Droid Project.
For updating Xamarin Forms Reference, select Xamarin Forms package and click Update.
Xamarin Forms is updated in Android project.

Select ->CrossPlatform-> FormXamlPage-> Give the relevant name.
Step 7
Step 8
- <StackLayout Spacing="8" x:Name="stlayoutDemo">
- <Button Text="Click Me" VerticalOptions="Start" HorizontalOptions="FillAndExpand" />
- <Label Text="Welcome to Xamarin Forms- StackLayout Demo" VerticalOptions="Center" HorizontalOptions="Center" />
- <BoxView Color="Yellow" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" />
- <BoxView Color="Green" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" />
- <BoxView HeightRequest="75" Color="Blue" VerticalOptions="End" HorizontalOptions="FillAndExpand" />
- </StackLayout>
Check the XamFormStackLayout.Droid, XamFormStackLayout.UWP.
Step 12
Summary
Now, you have successfully created and tested your StackLayout in Xamarin Forms application in cross-platform application using Visual C# and Xamarin.

Join the conversation! Your thoughts help the community grow.