简体   繁体   中英

Selection Changed event is not getting called for panorama if i am using data template for Panorama control in Windows Phone 8. Why?

Hi I am developing a Windows Phone 8 application but stucked at a point, I am using panorama view to display different views that are dynamically generated. For that I am using a DataTemplate for Panorama. Now I created an event handler as SelectionChanged for panorama but its not getting called. Example

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

In above example, the SelectionChanged event is not getting called whenever i swipe on the screen and panorama item gets changed. If I am just putting the items directly within the Panorama control like...

<phone:Panorama
     <phone:PanoramaItem>
          <Image source="/Assets/abc.png"/>
     <phone:PanoramaItem>

     <phone:PanoramaItem>
          <Image source="/Assets/xyz.png"/>
     <phone:PanoramaItem>
</phone:Panorama>

the SelectionChanged event gets called, when i am swiping on the screen and panorama item gets changed. Please help me to solve this issue.Any help would be highly appreciated.

确保要添加到ItemsSource的对象是phone类型:PanoramaItem。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM