首页 新闻 会员 周边

不能访问pivotItem中的Listbox

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

1.XAML

<controls:Pivot x:Name="myPivot"  ItemsSource="{Binding LiveProgramGuideList}" SelectedIndex="{Binding DayIndex}" DataContext="{Binding}">                 <controls:Pivot.HeaderTemplate>                     <DataTemplate>                         <TextBlock Text="{Binding DayName}"/>                     </DataTemplate>                 </controls:Pivot.HeaderTemplate>           

                <controls:Pivot.ItemTemplate>                     <DataTemplate>                         <controls:PivotItem >                                 <ListBox x:Name="ListEPG" Margin="0,-40,-12,0" Height="580" ItemsSource="{Binding EPGList}" Width="432" SelectedIndex="{Binding TodayListIndex}"  >                                 <ListBox.ItemTemplate>                                     <DataTemplate>                                         <StackPanel x:Name="stackPanel" Margin="0,0,0,5" Width="432" Height="80" Orientation="Horizontal" Background="Black" >

                                         <TextBlock Name="tbTitle" Text="{Binding contentName, Mode=OneTime}" / >

...

                                         </StackPanel>

                                    </DataTemplate>                                 </ListBox.ItemTemplate>                             </ListBox>                         </controls:PivotItem>                     </DataTemplate>                 </controls:Pivot.ItemTemplate>

            </controls:Pivot>

2.数据源为WM中的数据

问题:

1).数据绑定后,不能访问ListBox--ListEPG

2).本例数据集为四个,我想对第2个pivotitem中的Listbox做页面上的处理

后台:

Listbox lb=(myPivot.items[2] as pivotitem ).content as ListBox

结果:myPivot.items[2]是VM中的数据类型,myPivot.items[2] as pivotitem 为空

 

谢谢大侠们!

飞刀刀的主页 飞刀刀 | 初学一级 | 园豆:164
提问于:2011-11-01 13:46
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册