locked
Set control's properties between two xaml pages

    Question

  • Hi,

    i an novice in  win 8 apps development.

    I have a simple question:

    How can i set the properties of controls placed in a xaml.page from another xaml page?

    From events of second page  i dont see  the controls of first page

    as in Windows Form.

    Tuesday, March 17, 2015 1:24 PM

Answers

  • You wouldn't generally do this directly. Instead store the data for the controls in a shared data model object which both pages can bind to. Changes made to the data model from one page will automatically be seen by the second page.

    You could expose the controls from each page publically to the others, but this will require more work and will very quickly become difficult to manage and maintain.

    See Data binding with XAML  and the XAML data binding sample .

    A common pattern used for this in Xaml apps is called "Model-View-ViewModel" or "MVVM". If you search on MVVM you should find many discussions and descriptions of using it.

    Tuesday, March 17, 2015 6:08 PM
    Moderator