Я создаю корзину, в которой храню все свои заказы. Как отобразить список в ListView?
я пытался сделать эти коды
CustomerOrder.cs
public class CustomerOrder
{
public string menuname { get; set; }
public string price { get; set; }
public string qty { get; set; }
public string mcode { get; set; }
}
public class CustList
{
//i want to display/bind this in Listview
public List<CustomerOrder> CUSTOMER_ORDER { get; set; }
}
OrderCart.xaml
<ListView x:Name="MyCart" ItemSelected="MyCart_ItemSelected" ItemsSource="{Binding CUSTOMER_ORDER}" RowHeight="50">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell >
<Grid>
<StackLayout Orientation="Horizontal">
<Label Text="{Binding menuname}" Font="30" TextColor="Black" FontAttributes="Bold"/>
<Label Text="{Binding qty}" Font="30" TextColor="Black" FontAttributes="Bold"/>
<Label Text="{Binding price}" Font="30" TextColor="Black" FontAttributes="Bold"/>
<Label Text="{Binding mcode}" Font="30" TextColor="Black" FontAttributes="Bold"/>
</StackLayout>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>