Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Windows Mobile Beginner C#4.0 Win8 , +
This is probably one of the dumbest questions asked here but I'm really stuck so if someone could shed some light I'd be more than thankful.
 
So I've been trying to develop a simple Windows Phone app which would act as a cookbook. I'm new to Windows Phone and C# (and app development for that matter) so data binding has been a bit of a mess since there aren't too many Windows Phone tutorials out there and I have yet to find one which shows how data binding between different pages works.
 
So here's what I'm trying to do:
1. I have a list box withe recipes that I call, well, recipes
            this.recipes.Items.Add(new Recipe("Cake"));
            this.recipes.Items.Add(new Recipe("Bread"));
            this.recipes.Items.Add(new Recipe("Mud Cake"));
            this.recipes.Items.Add(new Recipe("Jam"));
            this.recipes.Items.Add(new Recipe("Pie"));
            this.recipes.Items.Add(new Recipe("Cookies"));
            this.recipes.Items.Add(new Recipe("Panda"));
 
2. I also used the listBox's method to see when an item has been selected. If it get's selected it should navigate to the recipe's page with some basic details
 
private void recipes_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //If nothing is selected
            if (recipes.SelectedIndex == -1) {
                return;
            }
            /*Before navigating I should probably set the RecipeInfo.xaml to show the selected recipe's details - That's the problem */
            
            NavigationService.Navigate(new Uri("/RecipeInfo.xaml", UriKind.Relative));
            //Deselect
            recipes.SelectedIndex = -1;
 
        }
 
3. And here's the problem. I don't know how to bind the data so that the Recipe's name, description and ingredients would show on the RecipeInfo.xaml page.
 
(By the way if I didn't mention already, the Recipe has a name, description and ingredients, all three are strings)
 
One thing that really annoys me is that I know that the solution is probably ridiculously simple, I just don't know what it is. Any help whatosever would be really appriciated.
Posted 25-Jun-13 2:34am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 269
1 OriginalGriff 240
2 CPallini 195
3 Maciej Los 177
4 BillWoodruff 173
0 OriginalGriff 5,655
1 DamithSL 4,506
2 Maciej Los 3,997
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,180


Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 25 Jun 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100