-
Notifications
You must be signed in to change notification settings - Fork 3
Dialogs
Vetle444 edited this page Mar 12, 2025
·
1 revision
Dialogs are used to interact with users, gather information, or display important messages. They help in guiding users through tasks, confirming actions, and providing feedback.
In this library, a DialogService
is provided to easily display such a dialog.
A message dialog is a type of user interface element that displays a message to the user. It typically appears as a small window or pop-up that contains text and buttons for user interaction.
Here are some common characteristics of message dialogs:
- Title: A brief heading that indicates the purpose of the dialog.
- Message: The main content, which provides information or instructions to the user.
- Buttons: Options for the user to respond, such as "OK", "Cancel", "Yes", "No".
Example:
DialogService.ShowMessage(config =>
{
config.SetTitle("Test");
config.SetDescription("Testing");
config.SetActionTitle("Ok");
}
An Input Dialog extends the MessageDialog, allowing you to implement input fields into the message dialog.
var response = DialogService.ShowInputDialog(config =>
{
config.SetTitle("Test");
config.SetDescription("Testing");
config.AddInputField(new StringDialogInputField("Placeholder"));
});
To check the users' input after pressing the action button:
var response = await DialogService.ShowInputDialog(config =>
{
config.SetTitle("Test");
config.SetDescription("Testing");
config.AddInputField(new StringDialogInputField("Placeholder"));
});
if(response.DialogInputs.First() is StringDialogInputField inputField)
{
var value = inputField.Value;
// Do something with value
}
or
var inputField = new StringDialogInputField("Placeholder");
var response = await DialogService.ShowInputDialog(config =>
{
config.SetTitle("Test");
config.SetDescription("Testing");
config.AddInputField(inputField);
});
var value = inputField.Value;
// Do something with the value
Head on over to DialogService for futher inspection.