O ListView carrega os itens (inclusive para possível edição), mas sem o texto do item:
[
Stack Overflow em Português é um site de perguntas e respostas para programadores profissionais e entusiastas. Leva apenas um minuto para se inscrever.
Inscreva-se para participar desta comunidadeBoa tarde Felipe, segue um exemplo de como fazer uma estrutura de listview,
Classe Modelo
public class EmpresaCliente
{
public int IDEmpresa { get; set; }
public int IDCadastroCliente { get; set; }
public int IDCadastroEmpresa { get; set; }
public int IDStatusEmail { get; set; }
public string Nome { get; set; }
public string Cnpj { get; set; }
public string SituacaoEmpresa { get; set; }
public string StatusEmail { get; set; }
public string Email { get; set; }
}
XAML
<ListView IsVisible="False" HeightRequest="-1" VerticalScrollBarVisibility="Never" ItemsSource="{Binding EmpresaCliente}" SeparatorColor="#010d47" RowHeight="120" x:Name="lvEmpresa" ItemTapped="LvEmpresa_ItemTapped" SelectionMode="None">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout VerticalOptions="CenterAndExpand">
<StackLayout Orientation="Horizontal">
<Label Text="{Binding Nome}" TextColor="#010d47" FontAttributes="Bold"></Label>
</StackLayout>
<StackLayout Orientation="Horizontal" IsVisible="{Binding Cnpj, Converter={Helpers:NullValueBoolConverter}}">
<Label Text="CNPJ da Empresa:" FontAttributes="Bold"></Label>
<Label Text="{Binding Cnpj}"></Label>
</StackLayout>
<StackLayout Orientation="Horizontal">
<Label Text="Situação da Empresa:" FontAttributes="Bold"></Label>
<Label Text="{Binding SituacaoEmpresa}" TextColor="Red" IsVisible="{Binding SituacaoEmpresa, Converter={Helpers:NullValueBoolConverter}}">
<Label.Triggers>
<DataTrigger TargetType="Label" Binding="{Binding SituacaoEmpresa}" Value="ATIVA">
<Setter Property="TextColor" Value="Green"/>
</DataTrigger>
<DataTrigger TargetType="Label" Binding="{Binding SituacaoEmpresa}" Value="INATIVA">
<Setter Property="TextColor" Value="Red"/>
</DataTrigger>
</Label.Triggers>
</Label>
</StackLayout>
<StackLayout Orientation="Horizontal" IsVisible="{Binding StatusEmail, Converter={Helpers:NullValueBoolConverter}}">
<Label Text="Status:" FontAttributes="Bold"></Label>
<Label Text="{Binding StatusEmail}">
<Label.Triggers>
<DataTrigger TargetType="Label" Binding="{Binding StatusEmail}" Value="ENVIADO">
<Setter Property="TextColor" Value="Green"/>
</DataTrigger>
<DataTrigger TargetType="Label" Binding="{Binding StatusEmail}" Value="AGUARDANDO ENVIO">
<Setter Property="TextColor" Value="#facd34"/>
</DataTrigger>
<DataTrigger TargetType="Label" Binding="{Binding StatusEmail}" Value="AGUARDANDO RETORNO">
<Setter Property="TextColor" Value="#facd34"/>
</DataTrigger>
<DataTrigger TargetType="Label" Binding="{Binding StatusEmail}" Value="SOLICITADO PPP POR E-MAIL">
<Setter Property="TextColor" Value="#facd34"/>
</DataTrigger>
<DataTrigger TargetType="Label" Binding="{Binding StatusEmail}" Value="RECEBIDO">
<Setter Property="TextColor" Value="Green"/>
</DataTrigger>
<DataTrigger TargetType="Label" Binding="{Binding StatusEmail}" Value="ENQUADRADO POR FUNÇÃO">
<Setter Property="TextColor" Value="#facd34"/>
</DataTrigger>
<DataTrigger TargetType="Label" Binding="{Binding StatusEmail}" Value="AGUARDANDO LIGAÇÃO">
<Setter Property="TextColor" Value="#facd34"/>
</DataTrigger>
<DataTrigger TargetType="Label" Binding="{Binding StatusEmail}" Value="SOLICITADO POR TELEFONE">
<Setter Property="TextColor" Value="Green"/>
</DataTrigger>
<DataTrigger TargetType="Label" Binding="{Binding StatusEmail}" Value="AGUARDANDO PESQUISA">
<Setter Property="TextColor" Value="DarkRed"/>
</DataTrigger>
</Label.Triggers>
</Label>
</StackLayout>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
C#
public async void Populate()
{
try
{
var lista = await BuscarEmpresasAtreladas();
if (lista.Count >= 1)
{
lvEmpresa.ItemsSource = lista;
lvEmpresa.IsVisible = true;
}
else
{
lvEmpresa.IsVisible = false;
lbEmpty.IsVisible = true;
}
}
catch
{
await DisplayAlert("Ocorreu um erro", "Por favor verifique sua conexão com a internet", "OK");
}
}
No caso de fazer o design direto no C# tem que seguir o mesmo modelo de binding com o nome de cada elemento do Modelo ex: {Binding Nome}, {Bindind Cnpj} e etc.