首页 新闻 会员 周边 捐助

windwos phone 8 LongListSelector

0
悬赏园豆:10 [待解决问题]

 为什么LongListSelector不显示,绑定的数据也不显示,请高手请教?

xaml代码:

 <phone:PhoneApplicationPage.Resources>    

    <DataTemplate x:Name="itemTemplate">      

    <StackPanel>              

 <TextBlock Text="{Binding Height}"/>

<TextBlockText="{Binding Weight}" />           

 <TextBlock Text="{Binding Sex}" />      

   </StackPanel>          

         

</DataTemplate>      

   <DataTemplate x:Name="headTemplate">   

   <StackPanel>               

            <TextBlock  Text="{Binding Name}" />       

    </StackPanel>    

     </DataTemplate>  

   </phone:PhoneApplicationPage.Resources>

 
<Grid x:Name="ContentPanel">
            <phone:LongListSelector 
                Visibility="Visible"  
                Name="myLongListSelector"
                ItemTemplate="{StaticResource itemTemplate}"
                GroupHeaderTemplate="{StaticResource headTemplate}"
                LayoutMode="List"
                 IsGroupingEnabled="True"
                HideEmptyGroups="True"
                /> 

 cs代码:

public class person
        {
            public string Name { get; set; }
            public string Height { get; set; }
            public string Weight { get; set; }
            public string Sex { get; set; }
        }
        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            List<person> list = new List<person>();
            list.Add(new person() {Name="sdf",Height="23",Weight="34",Sex="nan" });
            list.Add(new person() { Name = "aa", Height = "11", Weight = "22", Sex = "nan" });
            list.Add(new person() { Name = "ss", Height = "22", Weight = "43", Sex = "nv" });
            list.Add(new person() { Name = "dd", Height = "44", Weight = "56", Sex = "nan" });
            list.Add(new person() { Name = "ff", Height = "55", Weight = "65", Sex = "nv" });
            list.Add(new person() { Name = "dd", Height = "66", Weight = "87", Sex = "nan" });
            myLongListSelector.ItemsSource = list;
        }

菜鸟_001的主页 菜鸟_001 | 初学一级 | 园豆:70
提问于:2013-09-25 17:30
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册