locked
How to change data file (json) in the Grid App template

    Question

  • Hi

    I'm building an application based on the Grid App template in Visual Studio 2013. So far I've got the app to load my data and everything. But now I would like to add a second data (json) file and let the user select which he want to use. Is this possible, and if so how do I do it?

    Thanks, Sigurd F

    Thursday, May 22, 2014 9:56 PM

Answers

  • Hi,

    You can use name or index to distinguish the two brands. Use combobox control to display them. When a user select one of them. You can judge the selected Value. If the vaule equal to the first one, you can load the first file into the data object. If you want to user select the brand in the Main Page, and then load the first file into the data object in another page, you should pass the select value into another page. You can refer to the link below to know how to navigate and pass value between pages:

    http://msdn.microsoft.com/en-us/library/windows/apps/xaml/Hh771188.aspx

    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.

    Wednesday, May 28, 2014 2:48 AM

All replies

  • Hi,

    If you json file in your computer, you can use FileOpenpicker to get the jason file. See

    Accessing files with file pickers

    And see  Reading and writing files  to get jason string.

    If you jason file in remote server use WebRequest to get the file string.

    Then you can use System.Runtime.Serialization.Json.DataContractJsonSerializer to deserialize the jason string. There is a link you can refer to see how to deserialize the jason string in windows store app:

    http://www.codeproject.com/Articles/546430/Parse-JSON-to-Csharp-in-WinRT-Silverlight-WPF-Wind

    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.

    Friday, May 23, 2014 2:06 AM
  • Thanks for the info, but it was not was looking for. I should have put more details in my question. But here goses: In my app I load the json file into an data object, and the data object populate a grouped list and a detail page. On my start page the user can select between 2 different brands. And what I'm looking for is (by code) how to select which of the 2 json files to use depending on what brand the user selected.

    Regards, Sigurd F

    Friday, May 23, 2014 5:34 AM
  • Hi,

    You can use name or index to distinguish the two brands. Use combobox control to display them. When a user select one of them. You can judge the selected Value. If the vaule equal to the first one, you can load the first file into the data object. If you want to user select the brand in the Main Page, and then load the first file into the data object in another page, you should pass the select value into another page. You can refer to the link below to know how to navigate and pass value between pages:

    http://msdn.microsoft.com/en-us/library/windows/apps/xaml/Hh771188.aspx

    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.

    Wednesday, May 28, 2014 2:48 AM