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

How to remove items from a VirtualizingDataCollection

6 Answers 72 Views
DataBoundListBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
JDBPocketware
Top achievements
Rank 2
JDBPocketware asked on 16 Feb 2012, 09:48 PM
I'm implementing a "remove item" method, which removes an item from the a listbox sourced by a VirtualizingDataCollection. How to remove items?

6 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 20 Feb 2012, 10:42 AM
Hi Jandieg,

Currently VirtualizingDataCollection does not support removing items from it. The idea of this collection is to provide an infrastructure for loading data items in portions depending on the scrolling position of the list box. It is initialized with a given count of numbers and loading page size and thus removing items from it would rather imply resetting the whole collection.

However, could you please share some further details on your scenario so that we can evaluate it and consider upgrading the component to support this feature.

Thanks for your time.

Greetings,
Deyan
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
JDBPocketware
Top achievements
Rank 2
answered on 20 Feb 2012, 02:27 PM

Its a list of items with checkboxes where user can delete items. Similar to the standard email client.

If I reload it can I scroll back to the latest position?

0
JDBPocketware
Top achievements
Rank 2
answered on 20 Feb 2012, 08:56 PM
Or at least hide it...
Maybe setting Visibility.Collapsed for all the checked items, would that work?
0
Deyan
Telerik team
answered on 21 Feb 2012, 05:20 PM
Hello Jandieg,

Setting the Visibility property will not do the job since visual containers are reused and it will be recent on a subsequent realization of the same visual container.

We will consider adding the ability to remove items from the collection though. This may happen for Q1 2012 SP1 at earliest.

Let me know if this plan does not suite you so that we can think of a workaround that might be helpful in your scenario.

Thanks for your time.

Greetings,
Deyan
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
JDBPocketware
Top achievements
Rank 2
answered on 21 Feb 2012, 05:49 PM
Let me check if you got my scenario:

- User select items to remove
- Press Remove button
- Checked items are removed from server (in background)

So I want to hide the items on the offline list, just temporarily because the next time the list is refreshed the removed items wont be there anymore.

By "subsequent realization" you mean any additional items loaded to the list? (I use the LoadItems() method for incremental loading) Will that show again the hidden items?
0
Deyan
Telerik team
answered on 23 Feb 2012, 10:26 AM
Hello Jandieg,

Setting any properties on a visual container would cause undesired behavior since the UI Virtualization mechanism reuses visual containers also for other data items that you might want to not be invisible.

You can read more about how our UI virtualization mechanism works:

http://blogs.telerik.com/deyanginev/posts/11-02-17/raddataboundlistbox-blending-ui-virtualization-smooth-scrolling-together.aspx

If you hide visual containers and are sure that your end-users will not scroll the listbox, you can use this approach. However, since, I guess, this will not be the case, I simply suggest directly resetting the collection to reflect the change. As we are going to provide possibility to remove items from it without resetting it, this will only be a temporal solution for you.

Since I also have noticed that you have opened a new support ticket regarding the same scenario, you can try sending me your project in that support thread so that I can directly take a look at your code and see how I can help.

All the best,
Deyan
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
DataBoundListBox
Asked by
JDBPocketware
Top achievements
Rank 2
Answers by
Deyan
Telerik team
JDBPocketware
Top achievements
Rank 2
Share this question
or