Unfortunately the FirstFloor.ModernUI.Windows.Controls.ModernDialog class is usefull only to show simple text (alert dialog).
The following function helps you to create a custom dialog box using the ModernDialog class.
/// <summary>Simple input dialog box</summary> /// <returns>null if the dialog box was closed with "cancel",
/// otherwise the user input<returns>
public static string ShowInputDialog(string initialText=null)
{
// create the dialog content
TextBox content = new TextBox();
content.Text = initialText;
// create the ModernUI dialog component with the buttons
var dlg = new ModernDialog
{
Title = "Insert a text",
Content = content,
MinHeight = 0,
MinWidth = 0,
MaxHeight = 480,
MaxWidth = 640,
};
dlg.Buttons = new Button[] { dlg.OkButton, dlg.CancelButton };
// register the event to retrieve the result of the dialog box
string result = null;
dlg.OkButton.Click += (object sender, RoutedEventArgs e) =>
{
result = content.Text;
};
dlg.ShowDialog();
return result;
}