Class SfSmartDataGrid
A smart extension of Syncfusion's SfDataGrid for .NET MAUI that adds an AI-assisted toolbar. It accepts natural language queries, converts them to structured actions (For example sort, filter, group, clear, multi-step), and applies them to the underlying data grid.
Implements
Inherited Members
Namespace: Syncfusion.Maui.SmartComponents
Assembly: Syncfusion.Maui.SmartComponents.dll
Syntax
public class SfSmartDataGrid : SfDataGrid, IDrawableLayout, IDrawable, IAbsoluteLayout, ILayout, IView, IElement, ITransform, IContainer, IList<IView>, ICollection<IView>, IEnumerable<IView>, IEnumerable, ISafeAreaView, IPadding, ICrossPlatformLayout, IVisualTreeElement, ISemanticsProvider, IPullToRefresh, IDetailsViewNotifier, IParentThemeElement, IThemeElement, ISmartDataGridLayout
Constructors
SfSmartDataGrid()
Initializes a new instance of the SfSmartDataGrid class.
Declaration
public SfSmartDataGrid()
Fields
AssistButtonIconTemplateProperty
Identifies the AssistButtonTemplate Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty AssistButtonIconTemplateProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
AssistButtonTemplateProperty
Identifies the AssistButtonTemplate Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty AssistButtonTemplateProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
AssistViewSettingsProperty
Identifies the AssistViewSettings Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty AssistViewSettingsProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
ShowAssistButtonIconProperty
Gets or sets a value indicating whether to show the icon in the AI Assistant button. When false, the icon is hidden and the text is centered. Default is true. Identifies the ShowAssistButtonIcon Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty ShowAssistButtonIconProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
ToolbarHeightProperty
Identifies the ToolBarHeight Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty ToolbarHeightProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
ToolbarTemplateProperty
Identifies the ToolbarTemplate Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty ToolbarTemplateProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
Properties
AssistButtonIconTemplate
Gets or sets the template for the icon in the AI Assistant button.
Declaration
public DataTemplate AssistButtonIconTemplate { get; set; }
Property Value
| Type | Description |
|---|---|
| Microsoft.Maui.Controls.DataTemplate | If null, a default icon is used. |
AssistButtonTemplate
Gets or sets the label displayed near the AI button on the toolbar.
Declaration
public DataTemplate AssistButtonTemplate { get; set; }
Property Value
| Type |
|---|
| Microsoft.Maui.Controls.DataTemplate |
AssistViewSettings
Initializes a new instance of the SfSmartDataGrid class.
Declaration
public DataGridAssistViewSettings AssistViewSettings { get; set; }
Property Value
| Type |
|---|
| DataGridAssistViewSettings |
ShowAssistButtonIcon
Gets or sets a value indicating whether the AI Assistant button shows an icon.
Declaration
public bool ShowAssistButtonIcon { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
ToolbarHeight
Gets or sets the height of the toolbar that hosts the AI AssistView controls. Default value is 54.
Declaration
public double ToolbarHeight { get; set; }
Property Value
| Type |
|---|
| System.Double |
ToolbarTemplate
Gets or sets the template used to render the toolbar above the grid.
Declaration
public DataTemplate ToolbarTemplate { get; set; }
Property Value
| Type |
|---|
| Microsoft.Maui.Controls.DataTemplate |
Methods
ArrangeContent(Rect)
Arranges the AI toolbar at the top and the grid content in the remaining space.
Declaration
protected override Size ArrangeContent(Rect bounds)
Parameters
| Type | Name | Description |
|---|---|---|
| Microsoft.Maui.Graphics.Rect | bounds | The layout bounds provided by the parent. |
Returns
| Type | Description |
|---|---|
| Microsoft.Maui.Graphics.Size | The arranged size. |
Overrides
CloseAssistView()
Closes the AI AssistView popup if it�s open.
Declaration
public void CloseAssistView()
GetResponseAsync(String)
Requests a response from the AI Assistant using the given user text. This is intended for scenarios where a custom AssistEditorViewTemplate removes the default send icon and you need to trigger the request programmatically.
Declaration
public void GetResponseAsync(string prompt)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | prompt | The prompt to send to the AI Assistant. |
MeasureContent(Double, Double)
Measures the content and reserves space for the AI toolbar at the top of the grid.
Declaration
protected override Size MeasureContent(double widthConstraint, double heightConstraint)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | widthConstraint | Available width from the layout system. |
| System.Double | heightConstraint | Available height from the layout system. |
Returns
| Type | Description |
|---|---|
| Microsoft.Maui.Graphics.Size | The desired size including the toolbar height. |
Overrides
ShowAssistView(View)
Shows the AI AssistView popup, aligned to the bottom-right of the grid.
Declaration
public void ShowAssistView(View view = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Microsoft.Maui.Controls.View | view |
Events
AssistViewRequest
Occurs when a user request is sent to the AI AssistView.
Declaration
public event EventHandler<AssistViewRequestEventArgs> AssistViewRequest
Event Type
| Type |
|---|
| System.EventHandler<AssistViewRequestEventArgs> |