MonoTouch.Dialog.Section.Insert C# (CSharp) Method

Insert() public method

public Insert ( int idx, UITableViewRowAnimation anim, IEnumerable newElements ) : int
idx int
anim UITableViewRowAnimation
newElements IEnumerable
return int
		public int Insert (int idx, UITableViewRowAnimation anim, IEnumerable<Element> newElements)
		{
			if (newElements == null)
				return 0;

			int pos = idx;
			int count = 0;
			foreach (var e in newElements){
				Elements.Insert (pos++, e);
				e.Parent = this;
				count++;
			}
			var root = Parent as RootElement;
			if (root != null && root.TableView != null){				
				if (anim == UITableViewRowAnimation.None)
					root.TableView.ReloadData ();
				else
					InsertVisual (idx, anim, pos-idx);
			}
			return count;
		}
		

Same methods

Section::Insert ( int index ) : void
Section::Insert ( int idx, UITableViewRowAnimation anim ) : void

Usage Example

示例#1
0
		public void DemoLoadMore () 
		{
			Section loadMore = new Section();
			loadMore.Add(new StringElement("Element 1"));
			loadMore.Add(new StringElement("Element 2"));
			loadMore.Add(new StringElement("Element 3"));
						
			
			loadMore.Add (new LoadMoreElement("Load More Elements...", "Loading Elements...", lme => {
				// Launch a thread to do some work
				ThreadPool.QueueUserWorkItem (delegate {
					
					// We just wait for 2 seconds.
					System.Threading.Thread.Sleep(2000);
				
					// Now make sure we invoke on the main thread the updates
					navigation.BeginInvokeOnMainThread(delegate {
						lme.Animating = false;
						loadMore.Insert(loadMore.Count - 1, new StringElement("Element " + (loadMore.Count + 1)),
				    		            new StringElement("Element " + (loadMore.Count + 2)),
				            		    new StringElement("Element " + (loadMore.Count + 3)));
					
					});
				});
				
			}, UIFont.BoldSystemFontOfSize(14.0f), UIColor.Blue));
							
			var root = new RootElement("Load More") {
				loadMore
			};
			
			var dvc = new DialogViewController (root, true);
			navigation.PushViewController (dvc, true);
		}
All Usage Examples Of MonoTouch.Dialog.Section::Insert