Skip to content

Latest commit

 

History

History
73 lines (46 loc) · 1.96 KB

appnotificationbuilder_addtextbox_30178730.md

File metadata and controls

73 lines (46 loc) · 1.96 KB
-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)

-description

Adds a text box with the specified placeholder text and title to the XML payload for an app notification.

-parameters

-param id

The ID of the text box.

-param placeHolderText

The placeholder text displayed in the text box.

-param title

The title text which is displayed above the text box.

-returns

Returns the AppNotificationBuilder instance so that additional method calls can be chained.

-remarks

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.

-see-also

-examples

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>