Não aparece a lista no simulador
xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace App2
{
public class Veiculo
{
public string Nome { get; set; }
public decimal Preco { get; set; }
}
public partial class MainPage : ContentPage
{
public List<Veiculo> Veiculos { get; set; }
public MainPage()
{
this.Veiculos = new List<Veiculo>
{
new Veiculo{Nome="Azira V6",Preco= 60000},
new Veiculo{Nome="Fiesta 2.0",Preco= 50000},
new Veiculo{Nome="HB20 S",Preco= 40000}
};
this.BindingContext = this;
}
}
}
xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:App2"
x:Class="App2.MainPage">
<ListView x:Name="listViewVeiculos" ItemsSource="{Binding Veiculos}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<Label Text="{Binding Nome}"></Label>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</ContentPage>