New to Telerik UI for .NET MAUIStart a free 30-day trial

Provides data for the SmartPasteRequest event and the SmartPasteRequestCommand. Contains the clipboard content, fields, a cancellation token, and methods to signal the result of the AI request.

Definition

Namespace:Telerik.Maui.Controls.SmartPasteButton

Assembly:Telerik.Maui.Controls.dll

Syntax:

C#
public class SmartPasteButtonRequestContext

Inheritance: objectSmartPasteButtonRequestContext

Properties

Gets the cancellation token that is triggered when the user cancels the smart paste operation. Pass this token to async operations (e.g., HTTP requests) to support cooperative cancellation.

C#
public CancellationToken CancellationToken { get; }

The content to be processed by the Smart Paste Button. When the event is triggered or the command is executed, this property contains the clipboard content of the user.

C#
public string Content { get; }
Remarks:

Security — Prompt Injection: This value is raw, untrusted clipboard text. Do not embed it directly into an AI prompt without sanitization or clear contextual separation (e.g., wrapping it in delimiters and instructing the model to treat it as data only). Failure to do so may allow maliciously crafted clipboard content to override the AI's instructions.

Array of fields that should be populated with the AI response using the content provided.

C#
public SmartPasteButtonField[] Fields { get; }

Methods

Call this method to cancel the smart paste operation.

C#
public void Cancel()

Call this method to signal that an error occurred during the AI request.

C#
public void SetError(Exception exception = null)
Parameters:exceptionException

Call this method to provide the AI response as a dictionary of field values. The button will convert the values and populate the provider fields.

C#
public void SetResponse(Dictionary<string, object> fieldValues)
Parameters:fieldValuesDictionary<string, object>