這個頭是我的IIs:如何顯示LongListSelector
<phone:LongListSelector Name="lls" ItemsSource="{Binding Items}">
<phone:LongListSelector.ListHeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Title}" Foreground="Red" Margin="0,0,0,10"/>
</DataTemplate>
</phone:LongListSelector.ListHeaderTemplate>
<phone:LongListSelector.ListFooterTemplate>
<DataTemplate>
<TextBlock Text="this is a footer"/>
</DataTemplate>
</phone:LongListSelector.ListFooterTemplate>
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
...
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>
和視圖模型:在navigatedto
public class BookViewModel : INotifyPropertyChanged
{
private string title;
public string Title
{
get
{
return title;
}
set
{
if (value != title)
{
title = value;
NotifyPropertyChanged("Title");
}
}
}
public ObservableCollection<AuthorViewModel> Items { get; set; }
}
我獲取和分配頁面的DataContext:
DataContext = book;
但問題是,在LongListSelector中沒有任何內容顯示爲標題。恰好在分配DataContext後,我檢查了標題並且沒有顯示任何內容(項目工作正常,項目列表出現)
爲什麼標頭爲空?謝謝。
謝謝。我知道如何使用它,問題是如何解決這個未知的問題。 – user3293835
我想要一個列表頭:) – user3293835