0
votes

I'm using a panorama control in my wp8 app that consists of 4 panorama-items. These items are all i separate files. The content within the items are bound to viewmodels, (using MVVM Cross).

The problem is when I navigate from a panorama-item to a new page and go back, the panorama control shows the first panorama-item (it kinda resets).

I've tried to override OnNavigatedTousing the selectedIndexon the panorama control, but it only returns -1.

The xaml class containing the panorama-control:

<Grid x:Name="LayoutRoot" Background="Transparent">
    <!--Panorama Control-->
    <!--Cannot bind directly to background with ImageBrush, using converter instead-->
    <controls:Panorama  x:Name="panorama"
                       Background="{Binding Home.WindowsBackgroundUrl, Converter={StaticResource ImageBrushConverter}}">

        <controls:Panorama.Title>
           <StackPanel Orientation="Vertical" Margin="0,60,0,0">
                <Image x:Name="Icon" Source="/Images/PanoramaLogo.png" />
            </StackPanel>
        </controls:Panorama.Title>

        <!--Panorama items-->
        <ScrollViewer>
            <local:InterestView x:Name="Interest" Margin="0,-20,0,0" />
        </ScrollViewer>

        <ScrollViewer>
            <local:CustomerCategoryPanoramaItem x:Name="Customer" Margin="0,-20,0,0"/>
        </ScrollViewer>

        <ScrollViewer>
            <local:MapListView x:Name="MapList" Margin="0,-20,0,0"/>
        </ScrollViewer>

        <ScrollViewer>
            <local:ContactMeView Margin="0,-20,0,0"/>
        </ScrollViewer>
    </controls:Panorama>
</Grid>

Thanks for any help

1

1 Answers

0
votes

If you are persisting your screen in view stack than it panorama-control will take care of that other-vice we have to persist selected panorama while we are navigating forward and when we come back to Panorama control. For that we has to set its DefaultItem property . Panorama numbers its view starting from 0, Like for if we have three panorama Items than it will give 0 to first, 1 to second and 2 to third.

Example :

PanoramaControl.DefaultItem = PanoramaControl.Items[0 to 2];