# Suggested Actions

`RadChat` supports adding suggestions to the user. This can be done by adding `SuggestedAction` items to its `SuggestedActions` collection.

## Adding a SuggestedAction

The following example demonstrates how to add a `TextMessage` and populate the SuggestedActions collection of the RadChat.

#### **Adding SuggestedAction**

```C#
public class MainWindow : Window
{
	private Author currentAuthor;
	private Author otherAuthor;

	public MainWindow()
	{
		InitializeComponent();

		this.currentAuthor = new Author("Stenly");
		this.otherAuthor = new Author("Steven");
		this.chat.CurrentAuthor = currentAuthor;

		var textMessage = new TextMessage(this.currentAuthor, "Hello", "sent");
		textMessage.InlineViewModel.StatusVisibility = Microsoft.UI.Xaml.Visibility.Visible;

		this.chat.AddMessage(textMessage);

		this.chat.SuggestedActions.Add(new SuggestedAction("Hi, there!"));
	}
}
```

**RadChat with a SuggestedAction**

![RadChat with a SuggestedAction](https://www.telerik.com/winui/documentation/assets/080b924cbbfe7e4507ef1b50018a33bc/radchat-suggested-action-0.png)

> By default the entries of the `SuggestedActions` collection will be visible. In case they need to be hidden, set the `SuggestedActionsVisibility` property of RadChat to `Collapsed`.

## Handling the SuggestedActionReported event

When the user selects a given suggestion, the `SuggestedActionReported` event is raised. Through it the user input can be modified. The event arguments are of the type of `SuggestedActionsEventArgs` and 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.

#### **Handling the SuggestedActionReported event**

```C#
private void Chat_SuggestedActionReported(object sender, SuggestedActionsEventArgs e)
{
	if (e.Text == "Hi, there!")
	{
		e.CloseAfterReport = false;
		e.PostResultInline = false;

		this.chat.AddMessage(this.otherAuthor, e.Text);
	}
}
```

**Handling the SuggestedActionReported event**
![Handling the SuggestedActionReported event](https://www.telerik.com/winui/documentation/assets/72297a1e6b4c64f2b3529642c5c9a841/radchat-suggested-action-1.png)

## SuggestedActionsOrientation

The RadChat component allows you to set the orientation, in which the suggested actions will be displayed. This is done via its `SuggestedActionsOrientation` property. The default value of this property is `Horizontal`.

#### **Setting the SuggestedActionsOrientation**

```XAML
<telerik:RadChat x:Name="chat" SuggestedActionsOrientation="Vertical"/>
```

**SuggestedActions with Vertical orientation**
![SuggestedActions with Vertical orientation](https://www.telerik.com/winui/documentation/assets/10a31461d9694ca9a2b49524250af834/radchat-suggested-action-2.png)
