Reorder ListBox items example

11 posts, 0 answers
  1. masha reznik
    masha  reznik avatar
    17 posts
    Member since:
    Jan 2010

    Posted 04 May 2010 Link to this post

    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
  2. Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 06 May 2010 Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. masha reznik
    masha  reznik avatar
    17 posts
    Member since:
    Jan 2010

    Posted 06 May 2010 Link to this post

    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

  5. Nitin Joshi
    Nitin Joshi avatar
    4 posts
    Member since:
    Jan 2010

    Posted 05 Aug 2010 Link to this post

    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
  6. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 10 Aug 2010 Link to this post

    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
  7. Scott Shuppert
    Scott Shuppert avatar
    9 posts
    Member since:
    Feb 2010

    Posted 20 Aug 2010 Link to this post

    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?
  8. Tsvyatko
    Admin
    Tsvyatko avatar
    833 posts

    Posted 25 Aug 2010 Link to this post

    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
  9. Scott Shuppert
    Scott Shuppert avatar
    9 posts
    Member since:
    Feb 2010

    Posted 25 Aug 2010 Link to this post

    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
  10. Tsvyatko
    Admin
    Tsvyatko avatar
    833 posts

    Posted 27 Aug 2010 Link to this post

    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
  11. Scott Shuppert
    Scott Shuppert avatar
    9 posts
    Member since:
    Feb 2010

    Posted 27 Aug 2010 Link to this post

    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.
  12. Tsvyatko
    Admin
    Tsvyatko avatar
    833 posts

    Posted 31 Aug 2010 Link to this post

    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
Back to Top
UI for WPF is Visual Studio 2017 Ready