Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8165201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:28:57+00:00 2026-06-06T19:28:57+00:00

I am working on a Windows 8 Metro Newsreader-App (with C# and XAML). I

  • 0

I am working on a Windows 8 Metro Newsreader-App (with C# and XAML). I show the feed-items on a Grouped Items Page (template). A click forwards the user to a detail-page, which I implemented as a Split Page. Therefore, I have an Image-Gallery where the user can navigate from this DetailPage (and back). This works fine. On the ItemDetailPage I have to assign the Data in the LoadState function. The template offers me the following solution:

protected override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
{
    // TODO: Assign a bindable group to this.DefaultViewModel["Group"]
    // TODO: Assign a collection of bindable items to this.DefaultViewModel["Items"]

    if (pageState == null)
    {
        // When this is a new page, select the first item automatically unless logical page
        // navigation is being used (see the logical page navigation #region below.)
        if (!this.UsingLogicalPageNavigation() && this.itemsViewSource.View != null)
        {
            this.itemsViewSource.View.MoveCurrentToFirst();
        }
    }
    else
    {
        // Restore the previously saved state associated with this page
        if (pageState.ContainsKey("SelectedItem") && this.itemsViewSource.View != null)
        {
            // TODO: Invoke this.itemsViewSource.View.MoveCurrentTo() with the selected
            //       item as specified by the value of pageState["SelectedItem"]
        }
    }
}

What I did was the following:

protected override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
{
    if (pageState == null)
    {
        // When this is a new page, select the first item automatically unless logical page
        // navigation is being used (see the logical page navigation #region below.)
        if (!this.UsingLogicalPageNavigation() && this.itemsViewSource.View != null)
        {
            this.itemsViewSource.View.MoveCurrentToFirst();
        }
    }
    else
    {
        // Restore the previously saved state associated with this page
        if (pageState.ContainsKey("SelectedItem") && this.itemsViewSource.View != null)
        {
        this.itemsViewSource.View.MoveCurrentTo(pageState["SelectedItem"]);
        }
    }

    var item = ArticleDataSource.GetItem((int)navigationParameter);

    if (item != null)
    {
        this.DefaultViewModel["Group"] = item.Group;
        this.DefaultViewModel["Items"] = item.Group.Items;
        if (this.itemsViewSource.View != null) this.itemsViewSource.View.MoveCurrentTo(item); // remove?

        // Register this page as a share source.
        this.dataTransferManager = DataTransferManager.GetForCurrentView();
        this.dataTransferManager.DataRequested += new TypedEventHandler<DataTransferManager, DataRequestedEventArgs>(this.OnDataRequested);
    }
}
  1. If I navigate from the OverviewPage to the DetailsPage the selected item (A) is shown.
  2. I select an other item (from the list) and the correct details (B) are shown.
  3. If I navigate from the DetailsPage to the GalleryPage the images of the correct item (B) are shown.
  4. If I now navigate back (to the DetailsPage) not the last selected item (B) but the item I selected (A) to enter DetailsPage is shown.

I am aware of the fact that I changed the order (proposed by the template) and I added if (this.itemsViewSource.View != null) this.itemsViewSource.View.MoveCurrentTo(item); that I’d probably better remove.

I think that the problem (described in step 4) is, that this.itemsViewSource.View is null and therefore (logically) this.itemsViewSource.View.MoveCurrentTo(pageState["SelectedItem"]) doesn’t get executed. Unfortunately, I was unable to find out why or if this is the bug.

Any help or link to a tutorial (which could solve my problem) are really much appreciated! thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T19:28:58+00:00Added an answer on June 6, 2026 at 7:28 pm

    The point is to override the navigationParameter as needed by the previous page state. The item is then loaded and selected. Try using

    // Override the navigationParameter if a page state is set:
    if (pageState != null && pageState.ContainsKey("SelectedItem"))
    {
        navigationParameter = pageState["SelectedItem"];
    }
    
    var item = ArticleDataSource.GetItem((int)navigationParameter);
    
    if (item != null)
    {
        DefaultViewModel["Group"] = item.Group;
        DefaultViewModel["Items"] = item.Group.Items;
    
        if (itemsViewSource.View != null)
        {
            itemsViewSource.View.MoveCurrentTo(item);
        }
        else
        {
            // A serious error happened here..
        }
    }
    else
    {
        // Oooops, an item disappeared..
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on windows 8 metro style app. I want to show a save
I am working on an app in Windows 8 Metro Style app. I need
I am working on a Metro-app for Windows 8 and using MS Visual Studio
I'm working on a Metro app using XAML & C#. I started this using
I'm working with XAML in Windows 8 Metro. I have a grid with multiple
I'm writing a Windows 8 Metro app in C#/XAML. One of the core functions
I'm working on a Windows 8 Metro app and I've found (even on their
I'm working on a C# Metro style app for Windows 8, and I'm having
Has anyone managed to get Ninject working in Metro Style app using the Windows
I am working on a Windows 8 Metro App with HTML and JavaScript but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.