public void OnItemSelected(object sender, SelectedItemChangedEventArgs eventArg) { if (_selectionFromNative) { _selectionFromNative = false; return; } var location = TemplatedItemsView.TemplatedItems.GetGroupAndIndexOfItem(eventArg.SelectedItem); if (location.Item1 == -1 || location.Item2 == -1) { var row = _nsTableView.SelectedRow; int groupIndex = 1; var selectedIndexPath = NSIndexPath.FromItemSection(row, groupIndex); if (selectedIndexPath != null) { _nsTableView.DeselectRow(selectedIndexPath.Item); } return; } var rowId = location.Item2; _nsTableView.SelectRow(rowId, false); }
public override void SelectionDidChange(NSNotification notification) { NSTableView tableView = notification.Object as NSTableView; this.view.Model.RowSelected(0, (int)tableView.SelectedRow); if (!this.AutomaticallyDeselect) { return; } tableView.DeselectRow(tableView.SelectedRow); }
public override void SelectionDidChange(NSNotification notification) { var selectedRow = (int)_nsTableView.SelectedRow; if (selectedRow == -1) { return; } _listView.NotifyItemSelected(_tableItems[selectedRow]); Console.WriteLine("Row " + selectedRow.ToString() + " selected"); _nsTableView.DeselectRow(selectedRow); }
/* * public override void RowDeselected (NSTableView tableView, NSIndexPath indexPath) * { * // ISSUE: reference to a compiler-generated method * NSTableCellView cell = tableView.CellAt (indexPath); * if (cell == null) * return; * ListViewRenderer.ListViewDataSource.SetCellBackgroundColor (cell, this.DefaultBackgroundColor); * } */ public void OnItemSelected(object sender, SelectedItemChangedEventArgs eventArg) { if (this.selectionFromNative) { this.selectionFromNative = false; } else { Tuple <int, int> groupAndIndexOfItem = this.list.TemplatedItems.GetGroupAndIndexOfItem(eventArg.SelectedItem); if (groupAndIndexOfItem.Item1 == -1 || groupAndIndexOfItem.Item2 == -1) { //NSIndexPath pathForSelectedRow = this.uiTableView.IndexPathForSelectedRow; bool animated = true; if (uiTableView.SelectedRow >= 0) { var cell = uiTableView.GetCell(0, uiTableView.SelectedRow); var contextActionsCell = cell.ControlView as ContextActionsCell; if (contextActionsCell != null) { contextActionsCell.PrepareForDeselect(); //if (contextActionsCell.IsOpen) // animated = false; } } else { return; } uiTableView.DeselectRow(uiTableView.SelectedRow); } else { this.uiTableView.SelectRow(groupAndIndexOfItem.Item2, false); } } }
public override void SelectionDidChange(NSNotification notification) { var row = _nsTableView.SelectedRow; if (row == -1) { return; } int sectionIndex; bool isHeader; int itemIndexInSection; GetComputedIndexes(row, out sectionIndex, out itemIndexInSection, out isHeader); var cell = _tableView.Model.GetCell(sectionIndex, itemIndexInSection); _tableView.Model.RowSelected(cell); if (AutomaticallyDeselect) { _nsTableView?.DeselectRow(row); } }