Take the 2-minute tour ×

I am using WPF and MVVM. In my app it would be nice to select from a main screen an item and then press a button to see details. A new window should be opened and (multiple) selections can be made in a listview where the IsSelected is bound to the items in a ObservebleCollection.

When the user pressed that button again (for the same selection on the main screen) another window is opened with the same details. However, I assume that if a different selection is made, the first window is synced and will show the same selections.

I would like to have the two windows possible with different selections. Is this possible and what should be done to make it work?

Update: Example: let's say I would have a car with 4 wheels (Collection). The listviews in both windows show the 4 wheels (one item is one wheel). When I select wheel 1 and 2 in the list view I think in the other window also wheel 1 and 2 will be selected. But I want to select maybe 3 and 4 in window 2 and wheel 1 and 2 in window 1). And I don't want to add another collection of 4 wheels otherwise I would have a car with 8 wheels ... or 2 cars with 4 wheels but if I change wheel 3 and 4, it would change only the second car.

Update 2: Btw, in my app:

  • I have 0 to n windows with a list view.
  • I create a window including a view model.
  • Each view model is referencing the 'real' model.

The binding variable for the selected items are inside the real model, I guess I need to move this to the view model, but I don't know how. Because the properties (of the wheels in the example) are in the 'real' model and those are binded also in the same list view (items). I c

share|improve this question

2 Answers 2

up vote 1 down vote accepted

If there are only two lists, you could bind IsSelected to two separate properties (ie. IsSelectedInList1, IsSelectedInList2).

But really, a viewmodel is supposed to be an in-code view-less representation of your UI. So, if you have two (or N) copies of the list in your UI which are supposed to have different states, it makes sense to create two (or N) copies of that viewmodel in memory to represent it.


I think this is more true when thinking about your model. In your model, you want one instance of a particular car, and that car should have one collection of four wheels. But if you want two different views (with different states), it is OK to create two viewmodels from that model.

share|improve this answer
Two lists are only an example, in fact I can have 0, 1 or more windows with a listview, all using the same underlying model (car in my example). I understand I need two view models, but those view models should refer to the same model (car) ... or should I synchronize all models when something has changed, except for the selected items, wheels in my example)? –  Michel Keijzers Feb 23 '12 at 11:25
So you want the wheels in the lists to stay in sync, except for the selection state? You could make a wrapper viewmodel which has the IsSelected property, plus a reference to the wheel itself. Each time you show a new list, you can build a new collection of these wrappers. In your binding you could say Wrapper.IsSelected and Wrapper.Wheel.SomeProperty. –  Paul Hoenecke Feb 23 '12 at 13:55
sounds it should be possibly, but it would make my model(view) a lot more complex. (if you don't mind, I wait with accepting the answer until I check if it works). –  Michel Keijzers Feb 23 '12 at 14:01
I'm not going to implement this for now, since it is too much work, however, it's good to know the solution ... for now I'm going to prevent opening two windows showing the same part of the model. –  Michel Keijzers Feb 24 '12 at 9:35

The two windows would only be in sync if both both lists are bound to the same collection (i.e. the same reference), or bound to collections that contain the same object instances. Therefore each view model would need its own independant collection.

share|improve this answer
Yes but that's exactly the case. I make an example in my question to make it more clear. –  Michel Keijzers Feb 23 '12 at 0:42
Meaning I have the same collection but with the car example above I hope to make clear it's intuitive to have the same collection. –  Michel Keijzers Feb 23 '12 at 1:00
I upvoted it because it confirmed my guess that the list views selections would be synced, however ... how NOT to sync it but use the same model/object instances? –  Michel Keijzers Feb 23 '12 at 1:41

Your Answer


