Suggested Actions

Adding the SuggestedAction

Conversational UI supports adding suggestions to the user. This can be done by adding SuggestedAction items to the SuggestedActions collection of RadChat.

Example 1: Adding SuggestedAction

        var textMessage = new TextMessage(this.currentAuthor, "Hello", "sent"); 
        textMessage.InlineViewModel.StatusVisibility = Visibility.Visible; 
 SuggestedAction("Hi there!")); 
Adding the SuggestedAction will be visualized as shown in the figure below.

Figure 1: Adding a SuggestedAction

Adding a SuggestedAction

By default the SuggestedActions will be visible. In case they need to be hidden, the SuggestedActionsVisibility of RadChat can be set to Collapsed.

Handling the SuggestedActionReported event

When the user selects a given suggestion, the SuggestedActionReported is raised. Through it the user input can be modified. Its arguments expose the following members.

  • CloseAfterReport: A boolean property that controls whether the message will be removed after it reports a result.
  • PostResultInline: A boolean property that determines whether the suggestion should be posted as an inline text message or not.
  • Text: The text result.

Example 2: Handling the SuggestedActionReported event

 private void Chat_SuggestedActionReported(object sender, SuggestedActionsEventArgs e) 
        if (e.Text == "Hi there!") 
            e.Text = this.otherAuthor.Name + ", " + e.Text; 
            e.CloseAfterReport = false; 
            e.PostResultInline = true; 

Figure 1: Handling the SuggestedActionReported event

Handling the SuggestedActionReported event

See Also

In this article
Not finding the help you need? Improve this article