locked
Sync SelectedItem Across Multiple Screens RRS feed

  • Question

  • Is there a good way to keep the SelectedItem in a List sync'ed across multiple screens?

    I need to have multiple screens with the same Selection List. If a select an item in the list in one screen, it should also be selected in the other screens too.


    Thomas H. Lanier

    Saturday, June 22, 2013 2:02 PM

Answers

  • If both Models support INotifyPropertyChange, you can play a little with that event and synchronize both values.

    You can also share a different object (not Query1 or Query2) just for that purpose.

    • Marked as answer by Angie Xu Monday, July 8, 2013 1:40 AM
    Saturday, June 22, 2013 4:29 PM

All replies

  • Hi Tlanier,

    Can they both share the same Model or ViewModel? The Model can have a property for the currently selected item binded (Bidirectional) to the Selection List SelectedItem.

    When one of the lists (or even by code) change the SelectedItem property of the Model, both screens will show the same Selected Item.


    Best regards,

    Fernando Rocha

    Saturday, June 22, 2013 2:08 PM
  • Is there a way to share only some items of a ViewModel across multiple ViewModels?

    Screen1 has Query1 that needs to be shared with Screen2.

    Both Screen1 and Screen2 have other Querys that do not need to be shared.

    The SelectedItem of Query1 would be shared between the two screens.


    Thomas H. Lanier

    Saturday, June 22, 2013 2:16 PM
  • If both Models support INotifyPropertyChange, you can play a little with that event and synchronize both values.

    You can also share a different object (not Query1 or Query2) just for that purpose.

    • Marked as answer by Angie Xu Monday, July 8, 2013 1:40 AM
    Saturday, June 22, 2013 4:29 PM