<ContentPage>
<Grid>
<syncfusion:SfListView x:Name="ToDoListView"
ItemsSource="{Binding ToDoList}"
DragStartMode="OnHold,OnDragIndicator">
</syncfusion:SfListView>
<syncfusion:SfListView x:Name="WorkDoneListView"
ItemsSource="{Binding NewList}"
DragStartMode="OnHold,OnDragIndicator">
</syncfusion:SfListView>
</Grid>
</ContentPage> |
private async void WorkDoneListView_ItemDragging(object sender, ItemDraggingEventArgs e)
{
var position = new Point();
var xPosition = e.Position.X;
double yPosition = e.Position.Y;
position.X = xPosition;
position.Y = yPosition;
if (e.Action == DragAction.Dragging)
{
if (this.ToDoListView.Bounds.Contains(position))
this.ToDoListView.BackgroundColor = Color.Red;
else
this.ToDoListView.BackgroundColor = Color.White;
}
if (e.Action == DragAction.Drop)
{
if (this.ToDoListView.Bounds.Contains(position))
{
var item = e.ItemData as ToDoItem;
await Task.Delay(100);
viewModel.NewList.Remove(item);
viewModel.ToDoList.Add(item);
item.IsDone = false;
}
this.ToDoListView.BackgroundColor = Color.White;
}
}
private async void ToDoListView_ItemDragging(object sender, ItemDraggingEventArgs e)
{
var position = new Point();
var xPosition = e.Position.X;
double yPosition = e.Position.Y;
position.X = xPosition;
position.Y = yPosition;
if (e.Action == DragAction.Dragging)
{
if (this.WorkDoneListView.Bounds.Contains(position))
this.WorkDoneListView.BackgroundColor = Color.Red;
else
this.WorkDoneListView.BackgroundColor = Color.White;
}
if (e.Action == DragAction.Drop)
{
if (this.WorkDoneListView.Bounds.Contains(position))
{
var item = e.ItemData as ToDoItem;
await Task.Delay(100);
viewModel.ToDoList.Remove(item);
viewModel.NewList.Add(item);
item.IsDone = true;
}
this.WorkDoneListView.BackgroundColor = Color.White;
}
} |