locked
Grid App Sample RRS feed

  • Question

  • I have a question regards to the navigation within the Sample Grid App. The GroupDetailPage.xaml.cs has the following which is reading the SampleDataItem to look for the UniqueId that is defined within the SampleData.json.  How can I have it to where if a specific "UniqueId is selected it will change to a specific page rather than the ItemDetailPage that is defined.  Example: If I have a UniqueId define as test and one defined as test2 within the SampleData.json.  They then would go to different pages.

    Any help is much appreciated as I am learning how to code window store apps.

    void ItemView_ItemClick(object sender, ItemClickEventArgs e)
            {
                // Navigate to the appropriate destination page, configuring the new page
                // by passing required information as a navigation parameter
                var itemId = ((SampleDataItem)e.ClickedItem).UniqueId;
                this.Frame.Navigate(typeof(ItemDetailPage), itemId);
                
            }

    Saturday, January 25, 2014 9:46 PM

Answers

  • Hi,

    You should make different UniqueId to navigate to different page by yourself,use case value to decide which page should navigate to:

     var itemId = ((SampleDataItem)e.ClickedItem).UniqueId;
                switch(itemId.ToString())
                {
                    case " item1":
                        this.Frame.Navigate(typeof(ItemDetailPage), itemId);
                        break;
                    case " item2":
                       ...
                }
    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Proposed as answer by Dave SmitsMVP Monday, January 27, 2014 7:17 AM
    • Marked as answer by Anne Jing Monday, February 10, 2014 1:42 AM
    Monday, January 27, 2014 6:43 AM
  • never mind, I was able to get it to work :) thanks for your help
    • Marked as answer by Anne Jing Monday, February 10, 2014 1:41 AM
    Saturday, February 1, 2014 3:28 AM

All replies

  • Hi,

    You should make different UniqueId to navigate to different page by yourself,use case value to decide which page should navigate to:

     var itemId = ((SampleDataItem)e.ClickedItem).UniqueId;
                switch(itemId.ToString())
                {
                    case " item1":
                        this.Frame.Navigate(typeof(ItemDetailPage), itemId);
                        break;
                    case " item2":
                       ...
                }
    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Proposed as answer by Dave SmitsMVP Monday, January 27, 2014 7:17 AM
    • Marked as answer by Anne Jing Monday, February 10, 2014 1:42 AM
    Monday, January 27, 2014 6:43 AM
  • This is what I put in the xmal.cs and its still loading the basic ItemDetailPage. Both Item-1 and Item-2 are defined in the SampleData.json

     void ItemView_ItemClick(object sender, ItemClickEventArgs e)
            {
               var itemId = ((SampleDataItem)e.ClickedItem).UniqueId;
                switch(itemId.ToString())
                {
                    case "Group-1-Item-1":
                        this.Frame.Navigate(typeof(ItemDetailPage), itemId);
                        break;
                    case "Group-1-Item-2":
                        this.Frame.Navigate(typeof(TestPage), itemId);
                        break;
                }
                
            }

    Monday, January 27, 2014 2:43 PM
  • Hi,

    which page navigate based on the itemId value. If the value is "Group-1-Item-1", the navigated page is  ItemDetailPage.

    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Tuesday, January 28, 2014 2:17 AM
  • Sorry for late reply, was stuck in snow/ice storm.   For some reason if I choose either Item-1 or Item-2, the ItemDetailPage gets selected.

    Friday, January 31, 2014 9:45 PM
  • never mind, I was able to get it to work :) thanks for your help
    • Marked as answer by Anne Jing Monday, February 10, 2014 1:41 AM
    Saturday, February 1, 2014 3:28 AM