/// <summary> /// Called by the TableView to get the actual UITableViewCell to render for the particular row /// </summary> public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { // request a recycled cell to save memory UITableViewCell cell = tableView.DequeueReusableCell (cellIdentifier); // UNCOMMENT one of these to use that style // var cellStyle = UITableViewCellStyle.Default; var cellStyle = UITableViewCellStyle.Subtitle; // var cellStyle = UITableViewCellStyle.Value1; // var cellStyle = UITableViewCellStyle.Value2; // if there are no cells to reuse, create a new one if (cell == null) { cell = new UITableViewCell (cellStyle, cellIdentifier); } cell.TextLabel.Text = tableItems[indexPath.Row].Heading; // Default style doesn't support Subtitle if (cellStyle == UITableViewCellStyle.Subtitle || cellStyle == UITableViewCellStyle.Value1 || cellStyle == UITableViewCellStyle.Value2) { cell.DetailTextLabel.Text = tableItems[indexPath.Row].SubHeading; } // Value2 style doesn't support an image if (cellStyle != UITableViewCellStyle.Value2) cell.ImageView.Image = UIImage.FromFile ("Images/" +tableItems[indexPath.Row].ImageName); return cell; }
public override void RowSelected (UITableView tableView, NSIndexPath indexPath) { var dsViewController = (DispatchSourceViewController)Storyboard.InstantiateViewController ("DSViewController"); dsViewController.SelectedDispatchSource = (DispatchSourceType)indexPath.Row; NavigationController.PushViewController (dsViewController, true); }
private void TogglePicker(DialogViewController dvc, UITableView tableView, NSIndexPath path) { var sectionAndIndex = GetMySectionAndIndex(dvc); if(sectionAndIndex.Key != null) { Section section = sectionAndIndex.Key; int index = sectionAndIndex.Value; var cell = tableView.CellAt(path); if(isPickerPresent) { // Remove the picker. cell.DetailTextLabel.TextColor = UIColor.Gray; section.Remove(datePickerContainer); isPickerPresent = false; } else { // Show the picker. cell.DetailTextLabel.TextColor = UIColor.Red; datePickerContainer = new UIViewElement(string.Empty, datePicker, false); section.Insert(index + 1, UITableViewRowAnimation.Bottom, datePickerContainer); isPickerPresent = true; } } }
public override void RowSelected (UITableView tableView, NSIndexPath indexPath) { new UIAlertView("Row Selected" , indexedTableItems[keys[indexPath.Section]][indexPath.Row].Heading , null, "OK", null).Show(); tableView.DeselectRow (indexPath, true); }
public override void MoveItem (UICollectionView collectionView, NSIndexPath sourceIndexPath, NSIndexPath destinationIndexPath) { // Reorder our list of items var item = Numbers [(int)sourceIndexPath.Item]; Numbers.RemoveAt ((int)sourceIndexPath.Item); Numbers.Insert ((int)destinationIndexPath.Item, item); }
public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path) { Value = !Value; var cell = tableView.CellAt (path); ConfigCell (cell); base.Selected (dvc, tableView, path); }
public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path) { Value = !Value; InitializeCell(tableView); base.Selected(dvc, tableView, path); }
public override void RowSelected (UITableView tableView, NSIndexPath indexPath) { UIAlertController okAlertController = UIAlertController.Create ("Row Selected", indexedTableItems [keys [indexPath.Section]] [indexPath.Row], UIAlertControllerStyle.Alert); okAlertController.AddAction (UIAlertAction.Create ("OK", UIAlertActionStyle.Default, null)); owner.PresentViewController (okAlertController, true, null); tableView.DeselectRow (indexPath, true); }
public override void MoveRow (UITableView tableView, NSIndexPath sourceIndexPath, NSIndexPath destinationIndexPath) { var section = Container.Root [sourceIndexPath.Section]; var source = section [sourceIndexPath.Row]; section.Remove (source); section.Insert (destinationIndexPath.Row, source); }
public override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath) { if (editingStyle == UITableViewCellEditingStyle.Delete) { _taskManager.RemoveItem(_taskManager.TodoItems[indexPath.Row]); tableView.DeleteRows(new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Top); } }
public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath indexPath) { var root = (RootElement)Parent.Parent; root.RadioSelected = RadioIdx; base.Selected(dvc, tableView, indexPath); }
public override UITableViewCellEditingStyle EditingStyleForRow (UITableView tableView, NSIndexPath indexPath) { var artsInSection = JaktLoggApp.instance.ArtList.Where(a => a.GroupId == 100).Count(); if(indexPath.Section == 0 && indexPath.Row == artsInSection) return UITableViewCellEditingStyle.Insert; return UITableViewCellEditingStyle.Delete; }
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath) { var cell = tableView.DequeueReusableCell("ArterTableCell"); if(cell == null) cell = new UIJaktTableViewCell(UITableViewCellStyle.Default, "ArterTableCell"); var groupId = JaktLoggApp.instance.ArtGroupList[indexPath.Section].ID; var artsInSection = JaktLoggApp.instance.ArtList.Where(a => a.GroupId == groupId); var c = artsInSection.Count(); //legg til art - knapp if(_controller.TableView.Editing && groupId == 100 && indexPath.Row == c){ cell.TextLabel.Text = Utils.Translate("specie.new"); //cell.Accessory = UITableViewCellAccessory.None; cell.ImageView.Image = null; } else { var art = artsInSection.ElementAt(indexPath.Row); var label = art.Navn; var icon = JaktLoggApp.instance.SelectedArtIds.Contains(art.ID) ? "icon_checked.png" : "icon_unchecked.png"; var file = "Images/Icons/"+icon; cell.ImageView.Image = new UIImage(file); cell.ImageView.Layer.MasksToBounds = true; cell.ImageView.Layer.CornerRadius = 5.0f; cell.TextLabel.Text = label; cell.TextLabel.TextAlignment = UITextAlignment.Left; if(!EditMode) cell.Accessory = UITableViewCellAccessory.DetailDisclosureButton; } return cell; }
Test GetTestForIndexPath (NSIndexPath indexPath) { if (indexPath.Section > 0 || indexPath.Row >= Tests.Count) return null; return Tests [indexPath.Row]; }
public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path) { if (IsReadonly) { base.Selected (dvc, tableView, path); return; } var controller = new UIViewController (); UITextView disclaimerView = new UITextView (controller.View.Frame); // disclaimerView.BackgroundColor = UIColor.FromWhiteAlpha (0, 0); // disclaimerView.TextColor = UIColor.White; // disclaimerView.TextAlignment = UITextAlignment.Left; if (!string.IsNullOrWhiteSpace (Value)) disclaimerView.Text = Value; else disclaimerView.Text = string.Empty; disclaimerView.Font = UIFont.SystemFontOfSize (16f); disclaimerView.Editable = true; controller.View.AddSubview (disclaimerView); controller.NavigationItem.Title = Caption; controller.NavigationItem.RightBarButtonItem = new UIBarButtonItem (string.IsNullOrEmpty (_saveLabel) ? "Save" : _saveLabel, UIBarButtonItemStyle.Done, (object sender, EventArgs e) => { if (OnSave != null) OnSave (this, EventArgs.Empty); controller.NavigationController.PopViewControllerAnimated (true); Value = disclaimerView.Text; }); dvc.ActivateController (controller); }
public override UITableViewCellEditingStyle EditingStyleForRow (UITableView tableView, NSIndexPath indexPath) { var section = Container.Root [indexPath.Section]; var element = section [indexPath.Row]; if (element is AddLoadMoreWithImageElement) { return UITableViewCellEditingStyle.None; } if (element is CommentElement) { var cEl = (CommentElement)element; UIComment uiComment = cEl._comment; if (uiComment.CommentOwner.Id == AppDelegateIPhone.AIphone.MainUser.Id) return UITableViewCellEditingStyle.Delete; else return UITableViewCellEditingStyle.None; } if (element is UserElementII) { var uElem = (UserElementII)element; if (uElem.Relation == RelationType.Admirers) return UITableViewCellEditingStyle.None; return UITableViewCellEditingStyle.Delete; } if (element is KeywordElement) { return UITableViewCellEditingStyle.Delete; } // trivial implementation: show a delete button always return UITableViewCellEditingStyle.None; }
public override void RowSelected(UITableView tableView, NSIndexPath indexPath) { tableView.DeselectRow(indexPath, true); if (RowSelectedAction != null) { RowSelectedAction(tableView, indexPath); } }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { var cell = tableView.DequeueReusableCell(CELL_ID, indexPath); var item = data[indexPath.Row]; cell.TextLabel.Text = item.Name; return cell; }
public override bool CanEditRow (UITableView tableView, NSIndexPath indexPath) { var section = Container.Root [indexPath.Section]; var element = section [indexPath.Row]; if (element is AddLoadMoreWithImageElement) { return true; } if (element is CommentElement) { var cEl = (CommentElement)element; UIComment uiComment = cEl._comment; return (uiComment.CommentOwner.Id == AppDelegateIPhone.AIphone.MainUser.Id); } if (element is UserElementII) { var uElem = (UserElementII)element; return (uElem.Relation != RelationType.Admirers); } if (element is KeywordElement) { return true; } //int rows = tableView.NumberOfRowsInSection(0); // Trivial implementation: we let all rows be editable, regardless of section or row return false; }
public async Task SetDetailItem (MotionActivityQuery newDetailItem) { if (detailItem != newDetailItem) detailItem = newDetailItem; configureView (); currentSteps = 0; currentActivity = "n/a"; activityDataManager.StopStepUpdates (); activityDataManager.StopMotionUpdates (); await activityDataManager.QueryAsync (detailItem); TableView.ReloadData (); if (detailItem.IsToday) { activityDataManager.StartStepUpdates ((stepCount) => { currentSteps = stepCount; var indexPaths = new NSIndexPath [] { NSIndexPath.FromRowSection (0, 1) }; TableView.ReloadRows (indexPaths, UITableViewRowAnimation.None); }); activityDataManager.StartMotionUpdates ((type) => { var indexPaths = new NSIndexPath [] { NSIndexPath.FromRowSection (4, 0) }; TableView.ReloadRows (indexPaths, UITableViewRowAnimation.None); }); } }
public override void RowSelected (UITableView tableView, NSIndexPath indexPath) { TableView.DeselectRow (indexPath, false); this.FeedReceiver.SetItemFeed(categories.GetFeedForCategory(categories.Categories[indexPath.Row])); this.NavigationController.PopViewControllerAnimated (true); }
/// <summary> /// Called by the TableView to get the actual UITableViewCell to render for the particular section and row /// </summary> public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath) { // declare vars UITableViewCell cell = tableView.DequeueReusableCell (cellIdentifier); //string item = tableItems [indexPath.Row]; //.Items[indexPath.Row]; // if there are no cells to reuse, create a new one if (cell == null) cell = new UITableViewCell (UITableViewCellStyle.Subtitle, cellIdentifier); // set the item text cell.TextLabel.Text = tableItems [indexPath.Row];//.Items[indexPath.Row].Heading; // if it's a cell style that supports a subheading, set it // if(item.CellStyle == UITableViewCellStyle.Subtitle // || item.CellStyle == UITableViewCellStyle.Value1 // || item.CellStyle == UITableViewCellStyle.Value2) // { cell.DetailTextLabel.Text = item.SubHeading; } // if the item has a valid image, and it's not the contact style (doesn't support images) // if(!string.IsNullOrEmpty(item.ImageName) && item.CellStyle != UITableViewCellStyle.Value2) // { // if(File.Exists(item.ImageName)) // cell.ImageView.Image = UIImage.FromBundle(item.ImageName); // } // set the accessory cell.Accessory = UITableViewCellAccessory.DisclosureIndicator; return cell; }
protected override object GetItemAt(NSIndexPath indexPath) { if (ItemsSource == null) return null; return ItemsSource.ElementAt(indexPath.Row); }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { var cell = tableView.DequeueReusableCell(cellIdentifier) as MonkeyCell ?? new MonkeyCell(cellIdentifier); //cell.Image = new UIImage(monkeys[indexPath.Row].Image); cell.Name = monkeys[indexPath.Row].Name; return cell; }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { var cell = tableView.DequeueReusableCell(cellIdentifier) as TransferViewCell; cell.SetData(_mainViewModel.Shl[indexPath.Row]); return cell; }
public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath) { switch (indexPath.Section) { case 0: { switch (indexPath.Row) { case 1: // hemisphere picker if (_editingHemisphere) { return 119; } else { return 0; } case 3: // speed picker if (_editingSpeed) { return 119; } else { return 0; } } } break; } return base.GetHeightForRow(tableView, indexPath); }
public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath) { // In here you could customize how you want to get the height for row. Then // just return it. return 60; }
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath) { var cell = TableView.DequeueReusableCell (new NSString ("cell"), indexPath); CKRecord record = records[indexPath.Row]; cell.TextLabel.Text = (NSString)record["name"]; return cell; }
/// <summary> /// Gets the actual UITableViewCell to render for the particular section and row /// </summary> public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath) { //---- declare vars UITableViewCell cell = tableView.DequeueReusableCell (cellIdentifier); TableItem item = indexedTableItems[keys[indexPath.Section]][indexPath.Row]; if (cell == null) { // use a Subtitle cell style here cell = new UITableViewCell (UITableViewCellStyle.Subtitle, cellIdentifier); } //---- set the item text, subtitle and image/icon cell.TextLabel.Text = item.Heading; cell.DetailTextLabel.Text = item.Album; cell.ImageView.Image = UIImage.FromFile("Images/" + item.ImageName); // if the item is marked as a favorite, use the CheckMark cell accessory // otherwise (i.e. when false) use the disclosure cell accessory if (item.Singing) { cell.Accessory = UITableViewCellAccessory.Checkmark; } else { cell.Accessory = UITableViewCellAccessory.DisclosureIndicator; } return cell; }
public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath) { var cell = (PictureBigCollectionCell)collectionView.DequeueReusableCell (PictureBigCollectionCell.CellId, indexPath); cell.resetScale (); AppDelegate.MakeImageFromURL (cell.Image, Items.Images [indexPath.Row]); return cell; }
internal ContentControl ContainerFromGroupIndex(NSIndexPath indexPath) { var container = GetSupplementaryView(ListViewSectionHeaderElementKindNS, indexPath) as ListViewBaseInternalContainer; return(container?.Content); }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { return(commonSource.GetCell(indexPath)); }
public UITableViewCell DequeueReusableCell(NSString cellKey, NSIndexPath path) { return(view.DequeueReusableCell(cellKey, path)); }
public void MoveItem(NSIndexPath path, NSIndexPath newPath) { view.MoveRow(path, newPath); }
public override void RowDeselected(UITableView tableView, NSIndexPath indexPath) { Console.WriteLine("Row " + indexPath.Row.ToString() + " deselected"); }
public override void RowSelected(UITableView tableView, NSIndexPath indexPath) { listView.NotifyItemSelected(tableItems [indexPath.Row]); Console.WriteLine("Row " + indexPath.Row.ToString() + " selected"); tableView.DeselectRow(indexPath, true); }
(NSIndexPath Path, UICollectionViewCell Cell) selector(NSIndexPath path) => (path, CellForItem(path));
private void HandleMenuLayoutPropertyChangedCore(object sender, System.ComponentModel.PropertyChangedEventArgs e) { switch (e.PropertyName) { case FolderViewModel.StatusPropertyName: this.WillChangeValue(e.PropertyName); Status = new NSString(ViewModel.Status); this.DidChangeValue(e.PropertyName); UpdateDropProgramsHint(); break; case MenuLayoutViewModel.OverlayTextPropertyName: case MenuLayoutViewModel.ShowOverlayPropertyName: this.WillChangeValue(e.PropertyName); this.DidChangeValue(e.PropertyName); this.WillChangeValue("DropProgramsHereHintText"); this.DidChangeValue("DropProgramsHereHintText"); break; case MenuLayoutViewModel.CurrentSelectionPropertyName: if (ViewModel.CurrentSelection == null) { MenuLayoutController.SelectionIndexPath = new NSIndexPath(); CommandManager.InvalidateRequerySuggested(); } else { var indexPath = new List <int>(); var currentSelection = ViewModel.CurrentSelection.Model; var parent = currentSelection.Parent; while (parent != null) { var index = parent.IndexOfChild(currentSelection); indexPath.Add(index); currentSelection = parent; parent = parent.Parent; } // add the root indexPath.Add(0); indexPath.Reverse(); var newSelectionIndexPath = NSIndexPath.Create(indexPath.ToArray()); var currentSelectionIndexPath = MenuLayoutController.SelectionIndexPath; if ((currentSelectionIndexPath == null) || (newSelectionIndexPath.Compare(currentSelectionIndexPath) != 0)) { if (NSApplication.SharedApplication.MainWindow.MakeFirstResponder(View.FindChild <NSOutlineView>())) { MenuLayoutController.SelectionIndexPath = newSelectionIndexPath; } } } break; case MenuLayoutViewModel.FolderCountPropertyName: case MenuLayoutViewModel.FileCountPropertyName: case MenuLayoutViewModel.ForkCountPropertyName: break; case MenuLayoutViewModel.OverallInUseRatioPropertyName: case MenuLayoutViewModel.OverallUsageDetailsPropertyName: this.RaiseChangeValueForKey(e.PropertyName); this.RaiseChangeValueForKey("OverallInUsePercent"); break; } View.NeedsDisplay = true; RemoveItemButton.ToolTip = ViewModel.DeleteSelectedItemTip.SafeString(); }
public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath) { return(cellHeight); }
internal SelectorItem ContainerFromIndex(NSIndexPath indexPath) { var cell = CellForItem(indexPath) as ListViewBaseInternalContainer; return(cell?.Content as SelectorItem); }
/// <summary> /// Initializes a new instance of the <see cref="T:IndoorRouting.iOS.TableRowSelectedEventArgs`1"/> class. /// </summary> /// <param name="selectedItem">Selected item.</param> /// <param name="selectedItemIndexPath">Selected item index path.</param> public TableRowSelectedEventArgs(T selectedItem, NSIndexPath selectedItemIndexPath) { this.SelectedItem = selectedItem; this.SelectedItemLabel = selectedItem.ToString(); this.SelectedItemIndexPath = selectedItemIndexPath; }
public override bool CanEditRow(UITableView tableView, NSIndexPath indexPath) { return(true); }
public override void WillDisplayCell(UICollectionView collectionView, UICollectionViewCell cell, NSIndexPath indexPath) { var index = Owner?.XamlParent?.GetIndexFromIndexPath(Uno.UI.IndexPath.FromNSIndexPath(indexPath)) ?? -1; var container = cell as ListViewBaseInternalContainer; var selectorItem = container?.Content as SelectorItem; //Update IsSelected and multi-select state immediately before display, in case either was modified after cell was prefetched but before it became visible if (selectorItem != null) { selectorItem.IsSelected = Owner?.XamlParent?.IsSelected(index) ?? false; Owner?.XamlParent?.ApplyMultiSelectState(selectorItem); } FrameworkElement.RegisterPhaseBinding(container.Content, a => RegisterForRecycled(container, a)); if (this.Log().IsEnabled(LogLevel.Debug)) { this.Log().LogDebug($"WillDisplayCell for cell at {indexPath}"); } }
/// <summary> /// Required for drag operations from a table /// </summary> public UIDragItem[] GetItemsForBeginningDragSession(UITableView tableView, IUIDragSession session, NSIndexPath indexPath) { return(model.DragItems(indexPath)); }
public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath) { using ( _trace.WriteEventActivity( TraceProvider.ListViewBaseSource_GetCellStart, TraceProvider.ListViewBaseSource_GetCellStop ) ) { // Marks this item to be materialized, so its actual measured size // is used during the calculation of the layout. // This is required for paged lists, so that the layout calculation // does not eagerly get all the items of the ItemsSource. UpdateLastMaterializedItem(indexPath); var index = Owner?.XamlParent?.GetIndexFromIndexPath(Uno.UI.IndexPath.FromNSIndexPath(indexPath)) ?? -1; var identifier = GetReusableCellIdentifier(indexPath); var listView = (NativeListViewBase)collectionView; var cell = (ListViewBaseInternalContainer)collectionView.DequeueReusableCell(identifier, indexPath); using (cell.InterceptSetNeedsLayout()) { var selectorItem = cell.Content as SelectorItem; if (selectorItem == null || // If it's not a generated container then it must be an item that returned true for IsItemItsOwnContainerOverride (eg an // explicitly-defined ListViewItem), and shouldn't be recycled for a different item. !selectorItem.IsGeneratedContainer) { cell.Owner = Owner; selectorItem = Owner?.XamlParent?.GetContainerForIndex(index) as SelectorItem; cell.Content = selectorItem; if (this.Log().IsEnabled(Microsoft.Extensions.Logging.LogLevel.Debug)) { this.Log().Debug($"Creating new view at indexPath={indexPath}."); } FrameworkElement.InitializePhaseBinding(selectorItem); // Ensure the item has a parent, since it's added to the native collection view // which does not automatically sets the parent DependencyObject. selectorItem.SetParent(Owner?.XamlParent?.InternalItemsPanelRoot); } else if (this.Log().IsEnabled(Microsoft.Extensions.Logging.LogLevel.Debug)) { this.Log().Debug($"Reusing view at indexPath={indexPath}, previously bound to {selectorItem.DataContext}."); } Owner?.XamlParent?.PrepareContainerForIndex(selectorItem, index); // Normally this happens when the SelectorItem.Content is set, but there's an edge case where after a refresh, a // container can be dequeued which happens to have had exactly the same DataContext as the new item. cell.ClearMeasuredSize(); } Owner?.XamlParent?.TryLoadMoreItems(index); return(cell); } }
internal void ReloadData() { _lastMaterializedItem = NSIndexPath.FromRowSection(0, 0); }
public override void WillDisplayNodeForRowAtIndexPath(ASTableView tableView, NSIndexPath indexPath) { if (_source == null) { var table = tableView as ASTableView; _source = table.TableNode.DataSource as GroupedTableDataSource <DateTimeOffset, ChatMessageViewModel>; } var count = _source.DataSource[0].Count; if (indexPath.Section == _source.DataSource.Count - 1 && indexPath.Row == count - 1) { LastItemRequested?.Invoke(this, EventArgs.Empty); } }
/// <summary> /// Is item in the range of already-materialized items? /// </summary> private bool IsMaterialized(NSIndexPath itemPath) => itemPath.Compare(_lastMaterializedItem) <= 0;
protected void NavigationItemSelected(NSIndexPath indexPath) { int index = GetIndex(indexPath); NavigationItemSelected(index); }
public override void CellDisplayingEnded(UICollectionView collectionView, UICollectionViewCell cell, NSIndexPath indexPath) { var key = cell as ListViewBaseInternalContainer; if (_onRecycled.TryGetValue(key, out var actions)) { foreach (var a in actions) { a(); } _onRecycled.Remove(key); } if (this.Log().IsEnabled(LogLevel.Debug)) { this.Log().LogDebug($"CellDisplayingEnded for cell at {indexPath}"); } }
public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path) { base.Selected(dvc, tableView, path); if (Tapped != null) { Tapped(); } tableView.DeselectRow(path, true); }
public override void RowSelected(UITableView tableView, NSIndexPath indexPath) { var cell = tableView.CellAt(indexPath) as ProductCell; mBuyCreditsView.ViewModel.GotoDetailsCommand.Execute(cell.ViewModel); }
protected override UICollectionViewCell GetOrCreateCellFor(UICollectionView collectionView, NSIndexPath indexPath, object item) { return(collectionView.DequeueReusableCell(ImageViewCell.Key, indexPath) as UICollectionViewCell); }
public override void RowDeselected(UITableView tableView, NSIndexPath indexPath) { DeselecetdItemAction?.Invoke(indexPath.Row); }
public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath) { iOSViewCell cell = (iOSViewCell)collectionView.DequeueReusableCell(nameof(iOSViewCell), indexPath); var dataContext = _dataSource[indexPath.Row]; if (dataContext != null) { var dataTemplate = _view.ItemTemplate; ViewCell viewCell; var selector = dataTemplate as DataTemplateSelector; if (selector != null) { var template = selector.SelectTemplate(_dataSource[indexPath.Row], _view.Parent); viewCell = template.CreateContent() as ViewCell; } else { viewCell = dataTemplate?.CreateContent() as ViewCell; } cell.UpdateUi(viewCell, dataContext, _view); } return(cell); }
public override void ItemSelected(UICollectionView collectionView, NSIndexPath indexPath) { (this.itemView.DataContext as TimelineItemViewModel).ImageSelected?.Execute(indexPath.Row); }
public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath) { var reuseId = DetermineViewReuseId(elementKind); var view = collectionView.DequeueReusableSupplementaryView(elementKind, reuseId, indexPath) as UICollectionReusableView; switch (view) { case DefaultCell defaultCell: UpdateDefaultSupplementaryView(defaultCell, elementKind, indexPath); break; case TemplatedCell templatedCell: UpdateTemplatedSupplementaryView(templatedCell, elementKind, indexPath); break; } return(view); }
/// <summary> /// Reloads a single row /// </summary> public void ReloadSingleRow(NSIndexPath indexPath) { tableView.ReloadRows(new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Fade); }
public override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath) { if (editingStyle == UITableViewCellEditingStyle.Delete) { string name = scripts[indexPath.Row]; // Delete the row from the data source. scripts.RemoveAt(indexPath.Row); Store.RemoveFile(name); if (controller.ScriptViewController?.ScriptName == name) { controller.ScriptViewController.SetScript(null); } controller.TableView.DeleteRows(new[] { indexPath }, UITableViewRowAnimation.Fade); } else if (editingStyle == UITableViewCellEditingStyle.Insert) { // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view. } }
void UpdateTemplatedSupplementaryView(TemplatedCell cell, NSString elementKind, NSIndexPath indexPath) { DataTemplate template = elementKind == UICollectionElementKindSectionKey.Header ? ItemsView.GroupHeaderTemplate : ItemsView.GroupFooterTemplate; var bindingContext = ItemsSource.Group(indexPath); cell.Bind(template, bindingContext, ItemsView); if (cell is ItemsViewCell) { cell.ConstrainTo(ItemsViewLayout.ConstrainedDimension); } }