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); }
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 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); }