2013-01-22 183 views
1

我想创建一个无限longlistselector,但我的事件ItemRealized不会触发。我创建视图模型,所以我可以生成一个可观察的集合,并且当我监视主类时,一切看起来都很好,我确信它不是空的,但是我的问题是我无法填充longlistselectorItemRealized事件不会触发

<phone:PhoneApplicationPage.Resources> 
    <vm:GoogleView x:Key="viewModel"/>   
</phone:PhoneApplicationPage.Resources> 

longlistselector

  <phone:LongListSelector ItemRealized="m_ListBoxGoogle_ItemRealized" Name="m_ListGoogle" HorizontalAlignment="Center" Height="410" Margin="0,120,0,0"        
      ItemsSource="{Binding GoogleCollection}" 
      DataContext="{StaticResource viewModel}">    
      <phone:LongListSelector.ItemTemplate> 
        <DataTemplate> 
         <Button Tag="{Binding GoogleID}" Style="{StaticResource NoVisualTextButton }" toolkit:TiltEffect.IsTiltEnabled="True" Click="OnListBoxItemClick" Margin="-10,0,0,0"> 
          <StackPanel Orientation="Horizontal" Margin="0,3,0,0" Height="auto" Width="450"> 
           <Border BorderThickness="1" Width="62" Height="62" BorderBrush="#00aef0" Background="#00aef0"> 
            <Image Height="60" Width="60" Source="{Binding GoogleImagePath}"/> 
           </Border> 
           <StackPanel Width="350" HorizontalAlignment="Center" Margin="12,0,0,0" > 
            <TextBlock Text="{Binding GoogleDisplayName}" TextWrapping="NoWrap" Style="{StaticResource PanoramaItemTextStyle }" FontSize="24" /> 
            <TextBlock Text="{Binding GoogleObjectType}" TextWrapping="NoWrap" Style="{StaticResource PanoramaItemTextStyle }" FontSize="20" /> 
           </StackPanel> 
          </StackPanel> 
         </Button>   
       </DataTemplate> 
      </phone:LongListSelector.ItemTemplate> 
     </phone:LongListSelector> 

我真的卡住家伙,请帮我

回答

2

尝试这些东西,我相信它有约束力的问题:

  1. 调试并在GoogleView构造函数中放置一个断点,并验证它正在被实例化为 。
  2. 如果正在实例化,请验证绑定的数据是否存在于类中。
  3. 如果一切都实例化,尝试绑定到集合作为双向绑定模式。
  4. 如果这不起作用,尝试绑定到另一个控件中的数据以验证事情是否正常工作。
+0

我很困惑一切都应该工作正常,但仍然一无所获,也许今天不是我的 –

+1

天@radoslaf你可以把在GoogleView构造一个断点,参见图1)如果贝因poperly实例和2)如果数据实际上被放在那里你期望的地方。你能否将其他数据绑定到可以确认数据的数据上? – OmegaMan

+0

所以我的问题是在绑定,谢谢 –