This is a migrated thread and some comments may be shown as answers.

Skip some items from observable collection before binding

1 Answer 99 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ilias
Top achievements
Rank 1
Ilias asked on 09 May 2013, 12:55 PM
Hi

Here is my collection
public ObservableCollection<dynamic> Items{get; set;}

My binding is like:
radGridView.ItemSource = Items.Where(i => i.IsVisible);

So it is binding with Enumerable<dynamic> instead of Items and hence getting disconnected. Then if is add/delete any item in ObservableCollection<dynamic>, no reflection. I do not want to rebind grid as i need to preserve the scrolling.

Please help me to find a solution.

Thanx
Ilias Hossain

1 Answer, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 09 May 2013, 01:16 PM
Hello,

When you do a Where -- this returns a new collection, not the original one.

Bind the grid to the original ObservableCollection<T>. Then add a FilterDescriptor to the grid which says that only visible items should pass the filter.

More about programmatic filtering you can find in our online documentation.

Greetings,
Rossen Hristov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Ilias
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or