iOS Guides | Samples

MonoTouch.Dialog Namespace

Simplified creation of user interfaces.

Remarks

MonoTouch.Dialog is a foundation to create dialog boxes and show table-based information without having to write dozens of delegates and controllers for the user interface. MonoTouch.Dialog is a retained system for implementing UITableViews as opposed to the on-demand nature of UITableView.

The infrastructure provides many conveniences that allow developers to create dashing UITableView-based user interfaces with a fraction of the effort. It features a big collection of custom cell renderers and features like pull-to-refresh and built-in search.

This code snippet generates the following UI:

c# Example

return new RootElement ("Settings") {
    new Section (){
        new BooleanElement ("Airplane Mode", false),
        new RootElement ("Notifications", 0, 0) {
            new Section (null, 
                 "Turn off Notifications to disable Sounds\n" +
                     "Alerts and Home Screen Badges for the\napplications below."){
                new BooleanElement ("Notifications", false)
            }
        }},
    new Section (){
    new RootElement ("Sounds"){
            new Section ("Silent") {
                new BooleanElement ("Vibrate", true),
            },
            new Section ("Ring") {
                new BooleanElement ("Vibrate", true),
                new FloatElement (null, null, 0.8f),
                new RootElement ("Ringtone", new RadioGroup (0)){
                    new Section ("Custom"){
                        new RadioElement ("Circus Music"),
                        new RadioElement ("True Blood"),
                    },
                    new Section ("Standard"){
            from name in "Marimba,Alarm,Ascending,Bark".Split (',')
            (Element) new RadioElement (n)
                    }
                },
                new RootElement ("New Text Message", new RadioGroup (3)){
                    new Section (){
            from name in "None,Tri-tone,Chime,Glass,Horn,Bell,Electronic".Split (',')
            (Element) new RadioElement (n)
                    }
                },
                new BooleanElement ("New Voice Mail", false),
                new BooleanElement ("New Mail", false),
                new BooleanElement ("Sent Mail", true),
            }
        },
        new RootElement ("Brightness"){
            new Section (){
                new FloatElement (null, null, 0.5f),
                new BooleanElement ("Auto-brightness", false),
            }
        },
        new RootElement ("Wallpaper"){ MakeWallPaper (); }
    },
    new Section () {
        new EntryElement ("Login", "Your login name", "miguel"),
        new EntryElement ("Password", "Your password", "password", true),
        new DateElement ("Select Date", DateTime.Now),
    },
}

MonoTouch.Dialog core entry point is a UIViewController called the DialogViewController. You initialize instances of this object from an object of type RootElement or JsonElement.

We have included a version of MonoTouch.Dialog with MonoTouch, but we have renamed the assembly to MonoTouch.Dialog-1.dll to prevent any problems with users that might have a modified copy of MonoTouch.Dialog or have an existing working setup from being altered.

To use MonoTouch.Dialog with your project, merely add a reference to MonoTouch.Dialog-1.dll from the Edit Reference menu item in your project.

If you want to use your own copy of MonoTouch.Dialog, you can still use the publicly available MonoTouch.Dialog or your own forked version of it.

Classes

TypeReason
ActivityElementAn element that can be used to show an activity indicator.
AlignmentAttributeApply this attribute to properties and fields to instruct the BindingContext how it should align the text on the row.
BadgeElement This element can be used to show an image with some text
BaseBooleanImageElement This class is used to render a string + a state in the form of an image.
BaseBooleanImageElement+TextWithImageCellViewCustom UITableViewCell to display text with an image (used by the BaseBooleanImageElement).
BindingContextHelper class used to map Structures and Classes into user interface elements in MonoTouch.Dialog.
BooleanElement Used to display switch on the screen.
BooleanImageElementThis class is used to render a string + a state in the form of an image.
BoolElementBase class for BoolElement and BaseBooleanImageElement
CaptionAttributeOn Reflection-based UIs, this attribute can be applied to a member to set the caption for the element.
CheckboxAttributeOn Reflection-based UIs, this attribute can be applied to boolean values to use a checkbox to render the boolean value.
CheckboxElementAn element that can be used as a checkbox
DateAttributeAttribute applied to DateTime objects to instruct the rendering to be done using the Date selector.
DateElementAn element that can be used to edit dates.
DateTimeElementAn element that can be used to edit dates and times.
DialogViewControllerThe DialogViewController is the main entry point to use MonoTouch.Dialog, it provides a simplified API to the UITableViewController.
DialogViewController+SearchTextEventHandler
DialogViewController+SizingSourceDefault UITableViewSource used by MonoTouch.Dialog when the elements contained are expected to have different heights.
DialogViewController+SourceDefault UITableViewSource used by MonoTouch.Dialog when all of the elements contained have a constant height.
Element Base class for all elements in MonoTouch.Dialog
EntryAttributeApply this attribute to strings to produce an editing row.
EntryElement An element that can be used to enter text.
FloatElement Used to display a slider on the screen.
GlassButton GlassButton is a glossy/glass button. User code can use either targets or can subscribe to the Tapped event. Colors are customized by asssigning to the NormalColor, HighlightedColor and DisabledColor properties
GraphicsUtilGraphics utilities used by MonoTouch.Dialog elements
Group Used by root elements to fetch information when they need to render a summary (Checkbox count or selected radio group).
HtmlAttribute
HtmlElement Used to display a cell that will launch a web browser when selected.
IColorizeBackground This interface is implemented by Elements that needs to update their cells Background properties just before they are displayed to the user. This is an iOS 3 requirement to properly render a cell.
IElementSizing This interface is implemented by Element classes that will have different heights
ImageElementElement to pick images from the local photo library.
ImageStringElementAn element that displays an thumbnail image with a string, not stylable.
JsonElementRootElement that is instantiated from a Json source.
LoadMoreElementAn element that amimates when tapped indicating that more data is being loaded.
MessageElementElement to display a mail message-like record with sender, subject, date, read/unread statuses.
MessageSummaryView
MultilineAttribute
MultilineElement
OnTapAttribute
OwnerDrawnElement
PasswordAttribute
RadioElement
RadioGroup Captures the information about mutually exclusive elements in a RootElement
RadioSelectionAttribute
RangeAttribute
RefreshTableHeaderView
RefreshViewStatus
RootElement RootElements are responsible for showing a full configuration page.
SearchChangedEventArgs
Section Sections contain individual Element instances that are rendered by MonoTouch.Dialog
SectionAttributeOn Reflection-based UIs, this attribute can be applied to a member to start a new section.
SkipAttributeApply this attribute to a Property or Field to have the BindingContext ignore this object when generating the UI
StringElement The string element can be used to render some text in a cell that can optionally respond to tap events.
StyledMultilineElement
StyledStringElement A version of the StringElement that can be styled with a number of formatting options and can render images or background images either from UIImage parameters or by downloading them from the net.
TimeAttributeAttribute applied to DateTime objects to instruct the rendering to be done using the Time selector.
TimeElementAn element that can be used to edit times
UIViewElement This element can be used to insert an arbitrary UIView
UIViewElement+CellFlags