# .NET MAUI DataGrid AI Smart Assistant Templates

The .NET MAUI DataGrid control allows you to override the built-in templates for the AI Smart Assistant feature to create a customized user experience.

Use the `AIViewTemplate` (`DataTemplate`) property on DataGrid level to override the default template for the `DataGridAIPromptInput`.

Use the `EmptyContentTemplate` (`DataTemplate`) property on `AISettings` level to override the default template for the empty content view displayed when there are no suggestions available.

> tip When you define both templates, the `AIViewTemplate` takes precedence over the `EmptyContentTemplate`.

Here is an example of how to define custom templates for the AI Smart Assistant feature.

An example of `AIViewTemplate`:

```XAML
<DataTemplate x:Key="AIViewTemplate">
    <Grid ColumnDefinitions="*, 100"
          RowDefinitions="44"
          ColumnSpacing="10"
          Padding="{OnPlatform Android='5, 24', iOS='5, 24'}"
          BindingContext="{Binding AISettings, Source={RelativeSource AncestorType={Type telerik:RadDataGrid}}}">
        <telerik:RadEntry Text="{Binding InputText, Mode=TwoWay}"
                          telerik:KeyboardHelper.IsTranslationPivot="{OnPlatform Default=False, Android=True, iOS=True}"
                          telerik:KeyboardHelper.IsTranslationSource="{OnPlatform Default=False, Android=True, iOS=True}"
                          Placeholder="Enter your prompt..." />
        <telerik:RadTemplatedButton Content="Send"
                                    Command="{Binding PromptRequestCommand}"
                                    CommandParameter="{Binding InputText}" 
                                    Grid.Column="1" />
    </Grid>
</DataTemplate>
```

This is how the custom `AIViewTemplate` looks like when applied:

![.NET MAUI DataGrid AI Smart Assistant showing a custom AIViewTemplate](https://www.telerik.com/maui-ui/documentation/assets/813eaeac780412bb547daa31c02ecbc7/datagrid-ai-smart-assistant-view-templates.png)

An example of `EmptyContentTemplate`:

```XAML
<DataTemplate x:Key="EmptyContentTemplate">
    <telerik:RadBorder BorderBrush="Gray"
                       BorderThickness="1"
                       BackgroundColor="White">
        <VerticalStackLayout HorizontalOptions="Center"
                             VerticalOptions="Center"
                             Spacing="2">
            <Label Text="No suggestions available to display."
                   FontAttributes="Bold"
                   FontSize="16"
                   HorizontalOptions="Center" />
            <Label Text="Use the AI prompt control for entering prompts"
                   FontSize="14"
                   HorizontalOptions="Center" />
        </VerticalStackLayout>
    </telerik:RadBorder>
</DataTemplate>
```

This is how the custom `EmptyContentTemplate` looks like when applied:

![.NET MAUI DataGrid AI Smart Assistant showing a custom EmptyContentTemplate](https://www.telerik.com/maui-ui/documentation/assets/835fe7c07fcfd034cea54604e8a672a1/datagrid-ai-smart-assistant-empty-templates.png)

> important The DataGrid AI Smart Assistant examples in the [SDKBrowser Demo Application](https://www.telerik.com/maui-ui/documentation/demos-and-sample-apps/sdkbrowser-app) use a Telerik-hosted AI service for demonstration purposes only.
> You have to configure your own AI service for the AI Smart Assistant to work in your application.
> How to do that is described in the [Getting Started with the AI Smart Assistant](https://www.telerik.com/maui-ui/documentation/controls/datagrid/smart-ai-features/ai-assistant/overview#getting-started-with-the-ai-smart-assistant) article.

> tip For a runnable example demonstrating custom templates, see the [SDKBrowser Demo Application](https://www.telerik.com/maui-ui/documentation/demos-and-sample-apps/sdkbrowser-app) and go to the **DataGrid > AI Smart Assistant** category.

## See Also

* [Prompt Controlled Overview](https://www.telerik.com/maui-ui/documentation/controls/datagrid/smart-ai-features/ai-assistant/overview)
* [Style the AI Smart Assistant](https://www.telerik.com/maui-ui/documentation/controls/datagrid/smart-ai-features/ai-assistant/styling)
* [Configure the AI Smart Assistant](https://www.telerik.com/maui-ui/documentation/controls/datagrid/smart-ai-features/ai-assistant/configuration)
