protected override void Dispose(bool disposing) { if (disposing) { if (SfGrid != null) { SfGrid.Dispose(); } viewModel = null; SfGrid = null; } base.Dispose(disposing); }
public override void Destroy() { sfGrid.AutoGeneratingColumn -= GridGenerateColumns; allowsorting.CheckedChange -= OnAllowSortingChanged; allowResizing.CheckedChange -= OnAllowResizingChanged; allowEditing.CheckedChange -= OnAllowEditingChanged; allowRowDragAndDrop.CheckedChange -= OnAllowRowDragAndDropChanged; imageView = null; anim = null; backgroundView = null; viewModel = null; allowEditing = null; allowResizing = null; allowRowDragAndDrop = null; allowsorting = null; sfGrid.Dispose(); sfGrid = null; }
public override void Destroy() { sfGrid.AutoGeneratingColumn -= GridGenerateColumns; allowsorting.CheckedChange -= OnAllowSortingChanged; allowResizing.CheckedChange -= OnAllowResizingChanged; allowEditing.CheckedChange -= OnAllowEditingChanged; allowRowDragAndDrop.CheckedChange -= OnAllowRowDragAndDropChanged; sfPopUp.Opened -= SfPopUp_PopupOpened; sfPopUp.Closed -= SfPopUp_PopupClosed; imageView = null; sfPopUp.PopupView.ClearAnimation(); anim = null; backgroundView = null; sfPopUp.Dispose(); sfPopUp = null; viewModel = null; allowEditing = null; allowResizing = null; allowRowDragAndDrop = null; allowsorting = null; sfGrid.Dispose(); sfGrid = null; }
protected override void Dispose(bool disposing) { if (disposing) { if (save != null) { save.TouchDown -= Save_TouchDown; } if (cancel != null) { cancel.TouchDown -= Cancel_TouchDown; } if (SfGrid != null) { SfGrid.SwipeEnded -= SfGrid_SwipeEnded; SfGrid.SwipeStarted -= SfGrid_SwipeStarted; SfGrid.GridTapped -= SfGrid_GridTapped; SfGrid.GridLongPressed -= SfGrid_GridLongPressed; SfGrid.Dispose(); } col1 = null; col2 = null; col3 = null; col4 = null; orderIDText = null; customerIDText = null; employeeIDText = null; nameText = null; save = null; cancel = null; viewModel = null; detailView = null; SfGrid = null; } base.Dispose(disposing); }
public SwipeDelete() { this.SfGrid = new SfDataGrid(); this.viewModel = new SwipingViewModel(); this.SfGrid.ItemsSource = viewModel.OrdersInfo; this.SfGrid.AutoGenerateColumns = false; this.SfGrid.ShowRowHeader = false; this.SfGrid.HeaderRowHeight = 45; this.SfGrid.RowHeight = 45; this.SfGrid.ColumnSizer = ColumnSizer.Star; UILabel leftSwipeViewText = new UILabel(); leftSwipeViewText.Text = "Deleted"; leftSwipeViewText.TextColor = UIColor.White; leftSwipeViewText.TextAlignment = UITextAlignment.Left; leftSwipeViewText.BackgroundColor = UIColor.FromRGB(26, 170, 135); UILabel leftSwipeViewButton = new UILabel(); leftSwipeViewButton.UserInteractionEnabled = true; leftSwipeViewButton.Text = "UNDO"; leftSwipeViewButton.TextColor = UIColor.White; leftSwipeViewButton.Font = UIFont.BoldSystemFontOfSize(14); leftSwipeViewButton.TextAlignment = UITextAlignment.Right; leftSwipeViewButton.BackgroundColor = UIColor.FromRGB(26, 170, 135); leftSwipeViewButton.AddGestureRecognizer(new UITapGestureRecognizer(UndoTapped)); SwipeView leftSwipeView = new SwipeView(); leftSwipeView.BackgroundColor = UIColor.FromRGB(26, 170, 135); leftSwipeView.AddSubview(leftSwipeViewText); leftSwipeView.AddSubview(leftSwipeViewButton); UILabel rightSwipeViewText = new UILabel(); rightSwipeViewText.Text = "Deleted"; rightSwipeViewText.TextColor = UIColor.White; rightSwipeViewText.TextAlignment = UITextAlignment.Left; rightSwipeViewText.BackgroundColor = UIColor.FromRGB(26, 170, 135); UILabel rightSwipeViewButton = new UILabel(); rightSwipeViewButton.UserInteractionEnabled = true; rightSwipeViewButton.Text = "UNDO"; rightSwipeViewButton.TextColor = UIColor.White; rightSwipeViewButton.Font = UIFont.BoldSystemFontOfSize(14); rightSwipeViewButton.TextAlignment = UITextAlignment.Right; rightSwipeViewButton.BackgroundColor = UIColor.FromRGB(26, 170, 135); rightSwipeViewButton.AddGestureRecognizer(new UITapGestureRecognizer(UndoTapped)); SwipeView rightSwipeView = new SwipeView(); rightSwipeView.BackgroundColor = UIColor.FromRGB(26, 170, 135); rightSwipeView.AddSubview(rightSwipeViewText); rightSwipeView.AddSubview(rightSwipeViewButton); this.SfGrid.AllowSwiping = true; this.SfGrid.LeftSwipeView = leftSwipeView; this.SfGrid.RightSwipeView = rightSwipeView; this.SfGrid.SwipeEnded += SfGrid_SwipeEnded; this.SfGrid.SwipeStarted += SfGrid_SwipeStarted; GridTextColumn CustomerID = new GridTextColumn(); CustomerID.MappingName = "CustomerID"; CustomerID.HeaderText = "Customer ID"; GridTextColumn OrderID = new GridTextColumn(); OrderID.MappingName = "OrderID"; OrderID.HeaderText = "Order ID"; GridTextColumn EmployeeID = new GridTextColumn(); EmployeeID.MappingName = "EmployeeID"; EmployeeID.HeaderText = "Employee ID"; GridTextColumn Name = new GridTextColumn(); Name.MappingName = "FirstName"; Name.HeaderText = "Name"; this.SfGrid.Columns.Add(OrderID); this.SfGrid.Columns.Add(CustomerID); this.SfGrid.Columns.Add(EmployeeID); this.SfGrid.Columns.Add(Name); this.AddSubview(SfGrid); }
private void CreateDataGrid() { deleteView = new LinearLayout(cont); deleteView.TextAlignment = TextAlignment.Center; deleteView.Orientation = Android.Widget.Orientation.Horizontal; deleteView.Click += swipeViewImage_Click; ImageView deleteImage = new ImageView(cont); deleteImage.SetImageResource(Resource.Drawable.Delete); deleteImage.SetBackgroundColor(Color.ParseColor("#EF5350")); TextView delete = new TextView(cont); delete.Text = "DELETE"; delete.TextAlignment = TextAlignment.Center; delete.SetPadding((int)(16 * density), (int)(10 * density), (int)(10 * density), 0); delete.SetTextColor(Color.White); delete.SetBackgroundColor(Color.ParseColor("#EF5350")); viewModel = new SwipingViewModel(); viewModel.SetRowstoGenerate(100); sfGrid = new SfDataGrid(cont); sfGrid.AutoGenerateColumns = false; sfGrid.ItemsSource = (viewModel.OrdersInfo); sfGrid.AllowSwiping = true; sfGrid.AllowSorting = true; sfGrid.AllowResizingColumn = true; sfGrid.AllowDraggingRow = true; sfGrid.ColumnSizer = ColumnSizer.Star; sfGrid.GridLoaded += SfGrid_GridLoaded; sfGrid.SwipeEnded += SfGrid_SwipeEnded; int width = cont.Resources.DisplayMetrics.WidthPixels; sfGrid.MaxSwipeOffset = (int)(120 * density); leftSwipeView = new SwipeView(cont); deleteView.AddView(deleteImage, (int)(30 * density), (int)sfGrid.RowHeight); deleteView.AddView(delete, sfGrid.MaxSwipeOffset - 30, (int)sfGrid.RowHeight); leftSwipeView.AddView(deleteView, sfGrid.MaxSwipeOffset, (int)sfGrid.RowHeight); sfGrid.LeftSwipeView = leftSwipeView; GridTextColumn CustomerID = new GridTextColumn(); CustomerID.MappingName = "CustomerID"; CustomerID.HeaderText = "Customer ID"; GridTextColumn OrderID = new GridTextColumn(); OrderID.MappingName = "OrderID"; OrderID.HeaderText = "Order ID"; OrderID.TextMargin = new Thickness(16, 0, 0, 0); OrderID.HeaderTextMargin = new Thickness(16, 0, 0, 0); GridTextColumn EmployeeID = new GridTextColumn(); EmployeeID.MappingName = "EmployeeID"; EmployeeID.HeaderText = "Employee ID"; GridTextColumn Name = new GridTextColumn(); Name.MappingName = "FirstName"; Name.HeaderText = "Name"; sfGrid.Columns.Add(OrderID); sfGrid.Columns.Add(CustomerID); sfGrid.Columns.Add(EmployeeID); sfGrid.Columns.Add(Name); sfGrid.VerticalOverScrollMode = VerticalOverScrollMode.None; }
private void CreateDataGrid() { col1 = new UILabel(); col1.Text = "Order ID"; col2 = new UILabel(); col2.Text = "Customer ID"; col3 = new UILabel(); col3.Text = "Employee ID"; col4 = new UILabel(); col4.Text = "Name"; orderIDText = new UITextField(); orderIDText.AllowsEditingTextAttributes = true; orderIDText.ShouldReturn += (textField) => { orderIDText.ResignFirstResponder(); return(true); }; customerIDText = new UITextField(); customerIDText.ShouldReturn += (textField) => { customerIDText.ResignFirstResponder(); return(true); }; employeeIDText = new UITextField(); employeeIDText.ShouldReturn += (textField) => { employeeIDText.ResignFirstResponder(); return(true); }; nameText = new UITextField(); nameText.ShouldReturn += (textField) => { nameText.ResignFirstResponder(); return(true); }; orderIDText.Hidden = true; customerIDText.Hidden = true; employeeIDText.Hidden = true; nameText.Hidden = true; col1.Hidden = true; col2.Hidden = true; col3.Hidden = true; col4.Hidden = true; this.detailView = new DetailView(); this.detailView.Hidden = true; this.SfGrid = new SfDataGrid(); this.SfGrid.GridLoaded += SfGrid_GridLoaded; this.SfGrid.AllowDraggingRow = true; this.SfGrid.AllowEditing = true; this.SfGrid.AllowResizingColumn = true; this.viewModel = new SwipingViewModel(); this.SfGrid.ItemsSource = viewModel.OrdersInfo; this.SfGrid.AutoGenerateColumns = false; this.SfGrid.GridStyle = new CustomStyles(); this.SfGrid.ShowRowHeader = false; this.SfGrid.HeaderRowHeight = 45; this.SfGrid.RowHeight = 45; this.SfGrid.ColumnSizer = ColumnSizer.Star; UIButton leftSwipeViewText = new UIButton(); leftSwipeViewText.SetTitle("Delete", UIControlState.Normal); leftSwipeViewText.SetTitleColor(UIColor.White, UIControlState.Normal); leftSwipeViewText.VerticalAlignment = UIControlContentVerticalAlignment.Center; leftSwipeViewText.BackgroundColor = UIColor.FromRGB(220, 89, 95); leftSwipeViewText.TouchDown += LeftSwipeViewButton_TouchDown; leftSwipeViewText.Frame = new CGRect(56, 0, 60, 45); UIButton leftSwipeViewButton = new UIButton(); leftSwipeViewButton.SetImage(UIImage.FromFile("Images/Popup_Delete.png"), UIControlState.Normal); leftSwipeViewButton.BackgroundColor = UIColor.FromRGB(220, 89, 95); leftSwipeViewButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; leftSwipeViewButton.TouchDown += LeftSwipeViewButton_TouchDown; leftSwipeViewButton.Frame = new CGRect(16, 10, 24, 24); CustomSwipeView leftSwipeView = new CustomSwipeView(); leftSwipeView.AddSubview(leftSwipeViewButton); leftSwipeView.AddSubview(leftSwipeViewText); leftSwipeView.Frame = new CGRect(0, 0, 120, 44); leftSwipeView.BackgroundColor = UIColor.FromRGB(220, 89, 95); this.SfGrid.AllowSwiping = true; this.SfGrid.LeftSwipeView = leftSwipeView; this.SfGrid.SwipeEnded += SfGrid_SwipeEnded; this.SfGrid.SwipeStarted += SfGrid_SwipeStarted; GridTextColumn CustomerID = new GridTextColumn(); CustomerID.MappingName = "CustomerID"; CustomerID.HeaderText = "Customer ID"; GridTextColumn OrderID = new GridTextColumn(); OrderID.MappingName = "OrderID"; OrderID.HeaderText = "Order ID"; GridTextColumn EmployeeID = new GridTextColumn(); EmployeeID.MappingName = "EmployeeID"; EmployeeID.HeaderText = "Employee ID"; GridTextColumn Name = new GridTextColumn(); Name.MappingName = "FirstName"; Name.HeaderText = "Name"; this.SfGrid.Columns.Add(OrderID); this.SfGrid.Columns.Add(CustomerID); this.SfGrid.Columns.Add(EmployeeID); this.SfGrid.Columns.Add(Name); }
public override Android.Views.View GetSampleContent(Android.Content.Context context) { parentLayout = new FrameLayout(context); optionHeading = new TextView(context); optionHeading.Gravity = GravityFlags.CenterHorizontal; body = new LinearLayout(context); optionView = new LinearLayout(context); optionView.SetBackgroundColor(Color.Gray); editor = new LinearLayout(context); bottom = new LinearLayout(context); bodyRow1 = new LinearLayout(context); bodyRow1.Orientation = Android.Widget.Orientation.Horizontal; bodyRow1.SetGravity(GravityFlags.CenterHorizontal); bodyRow2 = new LinearLayout(context); bodyRow2.Orientation = Android.Widget.Orientation.Horizontal; bodyRow2.SetGravity(GravityFlags.CenterHorizontal); bodyRow3 = new LinearLayout(context); bodyRow3.Orientation = Android.Widget.Orientation.Horizontal; bodyRow3.SetGravity(GravityFlags.CenterHorizontal); bodyRow4 = new LinearLayout(context); bodyRow4.Orientation = Android.Widget.Orientation.Horizontal; bodyRow4.SetGravity(GravityFlags.CenterHorizontal); col1 = new TextView(context); col1.Text = "Order ID"; col2 = new TextView(context); col2.Text = "Customer ID"; col3 = new TextView(context); col3.Text = "Employee ID"; col4 = new TextView(context); col4.Text = "Name"; orderIDText = new EditText(context); orderIDText.Gravity = GravityFlags.Start; customerIDText = new EditText(context); employeeIDText = new EditText(context); nameText = new EditText(context); save = new Button(context); save.Click += save_Click; cancel = new Button(context); cancel.Click += cancel_Click; editView = new LinearLayout(context); editView.TextAlignment = TextAlignment.Center; editView.Orientation = Android.Widget.Orientation.Horizontal; editView.Click += editView_Click; deleteView = new LinearLayout(context); deleteView.TextAlignment = TextAlignment.Center; deleteView.Orientation = Android.Widget.Orientation.Horizontal; deleteView.Click += swipeViewImage_Click; ImageView editImage = new ImageView(context); editImage.SetImageResource(Resource.Drawable.Edit); editImage.SetBackgroundColor(Color.ParseColor("#42A5F5")); // editImage.SetPadding((int)(16 * Resources.System.DisplayMetrics.Density), 0, (int)(16 * Resources.System.DisplayMetrics.Density), 0); TextView edit = new TextView(context); edit.Text = "EDIT"; edit.TextAlignment = TextAlignment.Center; edit.SetTextColor(Color.White); edit.SetPadding((int)(16 * Resources.System.DisplayMetrics.Density), (int)(10 * Resources.System.DisplayMetrics.Density), (int)(10 * Resources.System.DisplayMetrics.Density), 0); edit.SetBackgroundColor(Color.ParseColor("#42A5F5")); ImageView deleteImage = new ImageView(context); deleteImage.SetImageResource(Resource.Drawable.Delete); deleteImage.SetBackgroundColor(Color.ParseColor("#EF5350")); // deleteImage.SetPadding((int)(16 * Resources.System.DisplayMetrics.Density), 0, (int)(16 * Resources.System.DisplayMetrics.Density), 0); TextView delete = new TextView(context); delete.Text = "DELETE"; delete.TextAlignment = TextAlignment.Center; delete.SetPadding((int)(14 * Resources.System.DisplayMetrics.Density), (int)(10 * Resources.System.DisplayMetrics.Density), (int)(10 * Resources.System.DisplayMetrics.Density), 0); delete.SetTextColor(Color.White); delete.SetBackgroundColor(Color.ParseColor("#EF5350")); viewModel = new SwipingViewModel(); viewModel.SetRowstoGenerate(100); sfGrid = new SfDataGrid(context); sfGrid.AutoGenerateColumns = false; sfGrid.ItemsSource = (viewModel.OrdersInfo); sfGrid.AllowSwiping = true; sfGrid.ColumnSizer = ColumnSizer.Star; DisplayMetrics metrics = context.Resources.DisplayMetrics; int width = metrics.WidthPixels; sfGrid.MaxSwipeOffset = (int)(100 * metrics.Density); leftSwipeView = new SwipeView(context); rightSwipeView = new SwipeView(context); editView.AddView(editImage, (int)(30 * Resources.System.DisplayMetrics.Density), (int)sfGrid.RowHeight); editView.AddView(edit, sfGrid.MaxSwipeOffset - 30, (int)sfGrid.RowHeight); deleteView.AddView(deleteImage, (int)(30 * Resources.System.DisplayMetrics.Density), (int)sfGrid.RowHeight); deleteView.AddView(delete, sfGrid.MaxSwipeOffset - 30, (int)sfGrid.RowHeight); leftSwipeView.AddView(editView, sfGrid.MaxSwipeOffset, (int)sfGrid.RowHeight); rightSwipeView.AddView(deleteView, sfGrid.MaxSwipeOffset, (int)sfGrid.RowHeight); sfGrid.LeftSwipeView = leftSwipeView; sfGrid.RightSwipeView = rightSwipeView; sfGrid.SwipeEnded += sfGrid_SwipeEnded; sfGrid.SwipeStarted += sfGrid_SwipeStarted; GridTextColumn CustomerID = new GridTextColumn(); CustomerID.MappingName = "CustomerID"; CustomerID.HeaderText = "Customer ID"; GridTextColumn OrderID = new GridTextColumn(); OrderID.MappingName = "OrderID"; OrderID.HeaderText = "Order ID"; OrderID.TextMargin = new Thickness(16, 0, 0, 0); OrderID.HeaderTextMargin = new Thickness(16, 0, 0, 0); GridTextColumn EmployeeID = new GridTextColumn(); EmployeeID.MappingName = "EmployeeID"; EmployeeID.HeaderText = "Employee ID"; GridTextColumn Name = new GridTextColumn(); Name.MappingName = "FirstName"; Name.HeaderText = "Name"; sfGrid.Columns.Add(OrderID); sfGrid.Columns.Add(CustomerID); sfGrid.Columns.Add(EmployeeID); sfGrid.Columns.Add(Name); sfGrid.VerticalOverScrollMode = VerticalOverScrollMode.None; parentLayout.AddView(sfGrid); editor.SetBackgroundColor(Color.White); editor.Orientation = Android.Widget.Orientation.Vertical; optionHeading.Text = "EDIT DETAILS"; optionHeading.SetTypeface(null, TypefaceStyle.Bold); optionHeading.Gravity = GravityFlags.Center; bodyRow1.AddView(col1, (int)(100 * sfGrid.Resources.DisplayMetrics.Density), (int)(50 * sfGrid.Resources.DisplayMetrics.Density)); bodyRow1.AddView(orderIDText, (int)(100 * sfGrid.Resources.DisplayMetrics.Density), ViewGroup.LayoutParams.WrapContent); bodyRow2.AddView(col2, (int)(100 * sfGrid.Resources.DisplayMetrics.Density), (int)(50 * sfGrid.Resources.DisplayMetrics.Density)); bodyRow2.AddView(customerIDText, (int)(100 * sfGrid.Resources.DisplayMetrics.Density), ViewGroup.LayoutParams.WrapContent); bodyRow3.AddView(col3, (int)(100 * sfGrid.Resources.DisplayMetrics.Density), (int)(50 * sfGrid.Resources.DisplayMetrics.Density)); bodyRow3.AddView(employeeIDText, (int)(100 * sfGrid.Resources.DisplayMetrics.Density), ViewGroup.LayoutParams.WrapContent); bodyRow4.AddView(col4, (int)(100 * sfGrid.Resources.DisplayMetrics.Density), (int)(50 * sfGrid.Resources.DisplayMetrics.Density)); bodyRow4.AddView(nameText, (int)(100 * sfGrid.Resources.DisplayMetrics.Density), ViewGroup.LayoutParams.WrapContent); body.Orientation = Android.Widget.Orientation.Vertical; body.SetGravity(GravityFlags.CenterHorizontal); body.AddView(bodyRow1); body.AddView(bodyRow2); body.AddView(bodyRow3); body.AddView(bodyRow4); save.Text = "Save"; cancel.Text = "Cancel"; bottom.Orientation = Android.Widget.Orientation.Horizontal; bottom.AddView(save); bottom.AddView(cancel); bottom.SetGravity(GravityFlags.Center); editor.AddView(optionHeading); editor.AddView(body); editor.AddView(bottom); optionView.AddView(editor, ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); if (parentLayout.ChildCount == 1) { parentLayout.AddView(optionView, 1); } parentLayout.GetChildAt(0).Visibility = ViewStates.Visible; parentLayout.GetChildAt(1).Visibility = ViewStates.Invisible; return(parentLayout); }
public override void Destroy() { sfGrid.Dispose(); sfGrid = null; viewModel = null; }
public Swiping() { save = new UIButton(); save.SetTitle("Save", UIControlState.Normal); save.BackgroundColor = UIColor.DarkGray; save.Font = UIFont.FromName("Helvetica-Bold", 12f); save.TouchDown += Save_TouchDown; cancel = new UIButton(); cancel.SetTitle("Cancel", UIControlState.Normal); cancel.TouchDown += Cancel_TouchDown; cancel.BackgroundColor = UIColor.DarkGray; cancel.Font = UIFont.FromName("Helvetica-Bold", 12f); col1 = new UILabel(); col1.Text = "Order ID"; col2 = new UILabel(); col2.Text = "Customer ID"; col3 = new UILabel(); col3.Text = "Employee ID"; col4 = new UILabel(); col4.Text = "Name"; orderIDText = new UITextField(); orderIDText.AllowsEditingTextAttributes = true; orderIDText.ShouldReturn += (textField) => { orderIDText.ResignFirstResponder(); return(true); }; customerIDText = new UITextField(); customerIDText.ShouldReturn += (textField) => { customerIDText.ResignFirstResponder(); return(true); }; employeeIDText = new UITextField(); employeeIDText.ShouldReturn += (textField) => { employeeIDText.ResignFirstResponder(); return(true); }; nameText = new UITextField(); nameText.ShouldReturn += (textField) => { nameText.ResignFirstResponder(); return(true); }; orderIDText.Hidden = true; customerIDText.Hidden = true; employeeIDText.Hidden = true; nameText.Hidden = true; col1.Hidden = true; col2.Hidden = true; col3.Hidden = true; col4.Hidden = true; save.Hidden = true; cancel.Hidden = true; this.detailView = new DetailView(); this.detailView.Hidden = true; this.SfGrid = new SfDataGrid(); this.viewModel = new SwipingViewModel(); this.SfGrid.ItemsSource = viewModel.OrdersInfo; this.SfGrid.AutoGenerateColumns = false; this.SfGrid.ShowRowHeader = false; this.SfGrid.HeaderRowHeight = 45; this.SfGrid.RowHeight = 45; this.SfGrid.ColumnSizer = ColumnSizer.Star; 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.TouchUpInside += LeftSwipeViewButton_TouchUpInside; leftSwipeViewText.Frame = new CGRect(56, 0, 60, 45); UIButton leftSwipeViewButton = new UIButton(); leftSwipeViewButton.SetImage(UIImage.FromFile("Images/Edit.png"), UIControlState.Normal); leftSwipeViewButton.BackgroundColor = UIColor.FromRGB(0, 158, 218); leftSwipeViewButton.TouchUpInside += LeftSwipeViewButton_TouchUpInside; leftSwipeViewButton.Frame = new CGRect(16, 10, 24, 24); CustomSwipeView leftSwipeView = new CustomSwipeView(); leftSwipeView.AddSubview(leftSwipeViewButton); leftSwipeView.AddSubview(leftSwipeViewText); leftSwipeView.Frame = new CGRect(0, 0, 120, 44); leftSwipeView.BackgroundColor = UIColor.FromRGB(0, 158, 218); 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.TouchUpInside += RightSwipeViewButton_TouchUpInside; rightSwipeViewText.Frame = new CGRect(56, 0, 60, 45); UIButton rightSwipeViewButton = new UIButton(); rightSwipeViewButton.SetImage(UIImage.FromFile("Images/Delete.png"), UIControlState.Normal); rightSwipeViewButton.BackgroundColor = UIColor.FromRGB(220, 89, 95); rightSwipeViewButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; rightSwipeViewButton.TouchUpInside += RightSwipeViewButton_TouchUpInside; rightSwipeViewButton.Frame = new CGRect(16, 10, 24, 24); CustomSwipeView rightSwipeView = new CustomSwipeView(); rightSwipeView.AddSubview(rightSwipeViewButton); rightSwipeView.AddSubview(rightSwipeViewText); rightSwipeView.Frame = new CGRect(0, 0, 120, 44); rightSwipeView.BackgroundColor = UIColor.FromRGB(220, 89, 95); this.SfGrid.AllowSwiping = true; this.SfGrid.LeftSwipeView = leftSwipeView; this.SfGrid.RightSwipeView = rightSwipeView; this.SfGrid.SwipeEnded += SfGrid_SwipeEnded; this.SfGrid.SwipeStarted += SfGrid_SwipeStarted; this.SfGrid.GridTapped += SfGrid_GridTapped; this.SfGrid.GridLongPressed += SfGrid_GridLongPressed; GridTextColumn CustomerID = new GridTextColumn(); CustomerID.MappingName = "CustomerID"; CustomerID.HeaderText = "Customer ID"; GridTextColumn OrderID = new GridTextColumn(); OrderID.MappingName = "OrderID"; OrderID.HeaderText = "Order ID"; GridTextColumn EmployeeID = new GridTextColumn(); EmployeeID.MappingName = "EmployeeID"; EmployeeID.HeaderText = "Employee ID"; GridTextColumn Name = new GridTextColumn(); Name.MappingName = "FirstName"; Name.HeaderText = "Name"; this.SfGrid.Columns.Add(OrderID); this.SfGrid.Columns.Add(CustomerID); this.SfGrid.Columns.Add(EmployeeID); this.SfGrid.Columns.Add(Name); this.AddSubview(SfGrid); this.AddSubview(detailView); this.AddSubview(col1); this.AddSubview(col2); this.AddSubview(col3); this.AddSubview(col4); this.AddSubview(orderIDText); this.AddSubview(customerIDText); this.AddSubview(employeeIDText); this.AddSubview(nameText); this.AddSubview(save); this.AddSubview(cancel); }
public override Android.Views.View GetSampleContent(Android.Content.Context context) { FrameLayout frame = new FrameLayout(context); linear = new LinearLayout(context); linear.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); linear.Orientation = Orientation.Horizontal; TextView swipeViewUndo = new TextView(context); swipeViewUndo.Text = "UNDO"; swipeViewUndo.SetTypeface(swipeViewUndo.Typeface, TypefaceStyle.Bold); swipeViewUndo.Gravity = GravityFlags.Center; swipeViewUndo.SetTextColor(Color.White); swipeViewUndo.SetBackgroundColor(Color.ParseColor("#1AAA87")); swipeViewUndo.Click += swipeViewUndo_Click; TextView swipeViewText = new TextView(context); swipeViewText.SetPadding((int)(25 * context.Resources.DisplayMetrics.Density), 0, 0, 0); swipeViewText.Text = "Deleted"; swipeViewText.Gravity = GravityFlags.CenterVertical | GravityFlags.Left; swipeViewText.SetTextColor(Color.White); swipeViewText.SetBackgroundColor(Color.ParseColor("#1AAA87")); linear.SetBackgroundColor(Color.ParseColor("#1AAA87")); viewModel = new SwipingViewModel(); viewModel.SetRowstoGenerate(100); sfGrid = new SfDataGrid(context); sfGrid.AutoGenerateColumns = false; sfGrid.ItemsSource = (viewModel.OrdersInfo); sfGrid.AllowSwiping = true; sfGrid.ColumnSizer = ColumnSizer.Star; DisplayMetrics metrics = context.Resources.DisplayMetrics; int width = metrics.WidthPixels; sfGrid.MaxSwipeOffset = width; swipe = new SwipeView(context); var undoWidth = (int)(100 * context.Resources.DisplayMetrics.Density); linear.AddView(swipeViewText, (sfGrid.MaxSwipeOffset - undoWidth), (int)sfGrid.RowHeight); linear.AddView(swipeViewUndo, undoWidth, (int)sfGrid.RowHeight); swipe.SetBackgroundColor(Color.ParseColor("#1AAA87")); swipe.AddView(linear); sfGrid.LeftSwipeView = swipe; sfGrid.RightSwipeView = swipe; sfGrid.SwipeEnded += sfGrid_SwipeEnded; sfGrid.SwipeStarted += sfGrid_SwipeStarted; GridTextColumn CustomerID = new GridTextColumn(); CustomerID.MappingName = "CustomerID"; CustomerID.HeaderText = "Customer ID"; GridTextColumn OrderID = new GridTextColumn(); OrderID.MappingName = "OrderID"; OrderID.HeaderText = "Order ID"; GridTextColumn EmployeeID = new GridTextColumn(); EmployeeID.MappingName = "EmployeeID"; EmployeeID.HeaderText = "Employee ID"; GridTextColumn Name = new GridTextColumn(); Name.MappingName = "FirstName"; Name.HeaderText = "Name"; sfGrid.Columns.Add(OrderID); sfGrid.Columns.Add(CustomerID); sfGrid.Columns.Add(EmployeeID); sfGrid.Columns.Add(Name); frame.AddView(sfGrid); return(frame); }