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

Newbe question - Controlling listview row height

$
0
0

Hi,

Some advise appreciated. I want to list items that are for sale on a mobile app using Xamarin. The data for each item includes a description, a cost and some brief text. In an ideal world I would like it presented as follows:

Item A
Cost £x

Additional info

Item b
Costs £y

Additional info

You get the idea. Then customers can scroll though to find the entry, tap on it if they are interested etc etc etc

But I can't get it to give me the three lines per row (stack layout only seems to permit one textcell) so my next thought was what happened if I fill the row up, will it overspill into a new line. As most of you know, the answer is no.

So I then thought about using grid and having everything on one line, but I can't get the grid to work at all and to be honest a grid isn't great as the item descriptions can be quite long in the real world and the data would be better presented as above.

Code samples:

   public InstrumentPage()
    {
        InitializeComponent();

        Seeder MyInstruments = new Seeder();

        MyListView.ItemsSource = MyInstruments.GetDefaults();
    }

public class Instruments
{
public string Description { get; set; }
public string Cost { get; set; }
public string Additional_info { get; set; }
}

class Seeder
{
    public List<Instruments> GetDefaults()
    {
        List<Instruments> TempList = new List<Instruments>();

        TempList.Add(new Instruments { Description = "Salvi Diana" , Cost = "£11,000", Additional_info = "None" });
        TempList.Add(new Instruments { Description = "Aoyama Orpheaus", Cost = "£10,000", Additional_info = "None" });
        TempList.Add(new Instruments { Description = "Lyon & Healy Style 23", Cost = "£23,000", Additional_info = "None" });


        return TempList;
    }
}

}

<?xml version="1.0" encoding="utf-8" ?>

<!--Built in Cells-->
<ListView.ItemTemplate>
    <DataTemplate>
        <TextCell Text="{Binding Description}" Height="50" />
        </DataTemplate>
</ListView.ItemTemplate>



Viewing all articles
Browse latest Browse all 77050

Trending Articles



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