void AddSwipeDelete() { UIButton rightSwipeViewText = new UIButton(); rightSwipeViewText.SetTitle("Delete", UIControlState.Normal); rightSwipeViewText.SetTitleColor(UIColor.White, UIControlState.Normal); rightSwipeViewText.VerticalAlignment = UIControlContentVerticalAlignment.Center; rightSwipeViewText.BackgroundColor = UIColor.FromRGB(220, 89, 95); rightSwipeViewText.TouchDown += (sender, e) => { m_model.RemovePoint(m_rowIndex); }; UIButton rightSwipeViewButton = new UIButton(); rightSwipeViewButton.SetImage(UtilsiOS.LoadImage("Delete"), UIControlState.Normal); rightSwipeViewButton.BackgroundColor = UIColor.FromRGB(220, 89, 95); rightSwipeViewButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; rightSwipeViewButton.TouchDown += (sender, e) => { m_model.RemovePoint(m_rowIndex); }; CustomSwipeView rightSwipeView = new CustomSwipeView(); rightSwipeView.AddSubview(rightSwipeViewButton); rightSwipeView.AddSubview(rightSwipeViewText); m_grid.RightSwipeView = rightSwipeView; }
void AddSwipeEdit() { UIButton leftSwipeViewText = new UIButton(); leftSwipeViewText.SetTitle("Edit", UIControlState.Normal); leftSwipeViewText.SetTitleColor(UIColor.White, UIControlState.Normal); leftSwipeViewText.VerticalAlignment = UIControlContentVerticalAlignment.Center; leftSwipeViewText.BackgroundColor = UIColor.FromRGB(0, 158, 218); leftSwipeViewText.TouchDown += EditDataGrid; UIButton leftSwipeViewButton = new UIButton(); leftSwipeViewButton.SetImage(UtilsiOS.LoadImage("Edit"), UIControlState.Normal); leftSwipeViewButton.BackgroundColor = UIColor.FromRGB(0, 158, 218); leftSwipeViewButton.TouchDown += EditDataGrid; CustomSwipeView leftSwipeView = new CustomSwipeView(); leftSwipeView.AddSubview(leftSwipeViewButton); leftSwipeView.AddSubview(leftSwipeViewText); m_grid.LeftSwipeView = leftSwipeView; }