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