ListView.PropertyChanged += ListView_PropertyChanged;
private void ListView_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (e.PropertyName == "Width" && ListView.Orientation == Orientation.Vertical && ListView.SwipeOffset != ListView.Width)
ListView.SwipeOffset = ListView.Width;
else if (e.PropertyName == "Height" && ListView.Orientation == Orientation.Horizontal && ListView.SwipeOffset != ListView.Height)
ListView.SwipeOffset = ListView.Height;
} |
ListView.SwipeEnded += ListView_SwipeEnded;
private void ListView_SwipeEnded(object sender, SwipeEndedEventArgs e)
{
SwipingViewModel.ItemIndex = e.ItemIndex;
if (e.SwipeDirection == Syncfusion.ListView.XForms.SwipeDirection.Right)
{
e.SwipeOffset = ListView.Width;
Device.BeginInvokeOnMainThread(async () =>
{
await Task.Delay(500);
SwipingViewModel.InboxInfo.Remove(e.ItemData as ListViewInboxInfo);
});
}
else if (e.SwipeDirection == Syncfusion.ListView.XForms.SwipeDirection.Left)
{
e.SwipeOffset = ListView.Width;
Device.BeginInvokeOnMainThread(async () =>
{
await Task.Delay(500);
SwipingViewModel.InboxInfo.Remove(e.ItemData as ListViewInboxInfo);
});
}
} |