@chilero: It would be pretty easy to do what you want to do. You would have to make a few decisions up front, such as how you'll introduce your data files to the app ... ex. you could put them in a single folder, and use WinRT API to iterate through all files in that folder, open each up, create new items and group using something akin to the RecipeDataSource.cs' approach. Besides that, and designing the JSON to contain your object's properties, the RecipeDataSource.cs provides a nice template that will get you 80% of the way where you need to go. Hope that helps!

Error 1 The type or namespace name 'Common' does not exist in the namespace 'ContosoCookbook' (are you missing an assembly reference?) C:\Users\Matija\Desktop\New folder\Problem1\WinStoreAppDev_CS\CS_24\App1\App1\RecipeDataSource.cs 51 62 App1

@matija4444: Hmm... I think you're missing a using statement. Can you share out: (1) your using statements at the top of that code file, and (2) the exact line of code that it's complaining about? That might help me help you further. DON'T GIVE UP! When you run into stuff like this, you learn a lot!

Error 1 The type or namespace name 'Common' does not exist in the namespace 'ContosoCookbook' (are you missing an assembly reference?) K:\ContossoCookBook\ContossoCookBook\DataModel\RecipeDataSource.cs 51 62 ContossoCookBook

I was getting the same error. If you have named your project other then the actual name of "ContosoCookbook" ( may you using lower case first letter style ) then you need to change it to that exact name.

@danncoba: Did you solve this? Can you explain more ... at what step did you experience this? Can you point to the time marker in the video (example: 4:15) where what YOU see in your code and what I see in my code are different?

Hi bob, i have been following up your tutorials pretty closely and i'm stuck at the data part of app, unlike in the video i want to use a database to connect to the app and display the data in the database using sqlite, as i'm new to the app development or pretty much any kind of development can you point me or suggest me anything about the problem i'm facing

@Mustansir: Sorry, SQLite is outside of my sphere of knowledge. You have the bones of the application, you would just need to replace the implementation specific to grabbing data from the text file with your SQLite code. I would have to do the same as you ... look for a few examples online, etc.

MR Bob Tabor ı am watching your tutorials ı wanted to tell you your tutorials very helpful thx for your help I want ask you question I am Using bing map in ItemDetailPage.xaml in Flipview my map is in templated in flipview ok. question is How ı can send diferent location for each page in ItemdetailPage because ı am using SampleDataSource so I am confuse NavigationParameter how will know it thx for your hellp

@cakmak: You can pass any object of any type as the NavigationParameter. Create a new type with the kind of data you want to pass. If you just need to pass a string, that's cool too ... no need to create a whole type for it. In the click event of the grid, you figure out what it is you want to send to the ItemDetailPage (using the name of the item, or some property of the item, or the class the item is associated with). Check this out:

Hi Bob, besides only reading from the json file i also want to store or update data in the recipe.txt file e.g. updating whether the recipe is user favorite or not and also allowing the user to store their own recipes. how can this all be done with json or should i adopt some other way to do this (which way)?

@aka17: Yikes! That's not good. You must have the file associations incorrect. Have you done anything recently like attempted to open any C# files in Notepad? Or has anyone tried this on the computer you're using? I think it's easily remedied ... I would start here:

@aka17: Hmm... that's a tough one. You might try to re-install Visual Studio to re-create that association for the .cs files. If that doesn't work? I'm not sure what to try next. What you described has never happened to me before.

You might need to contact support or someone on Visual Studio's forums. This is where I would post it. MAKE SURE YOU PUT AS MUCH DETAIL AS POSSIBLE IN YOUR FORUM POST to get the best results.

How to hide all items, but not Group name and group box.. I have too many items and i do want all item to this page. When click group box or title, find groupdetail page and there is all this group items.<br><br>

