Appracatappra is proud to present the latest version of ActionAlert, v01.02. This release adds the ability to replace the Description text area of the alert with any subview of your choosing. That subview, in turn, can have it’s own subviews.

Here is an example of using the new feature:

Custom Subview Alert

ActionAlert now supports attaching a custom subview to the alert in place of the description area. Here is an example of adding a text edit box to an alert:

iOS Example

// Build a custom view for this alert
UITextField field1 = new UITextField (new RectangleF (13, 41, 278, 29)) {
    BorderStyle = UITextBorderStyle.RoundedRect,
    TextColor = UIColor.DarkGray,
    Font = UIFont.SystemFontOfSize (14f),
    Placeholder = "Name",
    Text = "DefaultValue",
    BackgroundColor = UIColor.White,
    AutocorrectionType = UITextAutocorrectionType.No,
    KeyboardType = UIKeyboardType.Default,
    ReturnKeyType = UIReturnKeyType.Done,
    ClearButtonMode = UITextFieldViewMode.WhileEditing,
    Tag = 0,
    Enabled = true
};
field1.ShouldReturn = delegate (UITextField field){
    field.ResignFirstResponder ();
    return true;
};
field1.ShouldEndEditing= delegate (UITextField field){
    field.ResignFirstResponder ();
    return true;
};

// Create the new alert and attach the new field
_alert = new UIActionAlert (UIActionAlertType.Subview, UIActionAlertLocation.Middle, "Custom Subview", field1, "Cancel,OK");
_alert.Show ();

// Respond to any button being tapped
_alert.ButtonReleased += (button) => {
    field1.ResignFirstResponder ();
    _alert.Hide();
};

Android Example

// Create subview
var lp = new RelativeLayout.LayoutParams (278, 50);
var flp = new RelativeLayout.LayoutParams (278, 50);
var rl = new RelativeLayout (this);
var field1 = new EditText (this);

// Initialize subview
rl.LayoutParameters = lp;

// Initialize field and add to subview
flp.TopMargin = 0;
flp.RightMargin = 0;
field1.LayoutParameters = flp;
field1.Text = "Default Value";
rl.AddView (field1);

// Create alert
_alert = new UIActionAlert (this, UIActionAlertType.Subview, UIActionAlertLocation.Middle, "Custom Subview", rl, "Cancel,OK");
_alert.Show ();

// Respond to any button being tapped
_alert.ButtonReleased += (button) => {
    _alert.Hide();
};

UPDATE: Action Alert is available as part of the Action Component Suite for the Xamarin platform and Visual Studio.