public virtual void OnCellSelectionChanged(UITableViewCell cell, bool selected, bool setFromBinding) { var tableView = TableView; if (!setFromBinding || tableView == null) { return; } UpdateSelectedItemInternal(tableView, cell.DataContext(), selected); var path = IndexPathForCell(tableView, cell); if (path == null) { return; } if (selected) { tableView.SelectRow(path, UseAnimations, UITableViewScrollPosition.None); } else { try { //NOTE sometimes this code throw an exception on iOS 8, in this case we are using the WillDisplay method to deselect row. tableView.DeselectRow(path, UseAnimations); } catch { cell.Tag |= SelectedFromBindingStateFalseMask; } } }
public virtual bool UpdateSelectedBindValue(UITableViewCell cell, bool selected) { var tableView = TableView; if (tableView == null || tableView.AllowsMultipleSelection) { return(selected); } if (!tableView.AllowsSelection) { return(false); } if (HasMask(cell, InitializingStateMask)) { if (Equals(cell.DataContext(), SelectedItem)) { return(true); } return(selected && SelectedItem == null); } return(selected); }
public virtual void OnCellSelectionChanged(UITableViewCell cell, bool selected, bool setFromBinding) { var tableView = TableView; if (!setFromBinding || tableView == null) return; UpdateSelectedItemInternal(tableView, cell.DataContext(), selected); var path = IndexPathForCell(tableView, cell); if (path == null) return; if (selected) tableView.SelectRow(path, UseAnimations, UITableViewScrollPosition.None); else { try { //NOTE sometimes this code throw an exception on iOS 8, in this case we are using the WillDisplay method to deselect row. tableView.DeselectRow(path, UseAnimations); } catch { cell.Tag |= SelectedFromBindingStateFalseMask; } } }
public virtual bool UpdateSelectedBindValue(UITableViewCell cell, bool selected) { var tableView = TableView; if (tableView == null || tableView.AllowsMultipleSelection) return selected; if (!tableView.AllowsSelection) return false; if (HasMask(cell, InitializingStateMask)) { if (Equals(cell.DataContext(), SelectedItem)) return true; return selected && SelectedItem == null; } return selected; }