I have a usercontrol
, with one list box and one list view control in it. For Listview i have bound the observablecollection
of type TrafficManager
class as shown below:
private static ObservableCollection<TrafficManager> _trafficCollection;
public ObservableCollection<TrafficManager> TrafficCollection
{
get { return _trafficCollection; }
set
{
_trafficCollection = value;
OnPropertyChanged("TrafficCollection");
}
}
I have bound this to itemsource of list view.
Now my requirement is on selection of the listbox item, i need to filter some items of the listview. For that i used a linq to get the desired rows from list view and added that to the list view collection. Before adding i did a listview Collection TrafficCollection.Clear()
and then added to that collection.But now the issue is on selection of another item in list box i need the original listview contents again to carry out the filtering using the linq again. Here once the TrafficCollection.Clear()
executes the original observable collection data vanishes. How do i maintain a backup of original observable collection data "TrafficCollection"
of listview. Remember i have only one view. Is there anyway to do this? Please let me know.