Table of Contents

Class KeyboardInput

Namespace
Microsoft.Xna.Framework.Input
Assembly
MonoGame.Framework.dll
public static class KeyboardInput
Inheritance
KeyboardInput
Inherited Members

Properties

IsVisible

public static bool IsVisible { get; }

Property Value

bool

Methods

Cancel(string)

Hides the keyboard input interface and returns the parameter as the result of Show(string, string, string, bool)

public static void Cancel(string result)

Parameters

result string

Result to return

Examples

var nameTask = KeyboardInput.Show("Name", "What's your name?", "Player");
KeyboardInput.Cancel("John Doe");
var name = await nameTask;

Exceptions

Exception

Thrown when the keyboard input is not visible

Show(string, string, string, bool)

Displays the keyboard input interface asynchronously.

public static Task<string> Show(string title, string description, string defaultText = "", bool usePasswordMode = false)

Parameters

title string

Title of the dialog box.

description string

Description of the dialog box.

defaultText string

Default text displayed in the input area.

usePasswordMode bool

If password mode is enabled, the characters entered are not displayed.

Returns

Task<string>

Text entered by the player. Null if back was used.

Examples

var name = await KeyboardInput.Show("Name", "What's your name?", "Player");

Exceptions

Exception

Thrown when the message box is already visible