3

I have an element in my Monotouch.Dialog Controller that discloses a list of possible selections (RadioGroup with many RadioElements). If one of the elements is picked, I pop one controller of my stack and the element that showed the subitems now shows the selected item’s value.

However, if the dialog gets initialized I want to set the element's current value. I tried setting the section's "Selected" property but that does not seem to do the trick.

I noticed that the RadioGroup constructor has an index that allows selecting but how can I change the selection afterwards?

Krumelur
  • 32,180
  • 27
  • 124
  • 263
  • Maybe I'm not understanding it correctly but it seems that MT.D samples (on github) has a few uses that are identical to this ? If not then maybe some code will help us (or at least me ;-) understand your issue. https://github.com/migueldeicaza/MonoTouch.Dialog/tree/master/Sample – poupou Mar 02 '12 at 01:18
  • Not really. See demoElementApi.cs. It has some RadioGroups but the preselected item is always constant. Some RadioGroup constructors are initialized with index 0 others with 2, preselecting the corresponding item. What I want: my radio groups and options are already there. I don't know which one is selected when they get constructed. I want to select one of the possible elements later. Clearer now? Let's say the selection of one radio group is supposed to change if the user toggles a Boolean element for instance. – Krumelur Mar 02 '12 at 07:34

1 Answers1

3

Finally found it. Well hidden in the RootElement. The property is "RadioSelected".

Krumelur
  • 32,180
  • 27
  • 124
  • 263
  • Any chance of posting a code snippet to see how you've done this? i'm looking in to the same issue. – Buzzrick Oct 07 '13 at 01:05
  • var `radioRoot = new RootElement ("Some Radio Root", new RadioGroup (0));`- then add some `RadioElements` - then preselect 2nd radio element: `radioRoot.RadioSelected = 2;` – Krumelur Oct 07 '13 at 06:50