Page.DisplayPromptAsync Method

Definition

Displays a prompt dialog to the application user with the intent to capture a single string value.

public System.Threading.Tasks.Task<string> DisplayPromptAsync (string title, string message, string accept = "OK", string cancel = "Cancel", string placeholder = default, int maxLength = -1, Microsoft.Maui.Keyboard keyboard = default, string initialValue = "");
member this.DisplayPromptAsync : string * string * string * string * string * int * Microsoft.Maui.Keyboard * string -> System.Threading.Tasks.Task<string>
Public Function DisplayPromptAsync (title As String, message As String, Optional accept As String = "OK", Optional cancel As String = "Cancel", Optional placeholder As String = Nothing, Optional maxLength As Integer = -1, Optional keyboard As Keyboard = Nothing, Optional initialValue As String = "") As Task(Of String)

Parameters

title
String

The title of the prompt dialog.

message
String

The body text of the prompt dialog.

accept
String

Text to be displayed on the 'Accept' button.

cancel
String

Text to be displayed on the 'Cancel' button.

placeholder
String

The placeholder text to display in the prompt. Can be null when no placeholder is desired.

maxLength
Int32

The maximum length of the user response.

keyboard
Keyboard

The keyboard type to use for the user response.

initialValue
String

A pre-defined response that will be displayed, and which can be edited by the user.

Returns

A Task that displays a prompt display and returns the string value as entered by the user.

Applies to