Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Is this the correct behaviour for a list view with xam.forms?

$
0
0

Hi,

I'm not sure if I have found a bug with list view in Xam.Forms.

I have a web call that returns a JSON object which I deserialise into the Info class like this

public class Data
{
    public string name {get;set;}
    public string address {get;set;}
    public bool isactive {get;set;}
}

public class Info
{
    public string error {get;set;}
    public string message {get;set;}
    public List<Data> data {get;set;}
}

When the call returns, there data has a count of 1.

My list view is constructed like this

var listView = new ListView()
{
     ItemsSource = Info.data,
     ItemTemplate = new DataTemplate(typeof(ProfileList)),
     SeparatorVisibility = SeparatorVisibility.None
};

This works fine and the binding in the ProfileList works. The listView is held within a StackLayout. If i take it out of the StackLayout, I still get the 8 instead of 1.

The problem is that it appears to generate 8 lines for the list rather than 1. This 8 instead of 1 appears on all supported platforms (which is why I'm not sure if it's a bug in forms or a bug in the code).

If this is not a Forms bug, is there a way to stop it from doing 8 rows when only 1 exists in Info.data?

Paul


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>