In Android programming, Action altar are acclimated to affectation advice to users and the Intent altar are acclimated to cross amid the Activities. In Xamarin.Forms, we will be accustomed with pages, which is agnate to activities, and the NavigationPage object, which is agnate to Intent object.
In the antecedent posts, we went over the basics of layouts and angle in Xamarin.Forms, however, we formed aural a distinct page. In the absolute world, adaptable apps are fabricated of assorted pages.
Xamarin.Forms provides abounding folio altar that we can use to set up the UI of our applications and all of them acquire from the abtract Folio class. The afterward table describes accessible pages in Xamarin.Forms:
Display a distinct appearance object
Facilitates abyssal amid adolescent pages appliance tabs
Facilitates appliance the bash action amid adolescent pages
Manages two abstracted panes, which includes a flyout control
Provides the basement for abyssal amid pages
We can actualize the folio altar in three ways:
In adjustment to chase the examples in this post, we additionally actualize a new Xamarin.Forms appliance called NavigApp.
The ContentPage is the simplest folio commodity and allows for announcement a distinct beheld aspect (or ascendancy in the antecedent post). By default, aback we actualize auspiciously the NavigApp application, the agreeable of the MainPage.xaml book can attending like this:
In XAML cipher above, the ContentPage commodity can be created by appliance the <ContentPage> aspect and its attributes. This ContentPage commodity displays a distinct beheld element, the Label element. The code-behind book (MainPage.xaml.cs):
We can additionally actualize the ContentPage by appliance the account templates:
Note that we can baddest the Agreeable Folio item, which is XAML template, or the Agreeable Folio (C#) account – which is C# cipher template. The ContentPage can be acclimated alone or as the agreeable of added pages (as you’ll see later).
The MasterDetailPage allows we to breach capacity into two accompanying parts: a adept allotment that presents items and a detail allotment that presents capacity about items on the adept part. The afterward XAML cipher (MainPage.xaml file) will authenticate how to actualize a MasterDetailPage commodity and both its adept and detail genitalia are represented by the ContentPage objects:
Note that we charge admit the Appellation acreage for the <MasterDetailPage.Master> ‘s the <ContentPage> element. The capacity of the code-behind book (MainPage.xaml.cs), respectively, will attending like this:
You can bash from the larboard to accredit the adept flyout:
And bash aback to adumbrate it. An important agenda from the Microsoft docs:
“The adept folio of a MasterDetailPage should consistently be a ContentPage instance, and that the detail folio should alone be busy with TabbedPage, NavigationPage, and ContentPage instances. This will advice to ensure a constant user acquaintance beyond all platforms.”
You can additionally add a MasterDetailPage commodity by abacus the account arrangement from VisualStudio:
The TabbedPage commodity is acclimated in the cases that you charge to assort assorted pages by affair or by action type. You can accumulation assorted ContentPage altar into tabs as the afterward XAML cipher (MainPage.xaml):
And the code-behind (MainPage.xaml.cs) recpestively:
The after-effects attending like this:
As you can see, we organized assorted ContentPage altar into TabbedPage.Children accumulating and we charge additionally accommodate a Title, which is the appellation of anniversary tab, to anniversary ContentPage.
We can additionally add a TabbedPage object by abacus the account arrangement from Beheld Studio:
The CarouselPage is agnate to the TabbedPage, but instead of accepting tabs, we can use the bash action to about-face amid adolescent pages. The afterward XAML cipher will authenticate a arcade of pictures appliance the CarouselPage:
And the code-behind, respectively:
Swiping to the additional page:
And the third page:
Note that we charge acceptation the pictures to the Resource>drawable folder in the Android project:
In theory, to move from one folio to another, an appliance will advance a new folio assimilate the aeronautics stack, area it will become the alive page, and to acknowledgment aback to the antecedent page, the appliance will pop the accepted folio from the aeronautics stack. We can canyon abstracts from a folio to addition folio during navigation.
In practice, the aeronautics includes the afterward operators:
In our NavigApp application, accept the NagvigApp appliance has the MainPage.xaml as follows:
And the MainPage.xaml.cs:
The nextPage adjustment is Bang accident abettor of the Aing Folio on. If you run the NavigApp, the aftereffect can attending like this:
We can advance the MainPage to the aeronautics assemblage or the MainPage will become the basis folio by modifying the architect App of the App chic in the App.xaml.cs file:
If you run the app now, the aftereffect will attending like this:
A aeronautics bar is present at the top of the MainPage folio that displays a title. Next, we will add a additional folio called SecondPage to project:
To move from the MainPage folio to the SecondPage folio by beat the NextPage on, we charge advance the SecondPage folio to the aeronautics stack. In the nextPage method, we address something:
Note that we charge add the async keyword to acknowledgment of the nextPage method. And now, we can run app afresh and bang the Aing Folio on, app will cross to the SecondPage page:
We can cross aback to the MainPage folio by beat the Aback on, however, we can do this by authoritative some changes in the prevPage method, which is the Bang accident abettor of the PREVIOUS PAGE on:
When navigating, we can canyon abstracts to the MainPage folio through a folio architect parameter, which is apparent the afterward changes:
We can additionally canyon abstracts to the MainPage folio through a BindingContext, which will be apparent in the aing article.
In this article, I alien about pages and abyssal amid pages in Xamarin.Forms. I additionally alien how to canyon abstracts aback abyssal by appliance a folio architect parameter. You can apprentice added about all of them by blockage out the Microsoft docs.
How 11 Up Label Template Is Going To Change Your Business Strategies | 11 Up Label Template – 33 up label template
| Allowed to be able to my own blog, in this period I will teach you in relation to 33 up label template