Welcome to Xamarin Guy Show Blog

Keep updated for latest and Greatest Posts from Xamarin guy

Xamarin Forms ListView EasyWay[Tutorial 5]


Step1:
Hey guys in this tutorial we are going to create ListView which is going to be a bindable one. We are going to create a simple list of given data and try to represent that in the form of list. In later part of the tutorial we will craeate list that will be based on mvvm pattern.
So enough is enough lets start :D. In our Human.cs model class we are going to Make sure that human.cs class has humanid , name and origin .
Our Human.cs class:

Step2:
Now our next objective is to create List view whose contents are going to be bindable one. Visible code is enough to explain what we are going to take from viewmodel class.i.e all the contents that are present in viewmodel will be called.
Our HumanPage.xaml

Step3:
Using this tag”(BindingContext = new ViewModels.HumanViewModels();)” it’s all set we are connecting our views i.e HumanPage with the viewmodel “HumanViewModels.cs” class
Our HumanPage.xaml.cs

Step4:
Now MyData1.cs class will contain all the data that you want in your entire project. So we will be calling it from our view model class.
Our MyData1.cs class will Look like this

Step5:
In this viewmodel we are going to create ObservableCollection where MyData1 class is going to contact with the actual MyData1 class to collect data and store in inside_context.And at last we are going to send all those data using “Humans.Add(human);” command.
Our HumanViewModels.cs

Step6:

At last dont forget make HumanPage as your startup page in App.Xaml.cs
Our App.Xaml.cs

Leave a Reply

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.