【发布时间】:2017-02-20 07:06:36
【问题描述】:
我为我的ListView 创建了DataTemplate,但ListViewItems 的文本没有显示。如何绑定来自ItemsSource的文本?
List<string> stringList;
ListView myListView = new ListView
{
ItemsSource = stringList,
ItemTemplate = new DataTemplate(() =>
{
StackLayout sl = new StackLayout
{
VerticalOptions = LayoutOptions.FillAndExpand,
Orientation = StackOrientation.Horizontal,
};
sl.Children.Add(new Label
{
FontSize = 14,
});
return new ViewCell { View = sl };
})
【问题讨论】: