To drag and drop the items by DragIndicatorView, set the SfListView.DragStartMode property to OnDragIndicator
. To display the dragging item, define any custom user interface(UI) in DragIndicatorView
.
Note
: You must set the SfListView instance as reference to the ListView
property in DragIndicatorView.
<ContentPage xmlns:syncfusion="clr-namespace:Syncfusion.ListView.XForms;assembly=Syncfusion.SfListView.XForms">
<syncfusion:SfListView x:Name="listView"
ItemsSource="{Binding ToDoList}"
DragStartMode="OnDragIndicator"
BackgroundColor="#FFE8E8EC"
ItemSize="60">
<syncfusion:SfListView.ItemTemplate>
<DataTemplate>
<Grid Padding="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="60" />
</Grid.ColumnDefinitions>
<Label x:Name="textLabel" Text="{Binding Name}" Grid.Column="1" FontSize="15" TextColor="#333333" />
<syncfusion:DragIndicatorView Grid.Column="2" ListView="{x:Reference listView}"
HorizontalOptions="Center"
VerticalOptions="Center">
<Grid Padding="10, 20, 20, 20">
<Image Source="DragIndicator.png" />
</Grid>
</syncfusion:DragIndicatorView>
</Grid>
</Grid>
</DataTemplate>
</syncfusion:SfListView.ItemTemplate>
</syncfusion:SfListView>
</ContentPage>
To know more about DragAndDrop in ListView, please refer our documentation here