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.

1

There are 1 best solutions below

1
Ryan On

Make sure the objects your are adding to the ItemsSource are of type phone:PanoramaItem.