StackLayout can also be used to define StackOrientation properties and distances. StackOrientation is used to orient it, the values that can be placed in it are general and horizontal, the default value is vertical. Distance is also used to determine the distances between child views.
In this tutorial you will learn that:
- How to create a StackLayout in Xamarin.Forms using XAML files?
- How to set the direction for the created StackLayout?
- How to control alignments and expansions for child views in StackLayout?
The requirements for doing this training and building and controlling StackLayouts are as follows:
- Install the latest version of Visual Studio 2019 on the system
- Install the latest version of Mobile development with.NET on the system
Learn how to create a StackLayout in Xamarin.Forms using Visual Studio
1- Open Visual Studio.After opening Visual Studio, you need to create a new black Xamarin.Forms app.
2- Choose a name for which you create.
3- The name chosen in this article is StackLayoutTutorial.
Note:
It is best to be careful in choosing names for projects and classes created.
Note:
The name chosen for the project must be the same as the name chosen for the solution, so choose the solution name StackLayoutTutorial as well.- After naming, you must make sure that the system and application support the .NET Standard mechanism for shared code.This mechanism is used to share code written in Xamarin.Forms with the C # programming language. If your system and app do not support this mechanism, it cannot have multiple outputs on multiple platforms at once. So that you can have multiple outputs on several different platforms at the same time.- Click on MainPage.xaml in the Solution Explorer section of the StackLayoutTutorial project and replace the code below with all the code in that section.
<! -? xml version = "1.0" encoding = "utf-8"? ->
<contentpage xmlns = "http://xamarin.com/schemas/2014/forms" xmlns: x = "http://schemas.microsoft.com/winfx/2009/xaml" x: class = "StackLayoutTutorial.MainPage">
<stacklayout margin = "20,35,20,25">
<label text = "The StackLayout has its Margin property set, to control the rendering position of the StackLayout.">
<label text = "The Padding property can be set to specify the distance between the StackLayout and its children.">
<label text = "The Spacing property can be set to specify the distance between views in the StackLayout.">
</label></label></label> </stacklayout>
</contentpage>
By entering this code, you specify a UI for the page. This UI consists of three labels in one StackLayout , the UIThe page you specify has a StackLayout and this StackLayout also has three Labels. These labels are for StackLayout as child view. This means that the labels inside the StackLayouts are the same as the child views.Inserting this code causes StackLayout to place existing labels in one line and in the vertical line by default.
Read more on:https://www.dotnek.com/Blog/Apps/how-to-create-a-stacklayout-in-xamarin
link:https://dotnek.mystrikingly.com/
Related link:Search engine Optimization (SEO services)
:: برچسبها:
dotnek ,
seo ,
site ,
:: بازدید از این مطلب : 60
|
امتیاز مطلب : 0
|
تعداد امتیازدهندگان : 0
|
مجموع امتیاز : 0