-api-id | -api-type |
---|---|
M:Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilder.AddTextBox(System.String,System.String,System.String) |
winrt method |
Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilder.AddTextBox(System.String,System.String,System.String)
Adds a text box with the specified placeholder text and title to the XML payload for an app notification.
The ID of the text box.
The placeholder text displayed in the text box.
The title text which is displayed above the text box.
Returns the AppNotificationBuilder instance so that additional method calls can be chained.
Up to five input controls can be added to a single notification.
For guidance on using the AppNotificationBuilder APIs to create the UI for app notifications, see App notification content.
For reference information about the XML schema for app notifications, see App notification content schema.
The following example demonstrates adding a text box to the XML payload for an app notification.
var notification = new AppNotificationBuilder()
.AddText("Notification text.")
.AddTextBox("textBox", "Placeholder text", "Title")
.BuildNotification();
AppNotificationManager.Default.Show(notification);
The resulting XML payload:
<toast>
<visual>
<binding template='ToastGeneric'>
<text>Notification text.</text>
</binding>
</visual>
<actions>
<input id='textBox' type='text' placeHolderContent='Placeholder text' title='Title'/>
</actions>
</toast>