Blog Posts for: Uwp

Preventing a UWP ListView item to be reordered

10 April 2017

The UWP ListView allows you to easily reorder items inside a ListView by setting the CanReorderItems and AllowDrop properties to True. Let’s for example take a very simple Page with a list view containing 6 buttons. Note that the CanReorderItems and AllowDrop properties are set to True: <Page x:Class="WorkflowDesigner.MainPage" xmlns="" xmlns:x="" xmlns:local="using:WorkflowDesigner" xmlns:d="" xmlns:mc="" mc:Ignorable="d"> <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <ListView x:Name="ListView1" AllowDrop="True" CanReorderItems="True"> <Button>Button 1</Button> <Button>Button 2</Button> <Button>Button 3</Button> <Button>Button 4</Button> <Button>Button 5</Button> <Button>Button 6</Button> </ListView> </Grid> </Page> When you run the application, you are able to drag any of the items in the list view to a new position inside the list view: