locked
How to make a button change an object on a different page C# RRS feed

  • Question

  • Hi there,

    Basically my app is an app with lessons, and the lessons are seperated into different pages.

    The easiest way for me to describe is this.

    Menu with:

    Lesson 1

    Lesson 2

    Lesson 3

    Each lesson page has a button that goes to the next lesson, so if the user is on lesson 1 the next button will navigate straight to lesson 2 and so on. I want the button to change the properties on the button that navigates to lesson 1.

    I understand how to change the properties of an object in C#, but I don't know how to call the button from a different page.

    basicsBT.background = new SolidColorBrush(Windows.UI.Colors.Green);

    is obviously how i'd change the background colour of the button. But I need the current page to be able to recognise the defined button.

    If anyone can help it would be a big help.

    Thanks in advance.



    • Edited by h0p3less Saturday, August 10, 2013 8:58 PM
    Saturday, August 10, 2013 7:07 PM

Answers

  • The recommended architecture is to separate the data (the "model") from the display (the "view"). Each page can bind to the same global data objects and display the parts that are relevant. Changes they make to the model will then affect all of the pages without the views needing to know anything about each other.

    If you search on "MVVM" (for "Model-View-ViewModel") you will find much more in depth discussion of this sort of architecture.

    --Rob


    Sunday, August 11, 2013 1:12 AM
    Moderator