Introduction
This article demonstrates how to create a ListView Action Application using C# and XAML in Xamarin.Forms.
This article demonstrates how to create a ListView Action Application using C# and XAML in Xamarin.Forms.
Let’s start.
Step 1
Step 1
Open Visual Studio and go to New Project >> installed >> Visual C# >> Cross-Platform.
Select Cross-Platform App, then give your project a name and location.
Select Cross-Platform App, then give your project a name and location.
Step 2
Open Solution Explorer >> Project Name >> Mainpage.xaml. Double click to open the Design View of this page. This page is the Design page or Front-end.
The code is given below.
XAML Code
XAML Code
We are creating the ListView and Datatemplate inside the ItemTemplate.
- <ListView x:Name="MainListView"
- HasUnevenRows="True"
- ItemTapped="MainListView_ItemTapped">
- <ListView.ItemTemplate>
- <DataTemplate>
- <ViewCell>
- <StackLayout Orientation="Vertical">
- <Label Text="{Binding Name}" />
- <Label Text="{Binding Description}" />
- <Label Text="{Binding OrderNumber}" />
- </StackLayout>
- </ViewCell>
- </DataTemplate>
- </ListView.ItemTemplate>
- </ListView>
Step 4
Next, go to the Project Name (Portable) >> Right Click. Select the new folder and a dialogue box will open. Just give the folder a name. The folder name is "Classes".
Step 5
Next, go to project Name (Portable) >> Classes Folder >> Right Click >> Add >> Class.
The dialogue box will open. Add the class and give a name.


Step 6
Open Solution Exploree >> Project Name >> Classes Folder >> ListViewTemplate >> Right Click. Open the Class page.
The code is given below.
C# Code
- public class ListViewTemplate
- {
- public string Name { get; set; }
- public string Description { get; set; }
- public int OrderNumber { get; set; }
- }
Step 7
Open Solution Explorer >> Project Name (Portable) >> Right Click >> New Item.
The dialogue box will open. Now, add the XAML page.

Step 8
Open Solution Explorer >> Project Name (Portable) >> Page1.xaml. Double click to open the backend view of this page.





Anil JainPosted May 20, 2019, 7:43 AM
Very simple to implement and good one for a very beginner.