1

無限のlonglistselectorを作成したいのですが、イベントItemRealizedが発生しません。監視可能なコレクションを生成できるようにビューモデルを作成しました。メインクラスを監視すると、すべてが正常に機能しているように見えます。空ではないことは確かですが、問題は、longlistselectorにデータを入力できないことです。

 <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>

私は本当に立ち往生している人です、助けてください

4

1 に答える 1

2

私はそれが拘束力のある問題だと信じているので、これらのことを試してください:

  1. デバッグしてGoogleViewコンストラクターにブレークポイントを設定し、インスタンス化されていることを確認します。
  2. インスタンス化されている場合は、バインドしているデータがクラス内に存在することを確認してください。
  3. すべてがインスタンス化された場合は、TwoWayバインディングモードとしてコレクションにバインドしてみてください。
  4. それが機能しない場合は、別のコントロールのデータにバインドして、正常に機能していることを確認してください。
于 2013-01-22T14:47:16.850 に答える