2

I am new to iPhone development. I am using Monotouch.Dialog for iPhone application.

We can create a StyledStringElement that shows a Subtitle.

I would like to show a CheckboxElement with subtitle. Is that possible?

Thanks in advance.

poupou
  • 43,413
  • 6
  • 77
  • 174
Ravindra
  • 21
  • 1

1 Answers1

3

Yes, you will have to either:

(a) inherit either StyledStringElement or CheckboxElement and copy-paste the required code from the other one. Useful if you need many of such elements in your application.

(b) directly add some code in the element (in case you only need one of them), like:

var checked_styled_element = new StyledStringElement ("Checked", "value");
checked_styled_element.Tapped += () => {
    checked_styled_element.Accessory = (checked_styled_element.Accessory == UITableViewCellAccessory.Checkmark) ? UITableViewCellAccessory.None : UITableViewCellAccessory.Checkmark;
    checked_styled_element.GetImmediateRootElement ().Reload (checked_styled_element, UITableViewRowAnimation.None);
};
poupou
  • 43,413
  • 6
  • 77
  • 174
  • Thank you poupou. This works perfectly fine for a single element. But fails if I use it in a loop for multiple elements. Can you please guide me make it working in a loop? Thanks. – Ravindra Nov 11 '11 at 05:38
  • If you have several elements that requires this then do **(a)**, not **(b)** - it will be much cleaner this way. – poupou Nov 11 '11 at 12:47