您好我正在开发一个Windows Phone 8应用程序,但一直坚持,我使用全景视图来显示动态生成的不同视图。为此,我使用DataTemplate for Panorama。现在我为全景创建了一个事件处理程序作为SelectionChanged,但它没有被调用。实施例
<phone:PhoneApplicationPage.Resources>
<DataTemplate x:Key="DataTemplate1">
<Image Height="250" Width="500" Source="{Binding images}" Stretch="Fill"/>
</DataTemplate>
</phone:PhoneApplicationPage.Resources>
<Grid x:Name="LayoutRoot" Background="Transparent">
<phone:Panorama x:Name="PanoramaImages" Width="520" SelectionChanged="Panorama_SelectionChanged_1" ItemTemplate="{StaticResource DataTemplate1}" >
</phone:Panorama>
</Grid>
在上面的示例中,每当我在屏幕上滑动并且全景项目发生更改时,都不会调用SelectionChanged事件。 如果我只是将项目直接放在Panorama控件中,如...
<phone:Panorama
<phone:PanoramaItem>
<Image source="/Assets/abc.png"/>
<phone:PanoramaItem>
<phone:PanoramaItem>
<Image source="/Assets/xyz.png"/>
<phone:PanoramaItem>
</phone:Panorama>
当我在屏幕上滑动并且全景项目被更改时,调用SelectionChanged事件。请帮我解决这个问题。非常感谢任何帮助。
答案 0 :(得分:0)
确保您添加到ItemsSource的对象属于phone:PanoramaItem。