1

I have problems adding a LongListSelector via code in Silverlight. Here is the code:

PivotItem pi = new PivotItem();
pi.Header = r.Recipe_Title;

LongListSelector lls = new LongListSelector();
lls.Background = new SolidColorBrush(Colors.Transparent);
lls.ItemTemplate = App.Current.Resources["CheckboxShoppingItemTemplate"] as DataTemplate;
lls.ListHeaderTemplate = App.Current.Resources["citiesListHeader"] as DataTemplate;
lls.GroupFooterTemplate = App.Current.Resources["citiesListFooter"] as DataTemplate;
lls.GroupHeaderTemplate = App.Current.Resources["groupHeaderTemplate"] as DataTemplate;
lls.GroupItemTemplate = App.Current.Resources["groupItemTemplate"] as DataTemplate;
lls.ItemsSource = r.Ingredients;
pi.Content = lls;

The pivot header appears but the list doesn't. I only see the list's Header but nothing else. The footer is also missing although it is correct (i've replaced the header with the footer to see if it is correct, and it is).

4

1 回答 1

0

http://www.windowsphonegeek.com/articles/wp7-longlistselector-in-depth--part1-visual-structure-and-api

这应该对你有帮助..内容真的很好..

于 2011-11-15T12:36:17.290 回答