WinRT 8.1 Phone - ListView reordering

I need to create a rewritable ListView in a Windows Phone 8.1 application built using WinRT. XAML is as follows (it binds to an ObservableDictionary in code):

<Grid Margin="24">
        <ListView x:Name="MainListView" CanDragItems="True" CanReorderItems="True" AllowDrop="True" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" >
            <ListView.ItemTemplate>
                <DataTemplate>
                    <Border Padding="24" Margin="16" Background="CadetBlue">
                        <TextBlock Text="{Binding}" />
                    </Border>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
    </Grid>

The ListView does nothing when I try to reorder the items (it looks like the reordering mode is not activated).

When I run this sample on Windows 8.1 (XAML Sharing), it works as expected. According to the documentation , Windows Phone 8.1 should be supported.

Is this feature supported on the phone (and incorrect documentation), or do I need to do something special for the phone?

+4
2

WP ListViewBase.ReorderMode

, - , ; ReorderMode :

<ListView x:Name="fooListView"
          ItemsSource="{Binding barlist, Mode=OneWay}" 
          SelectionMode="None"                
          AllowDrop="True" CanDragItems="True" IsSwipeEnabled="True" />

ListViewBase.Reorder Windows Phone, , XAML , :

#if WINDOWS_PHONE_APP
            MainListView.ReorderMode =  ListViewReorderMode.Enabled;
#endif
+12

, CanReorderItems Windows Phone 8.1.

( , , - , , Windows 8.1.)

+1

Source: https://habr.com/ru/post/1542080/


All Articles