@Coolrw3: I believe you can limit the number of items you display. The Windows Store (C#) Grid App Template does this by default ... see the SampleDataSource.cs, beginning in line 133 ... here they create a public property that will ONLY reveal 12 items, and spend a lot of code managing which 12 items will be displayed (you may not need all of that complexity). You could limit that to just 6 or 1 if you like.

@Coolrw3: I'm sure there are some examples out there, but I don't know of any. I would have to spend some time on Bing.com and pour over a lot of code to find what I needed. If you're a C# developer, chances are, you already have the skills to do this ... you simply need to decide HOW you'll do it ... how will you store the data? How will you dynamically add the data to the project? How will you retrieve the data and deserialize it into objects in your app. I'll bet you could figure it out if you don't have an example to pull from.

This class has gotten me further then any other I've taken, as most want to show how to bind with hardcoded data and brush over the data file aspect all together, but I too am looking to link up to some kind of SQL DB, don't care if it is SQL compact, SQL express, or sounds like there is now a SQL local.. I have found a piece & part on each, but not the whole enchilada on any.. Which is best (or pros & cons) How to hook up the DB to VS, how to read & update, how to deploy, how to update with changes to DB or without wiping out the users data.. Now with the change to async reading & writing, I fear the mystery will keep mystifying and still no one will tackle it with a training video.

It would be great for a video on that in LearnVisualStudio, once you are done creating videos for channel 9..

@moosetracker: Great feedback. re: data ... I think you haven't seen much about databases and Windows Store apps because Microsoft is hoping you'll use Azure for large data needs. If your needs are small, then serializing an object graph out to JSON may suit most small data needs. I suppose SQL Lite is available or perhaps SQL local (although I'm not sure you can use that for Windows Store apps .. not sure, really), but I've not touched that scenario yet ... just haven't needed to.

Hi Bob,I have found that despite what the lab instructions say, the loading of the recipe data should happen BEFORE the check for applicationstate=terminated. This is because the call to RestoreAsync causes the LoadState method to be called in GroupDetailPage.xaml.cs and ItemDetailPage.xaml.cs and these will throw an exception because they both use RecipeDataSource and expect it to be populated.Even the code provided by Microsoft (say, for lab 4) will throw an exception if you go to a recipe detail, terminate the app, and then restart it.

@BobTabor: Thanks for the reply. It works, but now I am trying to pass parameter to the SampleDataSource to limit the data. I create a MainPage user than login, after logging in depending on the user role it displays different thing. But how do I pass the parameter to the SampleDataSource. After setting the breakpoints I somehow figure out how it pass but not sure how to implement it again in different method ? Thanks.

Hi Bob, Thanks for such a great tutorial series. I'm actually using VS 2013 with Windows App 8.1. I haven't had too much trouble up until this lesson. Do you have any hints as to what we need to do if we're using VS 2013? The template used in VS 2012 and 2013 are quite different. (missing certain classes etc).

@Edin: Hi, admittedly I've not touched Win Store app dev since I finished this series. The series is due for an update, however that's really Microsoft's call. Ideally, they would update the Hands On Labs (which I could be mistaken but I'm not sure they've done that yet.) However, I think the series is still helpful, but you'll have to take away the "big ideas" and be flexible enough to work around the template and API changes.

I followed the steps with your video, and fromthe lab and after this lesson i run the program and only see the Contoso Cookbook No arrow and no tiles. last line of output is "The program '[6436] ContosoCookbook.exe: Managed (v4.0.30319)' has exited with code -1 (0xffffffff).".What does this mean ?

Never mind, I figured it out, had to remove the c# "if *** running" statement and the "return", moved the "Window.Current.Activate();" down in the code after the next catch. Must say Bob, you are one of the best teachers I have ever come across. From my Comodore days (30 years ago) to C#/xaml in less then 3 weeks.

Bob GURU ! awesome job but you did not explain how to use any other database like Microsoft SQL Server / MySQL with WinStore ? if you already have any tutorial for VS2013+8.1+database then kindly share here . thanks a lot!

I have a silly question, I followed this, but am wondering how one would go by creating item templates, that contain forms, for instance, to edit an Item? Do I need to create a separate page, that then just updates the file or makes changes to it? If not how do I load it from Data? Confused...

Remove this comment

Remove this thread

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums, or
Contact Us and let us know.