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

RadTileViewItem collection order after dragging

2 Answers 77 Views
TileView
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Patrick asked on 16 May 2016, 04:25 PM

Hello,

What is the best way to get the full collection of bound items in the current order as they appear as RadTileViewItems? The ObservableCollection order does not update after dragging. Perhaps we are missing something obvious.

Some notes on our use of RadTileView:

  -We use a RadFluidContentControl in a datatemplate as the RadTileView's 'ContentTemplate'

  -RadTileView.ItemsSource is set to an ObservableCollection, adds and removes work great.

  -Virtualization is on, sometimes we have hundreds of items.

We've almost got what we needed using RadTileView.ItemContainerGenerator.ContainerFromIndex(i) in a for loop and examining the Position property of the RadTileViewItem, but this only provides a small subset of the collection because of the virtualization.

Please advise, thank you,

Patrick

2 Answers, 1 is accepted

Sort by
0
Accepted
Martin Ivanov
Telerik team
answered on 19 May 2016, 10:39 AM
Hi Patrick,

RadTileView doesn't reorder its children collection when the positions of the RadTileViewItems are changed at runtime. Instead, each item has a Position property which stores the item's current position in the panel. In order to achieve your requirement you can define a Position property in your view model and bind it to the Position of RadTileViewItem with in a TwoWay mode. This way you will have access to the position of an item even if its not in the view port and its container is not generated. You can find this approach demonstrated in the attached project. Please give it a try and let me know if it works for you.

Regards,
Martin
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Patrick
Top achievements
Rank 1
answered on 31 May 2016, 06:45 PM

Martin,

Thank you for the succinct example, it works perfectly.

Patrick

Tags
TileView
Asked by
Patrick
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Patrick
Top achievements
Rank 1
Share this question
or