使用拖放包裹面板记录项目

时间:2012-04-23 08:39:18

标签: silverlight windows-phone-7 drag-and-drop wrappanel

我需要在用户触摸时使用拖动更改WrapPanel中的项目位置(或水平方向的堆栈面板)。

我尝试过MouseDragElementBehavior,但它只更改当前项目的位置,而不是其他项目。

我看到了this article,但它使用了垂直方向的listBox。对此有什么办法吗?

1 个答案:

答案 0 :(得分:0)

WrapPanel不是Drag& Drop的完美面板,因为它没有秩序的概念。实际上,项目是根据数据源中的顺序排序的。

使用您的示例,您只需更改ItemsPanel,就像这样:

 <rlb:ReorderListBox

          ...
            <rlb:ReorderListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <toolkit:WrapPanel ItemWidth="100" ItemHeight="50"/>
                </ItemsPanelTemplate>
            </rlb:ReorderListBox.ItemsPanel>
...
相关问题