public void OnSwipeBackgroundSet(MvxSwipeBackgroundSetEventArgs args) { int backgroundResourceId = -1; switch (args.Type) { case SwipeableItemConstants.DrawableSwipeUpBackground: backgroundResourceId = ItemViewSwipeUpBackgroundResourceId; break; case SwipeableItemConstants.DrawableSwipeDownBackground: backgroundResourceId = ItemViewSwipeDownBackgroundResourceId; break; case SwipeableItemConstants.DrawableSwipeLeftBackground: backgroundResourceId = ItemViewSwipeLeftBackgroundResourceId; break; case SwipeableItemConstants.DrawableSwipeRightBackground: backgroundResourceId = ItemViewSwipeRightBackgroundResourceId; break; case SwipeableItemConstants.DrawableSwipeNeutralBackground: backgroundResourceId = ItemViewSwipeNeutralBackgroundResourceId; break; } if (backgroundResourceId != -1) { args.ViewHolder.ItemView.SetBackgroundResource(backgroundResourceId); } }
public void OnSetSwipeBackground(Object viewHolder, int position, int type) { var advancedViewHolder = viewHolder as MvxAdvancedRecyclerViewHolder; var args = new MvxSwipeBackgroundSetEventArgs() { ViewHolder = advancedViewHolder, Position = position, Type = type }; SwipeBackgroundSet?.Invoke(args); SwipeableTemplate?.OnSwipeBackgroundSet(args); }