C# Xamarin XAML ListView不';编译时不显示
我不知道为什么我的列表视图没有显示,我不知道是否需要添加一些内容,以下是我的代码:C# Xamarin XAML ListView不';编译时不显示,c#,xaml,listview,C#,Xaml,Listview,我不知道为什么我的列表视图没有显示,我不知道是否需要添加一些内容,以下是我的代码: <?xml version="1.0" encoding="UTF-8"?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" BackgroundColor="#1B1B1B" x:Class="wantafood.P
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" BackgroundColor="#1B1B1B" x:Class="wantafood.Page1">
<ContentPage.Content>
<ListView x:Name="listView">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout BackgroundColor="#eee"
Orientation="Vertical">
<StackLayout Orientation="Horizontal">
<Label Text="LabelText"
TextColor="#f35e20" />
<Label Text="LabelText2"
HorizontalOptions="EndAndExpand"
TextColor="#503026" />
</StackLayout>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</ContentPage.Content>
</ContentPage>
如果有人能告诉我我错过了什么,我会非常感激,我肯定这是一件愚蠢的事情,但我看不出来,谢谢 你需要设置一个项目资源。哦,我不能只使用静态项目进行测试?当然可以。您可以在xaml(ListView.Items)或代码ListView.Items.Add(object)中执行此操作,谢谢!itemsource就是问题所在!现在,你知道如何将每个项目分开吗?因为它们之间没有分离。这就是ItemTemplate和ItemsPanel的用武之地。读一读。当链接讨论ItemsControl时,ListView的思想与派生控件相同。