Brian David Berman
Brian David Berman

Reputation: 7694

Dropdown (combobox) in MonoTouch.Dialog with Elements API?

I know it's easily doable in the MonoTouch.Dialog High-Level Reflection API by simply using an Enum, but how can this be done with the Low-Level Elements API? I can't seem to figure out a way to provide a data source to an EntryElement item. Am I going about this wrong?

Upvotes: 1

Views: 704

Answers (1)

miguel.de.icaza
miguel.de.icaza

Reputation: 32694

You can look at how the Reflection API does that, it is actually very simple, it merely creates a RootElement and then populates it with the various values that it needs.

Something like this:

var section = new Section ("My Section");
for (int i = 0; i < 32; i++){
    section.Add (new RadioElement ("Element " + i));
}

var myRadio = new RootElement ("My Radio", new RadioGroup (null, 0)) { 
   section 
};

Upvotes: 2

Related Questions