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-Dialoag-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

Reply via email to