Search code examples
c#windows-phone-8panorama-control

how to load panorama item when it is opnened


in my wp8 app I create loaded event for all of the panoramma items but when i run app all of the panorama items are loaded immediately but i want them to be loaded when i flick to the panorama item

private void podne_Loaded(object sender, RoutedEventArgs e)
{
    tesbihat2.Content = TextToXaml("podne.txt");
}

private void ikindi_Loaded(object sender, RoutedEventArgs e)
{
    tesbihat3.Content = TextToXaml("ikindi.txt");
}

private void aksam_Loaded(object sender, RoutedEventArgs e)
{
    tesbihat4.Content = TextToXaml("aksam.txt");
}

private void jacija_Loaded(object sender, RoutedEventArgs e)
{
    tesbihat5.Content = TextToXaml("jacija.txt");
}

Solution

  • Try this:

    private void Panorama_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        switch (((Panorama)sender).SelectedIndex)
        {
            case 0: // defines the first PanoramaItem Loaded
                MessageBox.Show("First Item is on ForeGround");
                break;
            case 1: // second one
                MessageBox.Show("Second Item is on ForeGround");
                break;
    
            case 2: // third one
                MessageBox.Show("Third Item is on ForeGround");
                break;
        }
    }