I am using a CollectionViewSource in a dialog view model that has various filtering requirements, which works fine. I also maintain the equivalent of the selected item in a property (SelectedProject), and I'm wondering if I could / should do away with it since the View will know the current item. My data binding looks like:
<ListView
ItemsSource="{Binding Projects.View}"
IsSynchronizedWithCurrentItem="True"
SelectedItem="{Binding SelectedProject, Mode=TwoWay}">
I use the setter for the SelectedProject to facilitate unit testing, and the CurrentItem doesn't appear to be settable as far as I can see. I also need to cast it to the right object when I want to use it. OTOH, if the SelectedProject is redundant then I'd show it the same respect as any other redundancy and delete it.
So, how do you typically deal with the current item when you're using a CollectionViewSource?