ListView Item Comming default selected with the first item in the list?

"YOU AND THE ART OF ONLINE DATING" is the only product on the market that will take you step-by-step through the process of online dating, provide you with the resources to help ensure success. Get it now!

For 1): This is due to the IsSynchronizedWithCurrentItem="True". If you want use the IsSynchronizedWithCurrentItem-feature, you propably want to influence the CurrentItem. Use the following code to do so...

Up vote 1 down vote favorite share g+ share fb share tw.

I have a WPF ListView , where I bind an observable collection, and below is the code Here I have two issues 1) Don't know why, I always get an item selected when the load the list, and it is always the 1st item the the collection I bind. 2) The selected item is normally show in blue color by default, but when I click out side the listview,rather than deselecting the item.it shows the seleceted item as grey in color wpf link|improve this question asked Jul 31 '10 at 22:31crazy96510 60% accept rate.

For 1): This is due to the IsSynchronizedWithCurrentItem="True". If you want use the IsSynchronizedWithCurrentItem-feature, you propably want to influence the CurrentItem. Use the following code to do so... var dv = CollectionViewSource.

GetDefaultView(yourObservableCollection); dv. MoveCurrentTo( /* here your desired selection */ ); ... see here for more information. For 2): this is the default behaviour of ListView (and other ListControls).

If the list-control does not have anymore the focus, the selected items are showed in gray. This is done so to visualize which control has the focus (and which control has not). If you want to change the selection-behaviour anyhow, put the following markup into the ListView Change the colors as you wish.

But as I mentioned, the default behaviour is for showing the user which control has been selected and if you change this behaviour, some users may dislike...

HCL the 1st solution really wotked great for me, Thanks for that. Is there any get around for the second one. – crazy9 Aug 1 '10 at 13:42 @crazy9, see my update – HCL 9 Aug at 7:59 oo ya that worked for me for the second question.

Thanks for the code, but for the first question if I remove Issyndronisewithcurrentitem=true, that is not updating the list which are made later.. and many of the functionality which worked before ..stopped working – crazy9 Aug 5 '10 at 3:19 @crazy: I have added a new section that handles the CurrentItem. – HCL 9 Aug at 7:37 Thanks a lot, will try this solution – crazy9 Aug 7 '10 at 20:16.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions