嗨,我正在开发一个Windows Phone 8应用程序,但在某一点上,我使用全景视图来显示动态生成的不同视图。为此,我使用了全景数据模板。现在,我为全景创建了一个事件处理程序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事件不会被调用。如果我只是把项目直接放在全景控制中,比如。。。
<phone:Panorama
<phone:PanoramaItem>
<Image source="/Assets/abc.png"/>
<phone:PanoramaItem>
<phone:PanoramaItem>
<Image source="/Assets/xyz.png"/>
<phone:PanoramaItem>
</phone:Panorama>
当我在屏幕上滑动时,SelectionChanged事件被调用,全景项目被更改。请帮我解决这个问题。如有任何帮助,我们将不胜感激。
确保添加到ItemsSource的对象类型为phone:PanoramaItem。