Skip to content

Latest commit

 

History

History
59 lines (41 loc) · 2.79 KB

listviewbase_canreorderitems.md

File metadata and controls

59 lines (41 loc) · 2.79 KB
-api-id -api-type
P:Windows.UI.Xaml.Controls.ListViewBase.CanReorderItems
winrt property

Windows.UI.Xaml.Controls.ListViewBase.CanReorderItems

-description

Gets or sets a value that indicates whether items in the view can be reordered through user interaction.

-xaml-syntax

<listViewBase CanReorderItems="bool" />

-property-value

true if items in the view can be reordered through user interaction; otherwise, false. The default is false.

-remarks

To enable users to reorder items using drag-and-drop interaction, you must set both the CanReorderItems and AllowDrop properties to true.

Built in reordering is not supported when items are grouped, or when a VariableSizedWrapGrid is used as the ItemsPanel.

Setting IsSwipeEnabled to false disables some default touch interactions, so it should be set to true when these interactions are needed. For example:

  • If item selection is enabled and you set IsSwipeEnabled to false, a user can deselect items by right-clicking with the mouse, but can't deselect an item with touch by using a swipe gesture.
  • If you set CanDragItems to true and IsSwipeEnabled to false, a user can drag items with the mouse, but not with touch.
  • If you set CanReorderItems to true and IsSwipeEnabled to false, a user can reorder items with the mouse, but not with touch.

Important

In order to receive the DragItemsStarting and DragItemsCompleted events while reordering items, the CanDragItems property must be set to true.

-examples

Here's a GridView that contains 6 rectangles that a user can reorder by drag-and-drop.

<GridView MaxHeight="310" 
          AllowDrop="True" 
          CanReorderItems="True">
    <Rectangle Height="100" Width="100" Fill="Blue"/>
    <Rectangle Height="100" Width="100" Fill="Red"/>
    <Rectangle Height="100" Width="100" Fill="Yellow"/>
    <Rectangle Height="100" Width="100" Fill="Green"/>
    <Rectangle Height="100" Width="100" Fill="Gray"/>
    <Rectangle Height="100" Width="100" Fill="LightBlue"/>
</GridView>

-see-also

AllowDrop, CanDragItems, Drag and drop overview, Drag and drop sample (Windows 10)