Sunday 15 March 2015

c# - Not able to work with my filtered items -


I've defined this property to filter a list of items:

  Private IcicleViewview_view; View Public Icon View {Back {Return _view; } Set {_view = value; ("View") OnPropertyChanged; }}   

and then my filter:

  items. View = Collections Views Association. Get Default View (item. Mistlist); Item.View.Filter = Representative (object o) {if (mecondition) {return true; }}   

The filter works fine but as the ICollectionView is an interface, I can not work with my item: if I call them like this:

  element1 = item. See [0]. Some properties;   

I receive

 with  indexing [] can not be applied to the expression of '[System.ComponentModel.CollectionView]' type < / Code>  

I have tried to set in the beginning see not in the form of interface, but later I could not work on the filter. Trying to do this and insert:

  item.View = (ICollectionView) collection ViewSource.GetDefaultView (item.myList);   

I have not brought good results.

What I can do to filter not only (in my case I display items in the combo box) but also work with them ... My purpose is to keep all the elements in the combo box To be able to create an advanced option loop. Is this possible?

Store a view separately from the list Fill out and change the shorthand given below, with Apoproot InnProperty Property.

  list & lt; SomeType & gt; List; ICollectionView View; See = list as ICollectionView; See.filter = obz = & gt; Obj.someprop == somevalue; List [10] .someprop = somevalue    

No comments:

Post a Comment