Choosing between ListView and Grid in Xamarin Forms - xamarin.forms

I have just started developing with Xamarin, and in me getting familiar with the different views/ui controls - given that ListView has an ItemTemplate property, which seems I can use to "embed" any combination of views I want - should I then go with ListView or Grid when I care about displaying different views in a single row ?
I mean, using a ListView with a StackLayout as template, with Stack orientation set to Horizontal... vs a grid ?

Looking at the Xamarin.Forms Control Gallery it states the following:
ListView: https://developer.xamarin.com/guides/xamarin-forms/controls/views/
An ItemView that displays a collection of data as a vertical list.
Grid: https://developer.xamarin.com/guides/xamarin-forms/controls/layouts/
A layout containing views arranged in rows and columns.
Therefore from those two definitions you can derive the following:
If you have a list of Employees I would use a ListView
Where as if I have a login Form where I need to display a username and password box it would be correct to use a Grid. Using a list be more difficult and give less flexability.
Obviously the final decision is up to you

Related

Xamarin Forms How to display 2 listviews in one page?

I want to display two listviews in one page like this
Having a ListView inside a ScrollView is not supported an will leak memory, you can use a single ListView but with different DataTemplate with a DataTemplateSelector and organize your Data.
What I can tell is that in your case you don't need a ListView since there are not a lot of items, maybe using a Grid + ScrollView will get you the job done!
Use Layouts to arrange multiple controls on a page. The simplest approach would be with a StackLayout, but you could also use a Grid or any of the other Layout controls.
StackLayout stack = new StackLayout();
stack.Children.Add(myFirstList);
stack.Children.Add(mySecondList);

Create dynamic table using TableView in xamarin forms

I am new in Xamarin forms and I need to implement a table in Xamarin forms. Requirement is-
Initially table will be empty and has four columns. After feeling form and clicking on submit button, new entry will be added in table. First column is Test, second column is single radio button, third column is again single radio button and forth column is button to delete that row it self.
I need to know which approach will be suitable to implement this requirement. Is it grid layout or tableview or something else.
Consider Table View use cases vs List View use cases. Table views are meant for static content. You should really consider a list view for dynamic content. (like adding a row with views) Being new to Xamarin.Forms, you should take the time to read completely through the documentation as (at least for me) it wasn't straightforward. Also, consider a WebView as radio buttons are not going to play nicely across platforms, and your problem would be easily solvable with jQuery.

How to increase list View's Separator length in Xamarin forms iOS?

I want to increase list View's Separator length(spacing between two cells).
I am not getting how can I do it in xamarin forms by using custom renderer and I am looking for iOS only.
I want to create card view in iOS (by using xamarin forms) just like facebook application.
I Implemented it with frame control.
1.I created one customized cell in List View (Using ViewCell).
Then Added frame in it.
2.Removed Separator in a List View by Using Custom Renderer.
Use HasUnevenRows="True" in your ListView and it should adapt to your item height.

Create a paged GridView

I need to create a paged GridView where each page contains some elements from a list, like launcher applications do to show the installed apps.The GridView only contains the elements that have enough space on the screen to be shown and the remaining apps are added in the GridView of the next Fragment.
I've found many examples that explain how to implement this, for example http://shrikantsonarblogs.blogspot.com/2013/07/gridview-with-viewpager-like-android.html or Display images in grid view of View pager, but in all of these examples the number of rows and columns are fixed values.
Is there a way to make these values "dynamic" by dividing the dimensions of the ViewPager by the dimensions of a child View (supposed they are all the same size, but I have to measure the first one)?
If what I want to achieve is not clear, an example can be the app drawer of the CyanogenMod Trebuchet launcher, with the only difference that I don't need it to display installed apps.

Is it possible for a ListView control to display multiple colums?

Is it possible for the ListView control to display n columns wide, rather than just in a single column list?
By this, I don't mean different properties belong to an item, but items both across and down.
Yes, a ListView, using templates, will render multiple fields easily while retaining its differentiator, support for per item commands. See the MSDN documentation for ListView.ItemTemplate.

Resources