Olá! As linhas do ListView não mostram o texto. Porém, o ItemTapped funciona perfeitamente. Ele chama a página correspondente. O que pode estar errado?
//MainPage.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace Clinica.Views
{
public partial class MainPage : ContentPage
{
public List<string> ItensMenu { get; set; }
public MainPage()
{
InitializeComponent();
this.ItensMenu = new List<String>()
{
"Consultas",
"Programa de fidelidade",
"Eventos",
"Vídeos"
};
this.BindingContext = this;
}
private void ListViewMenuPrincipal_ItemTapped(object sender, ItemTappedEventArgs e)
{
switch (ItensMenu.IndexOf((String)e.Item))
{
case 0:
Navigation.PushAsync(new ConsultaView());
break;
case 1:
Navigation.PushAsync(new CartaoView());
break;
case 2:
Navigation.PushAsync(new EventosView());
break;
case 3:
Navigation.PushAsync(new VideosView());
break;
}
}
}
}
//MainPage.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:Clinica"
Title="Clínica"
x:Class="Clinica.Views.MainPage">
<StackLayout Padding="25" Margin="25">
<ListView
x:Name="ListViewMenuPrincipal"
ItemsSource="{Binding ItensMenu}"
ItemTapped="ListViewMenuPrincipal_ItemTapped">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View">
<StackLayout Orientation="Horizontal">
<Label Text="{Binding ItensMenu}" FontSize="16">
</Label>
</StackLayout>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentPage>