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

Reorder ListBox items example

10 Answers 387 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
masha reznik
Top achievements
Rank 1
masha reznik asked on 04 May 2010, 11:27 PM
Hello,
do you have any example for reordering items in listbox with colomns and rows.
My listbox looks like this:
 <ListBox x:Name="lbImageItems"   
                             dragDrop:RadDragAndDropManager.AllowDrop="True"   
                             BorderThickness="0" Background="Transparent" 
                             Style="{StaticResource DraggableListBox}" 
                             ItemContainerStyle="{StaticResource DraggableItemStyle}" 
                             ItemsSource="{Binding Path=DisplayItems}">  
                        <ListBox.ItemsPanel> 
                            <ItemsPanelTemplate> 
                                <primitives:RadUniformGrid Rows="{Binding Path=ItemsRowsCount}" Columns="5" 
                                                           HorizontalAlignment="Left" VerticalAlignment="Top" /> 
                            </ItemsPanelTemplate> 
                        </ListBox.ItemsPanel> 
                    </ListBox> 

I found an example in this form for listbox with only one column, but its not working well with my listbox

thank you

10 Answers, 1 is accepted

Sort by
0
Valentin.Stoychev
Telerik team
answered on 06 May 2010, 02:04 PM
Hello masha reznik,

please check this help article:
http://www.telerik.com/help/wpf/raddraganddrop-within-listbox.html

All the best,
Valentin.Stoychev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
masha reznik
Top achievements
Rank 1
answered on 06 May 2010, 09:54 PM
Hello Valentin,
thank you for your reply,
but this is the same example that i used, and its not working with listBox that have rows and columns like mine.
By now i found a different (not telerik) solution,
Thank you anyway for your time

0
Nitin Joshi
Top achievements
Rank 1
answered on 05 Aug 2010, 06:58 AM
Hi Valentin,

I have to reorder items of a listbox which has a button in the itemtemplate of listbox, i.e. listbox will contain buttons as items.
The link you specified provide me the solution and I implemented it. Although it is working fine but when we have listbox in a Popup control then it doesn't work correctly. When we put listbox in Popup control it doesn't allow to reorder the items and when we put listbox outside the Popup control it allows to reorder the items.

Please provide me a solution, so that I can reorder the items of listbox, when listbox is put in Popup control.

Thanks & Regards
Nitin Joshi
0
Miroslav
Telerik team
answered on 10 Aug 2010, 11:46 AM
Hello Nitin Joshi,

This happens because the DragDropManager only searches visual trees it knows about. Normally Popups open in a separate visual tree and their roots need to be "registered" for the DragDrop to work.

More info here:

http://www.telerik.com/help/wpf/telerik.windows.controls-telerik.windows.controls.dragdrop.dragdropoptions-participatingvisualroots.html

http://www.telerik.com/community/forums/silverlight/drag-and-drop/drag-amp-drop-works-except-inside-a-popup.aspx

http://www.telerik.com/help/wpf/raddraganddrop-child-window-non-telerik-popups.html

Please note that some of the information above refers to "Silverlight" but since the controls have a common API / behavior is just as applicable in this case as well.

Kind regards,
Miroslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Scott Shuppert
Top achievements
Rank 1
answered on 20 Aug 2010, 03:15 PM
Valentin,

The example provided by you (http://www.telerik.com/help/wpf/raddraganddrop-within-listbox.html) breaks ListBox items virtualization. Can you help to me to solve this problem?
0
Tsvyatko
Telerik team
answered on 25 Aug 2010, 11:02 AM
Hello Scott Shuppert,

I have prepared sample application using the posted source code, however I am unable to the the issue described by you. Could please check the attachment and let know if this issue is reproducible in it. If not could you describe the scenario in which  you get the problem described.

Regards,
Tsvyatko
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Scott Shuppert
Top achievements
Rank 1
answered on 25 Aug 2010, 11:46 PM
Hello, Tsvyatko,

I modified your project that would be visible a problem. On the right in a window with ListBox it is possible to see that if to use your example all data of elements is loaded at once at tree loading. If an example not to use, the data for visible elements is loaded only. For us it is critical, as the data at us it is images.

I cannot attach project to the post, so here link to it: http://depositfiles.com/files/6bw4z9pa1
0
Tsvyatko
Telerik team
answered on 27 Aug 2010, 08:34 AM
Hello Scott Shuppert,

We have check the attachment and found that inserting visual elements within the scrollviewer of the listbox affects its virtualizing panel. The solution in this case is to move the visual drop indicator by editing the custom listbox template . Please, check the attachment for reference. Thank you for pointing this out, we will update this in our article.
I have also updated your telerik points as well.

Kind regards,
Tsvyatko
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Scott Shuppert
Top achievements
Rank 1
answered on 27 Aug 2010, 10:18 AM
Thanks! It works.

But I all the same do not like your approach to ListBox drag'n'drop implementation. It is too much actions by hands it is necessary to make. It is better to use more end-to-end solution, as, for example, here: http://code.google.com/p/gong-wpf-dragdrop/. I think that you should implement something similar in RadDragAndDropManager.
0
Tsvyatko
Telerik team
answered on 31 Aug 2010, 10:14 AM
Hi Scott Shuppert,

Thank you for your feedback. We will consider this in our future release in order to improve D&D mechanism.

All the best,
Tsvyatko
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
DragAndDrop
Asked by
masha reznik
Top achievements
Rank 1
Answers by
Valentin.Stoychev
Telerik team
masha reznik
Top achievements
Rank 1
Nitin Joshi
Top achievements
Rank 1
Miroslav
Telerik team
Scott Shuppert
Top achievements
Rank 1
Tsvyatko
Telerik team
Share this question
or