tags:

views:

365

answers:

2

Hi

I would try as much explicit as I can.

I have two UI objects, this is a TabControl and a ListView, both are binded again two different list of the same objects, both have the IsSelected property binded against the Item.IsSelected as the View Model Commands,

this works perfectly, (I can prove it, by selecting in one of the sources, and the other selection it´s updated)

my problem is when removing one item from any of the two lists. The Remove method seems to invoke the IsSelected to FALSE, and the Item is therefore UNSELECTED in the other list that it still appears.

What I´m doing wrong???

any help would be really appreciated.

Thnks in advance

A: 

That may be either a bug or an oversight in the controls. What you can do is write your own Remove method that saves the selection, remove the item, and then put the selection back.

Tommy Hui
+1  A: 

What is happening is that whenever you add/remove an item from the observable collection it is refreshing the list. It does this so that any filters/views/etc. will be refreshed/refiltered. Alas, it does--as you have discovered--not maintain the selected item in any bound controls when it refreshes.

Muad'Dib
yup I knew that´s what happened but I will need to make a 180 degrees turn back, to change what I have. This is an amazing behaviour in WPF, but sometimes it affects you. I also tried to re'bind every control on my own selection property, but I don´t like this at all. So I´m on the wron way I think.
Yeh, if you want to maintain selection, you will have to do some roll-your-own :-( We found all of this out at my company trying to basically do something similar.
Muad'Dib