Windows Phone 8 Panorama SelectionIndex not changing on swiping through items

Posted by Balraj Singh on Stack Overflow See other posts from Stack Overflow or by Balraj Singh
Published on 2014-05-06T09:47:53Z Indexed on 2014/05/29 9:27 UTC
Read the original article Hit count: 246

I have created Panorama control and binded PanoramaItem from ItemSource. Now when i am changing the selected Panoramaitem by swiping over them the Selected index is always set to -1. I dont know what wrong i am doing while implementation. neither selectionchange event is getting fired. Code:

<phone:Panorama Grid.Row="1"  Visibility="Visible"
       x:Name="PnrVwMainNews"
       ItemsSource="{Binding ParnormaItemsData}"
       ItemContainerStyle="{StaticResource PanoramaContainerItemStyle}">
    <phone:Panorama.ItemTemplate>
        <DataTemplate>
            <!-- Panorma Items Template -->
            <Controls:DynamicContentControl Content="{Binding UsrCntrlDynamic}" />
        </DataTemplate>
    </phone:Panorama.ItemTemplate>
</phone:Panorama> 

PanoramaContainerItemStyle

<Style x:Key="PanoramaContainerItemStyle" TargetType="phone:PanoramaItem">
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="phone:PanoramaItem">
                    <Grid Background="{TemplateBinding Background}" Margin="12,0,0,0">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>

                        <ContentPresenter Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Grid.Row="1" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

© Stack Overflow or respective owner

Related posts about c#

Related posts about xaml