If you are inside something which is in a UINavigationController (and usually, with a dialogviewcontroller, you are), you can push a new view onto the stack (whch gives you the back button).
I do this in the sample code for the Xamarin Xaminar I did on thursday https://github.com/nicwise/xaminar-uiappearance (Chris is going to move it to the official Xamarin github sometime soon, I think) That might give you some ideas :) On Sun, Jul 1, 2012 at 7:08 PM, Condron, Chuck <[email protected]> wrote: > Yes I am definitely playing around, just trying to modify the Xamarin > walkthrough. What I really want is a button on the main screen, titled "Get > Boards" > Then when you click that up comes another screen with all of the boards > listed... > > I am not sure of the best way to launch a second screen to do this from a > button. I did use PresentModalViewController(thenameofmycontroller, true); > But I didn’t have a back button... > > Im only about 2 weeks into Monotouch ...newbie > > > -----Original Message----- > From: Nic Wise [mailto:[email protected]] > Sent: Sunday, July 01, 2012 6:41 AM > To: Condron, Chuck > Cc: [email protected] > Subject: Re: [MonoTouch] Trying to create a MonoTouch.Dialoag based on a > dataset > > A couple of things: > > 1. I thought that BindingContext only worked on a single object, eg: > > public class Board > { > public string Name { get; set; } > public string Address {get; set;} > } > > And it then makes a form with a field for each one - but it doesn't work on a > LIST of anything. > > You may have to do it manually, so: > > RootElement newroot = new RootElement("Boards"); var section = new Section(); > foreach(var board in _boardList) { > section.Add(new StringElement(board.Name)); //see note below > > } > newroot.Add(section); > > var dvc = new DialogViewController (newroot); _nav = new > UINavigationController (dvc); //... etc > > ** you may want to use something other than a StringElement, which is fairly > boring, for display. You may even want to make your own Element! :) > > 2. Unless you are just hacking around to see how it works, you should REALLY > not be doing a big network call etc in FinishedLaunching. If it takes too > long (15 seconds, sometimes a little more or less) your app will just be > killed. Keeping things off the main thread is a good habit to get into. You > could subclass DialogViewController and do that network loading in the > ViewDidLoad or ViewWillAppear methods (or LoadView, there are lots of options > :) ) > > Of course, if you are just hacking around and finding out how to do things, > that a fair way to start :) > > Cheers > > Nic > > > On Sun, Jul 1, 2012 at 5:35 AM, vulcanCCIT <[email protected]> > wrote: >> I have a web service that returns a dataset with a list of billboard >> names, ip addresses, street addresses, etc.. >> >> I thought I could pull down the dataset from the web service add each >> board to a List<Boards> and then bind the list to the dialog. >> >> Boards is a class with just a bunch of strings representing each >> element of the board as in it's board name. >> >> after compile, it errors on this line: >> var bctx = new BindingContext (null, _boardList, "Boards"); >> complaining that _boardlist is not an intense of an object. >> >> it works if I bind it to a Boards object, but not if I bind to a List >> of Boards. >> >> >> >> >> here is what I have now: >> >> using System; >> using System.Collections.Generic; >> using System.Linq; >> using System.Data; >> >> using MonoTouch.Dialog; >> using MonoTouch.Foundation; >> using MonoTouch.UIKit; >> >> namespace DBBTest >> { >> // The UIApplicationDelegate for the application. This class >> is responsible for launching the >> // User Interface of the application, as well as listening >> (and optionally >> responding) to >> // application events from iOS. >> [Register ("AppDelegate")] >> public partial class AppDelegate : UIApplicationDelegate >> { >> // class-level declarations >> UIWindow _window; >> UINavigationController _nav; >> List<Boards> _boardList = new List<Boards>(); >> >> // >> // This method is invoked when the application has >> loaded and is ready to run. In this >> // method you should instantiate the window, load the >> UI into it and then make the window >> // visible. >> // >> // You have 17 seconds to return from this method, or >> iOS will terminate your application. >> // >> public override bool FinishedLaunching (UIApplication >> app, NSDictionary >> options) >> { >> _window = new UIWindow (UIScreen.MainScreen.Bounds); >> //var boardElement = new RootElement("Boards"){new >> Section()}; >> DataSet ds = new DataSet(); >> Dbb.Service1 dbb = new Dbb.Service1 (); >> ds = dbb.GetBoards ("Phoenix", ""); >> >> foreach (DataTable table in ds.Tables) >> { >> foreach(DataRow row in table.Rows) >> { >> Boards board = new Boards (); >> >> board._boardName = >> row[0].ToString();//board name >> boardList.Add(board); >> } >> } >> >> var bctx = new BindingContext (null, _boardList, >> "Boards"); >> var dvc = new DialogViewController (bctx.Root); >> _nav = new UINavigationController (dvc); >> >> _window.RootViewController = _nav; >> _window.MakeKeyAndVisible (); >> >> return true; >> } >> } >> } >> >> -- >> View this message in context: >> http://monotouch.2284126.n4.nabble.com/Trying-to-create-a-MonoTouch-Di >> aloag-based-on-a-dataset-tp4655684.html >> Sent from the MonoTouch mailing list archive at Nabble.com. >> _______________________________________________ >> MonoTouch mailing list >> [email protected] >> http://lists.ximian.com/mailman/listinfo/monotouch > > > > -- > Nic Wise > t. +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise > b. http://www.fastchicken.co.nz/ > > Earnest: Self-employed? Track your business expenses and income. > http://earnestapp.com > Nearest Bus: find when the next bus is coming to your stop. > http://goo.gl/Vcz1p mobileAgent (for FreeAgent): get your accounts in your > pocket. > http://goo.gl/IuBU > Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa London > Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2 -- Nic Wise t. +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise b. http://www.fastchicken.co.nz/ Earnest: Self-employed? Track your business expenses and income. http://earnestapp.com Nearest Bus: find when the next bus is coming to your stop. http://goo.gl/Vcz1p mobileAgent (for FreeAgent): get your accounts in your pocket. http://goo.gl/IuBU Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa London Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2 _______________________________________________ MonoTouch mailing list [email protected] http://lists.ximian.com/mailman/listinfo/monotouch
