项目已实现事件不会触发
本文关键字:事件 实现 项目 | 更新日期: 2023-09-27 17:55:17
我想创建一个无限的长列表选择器,但我的事件ItemRealized
没有触发。 我创建了视图模型,因此我可以生成一个可观察的集合,并且在监视主类时一切正常,我确定它不为空,但我的问题是我无法填充 longlist选择器
<phone:PhoneApplicationPage.Resources>
<vm:GoogleView x:Key="viewModel"/>
</phone:PhoneApplicationPage.Resources>
长名单选择器
<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>
我真的被困住了,请帮助我
尝试这些事情,因为我相信这是一个具有约束力的问题:
- 调试并在 GoogleView 构造函数中放置断点并验证它正在实例化。
- 如果正在实例化,请验证要绑定到的数据是否存在于类中。
- 如果所有内容都已实例化,请尝试以双向绑定模式绑定到集合。
- 如果这不起作用,请尝试绑定到另一个控件中的数据以验证一切是否正常工作。