Class
SmartPasteButtonRequestContext

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:

cs-api-definition
public class SmartPasteButtonRequestContext

Inheritance: objectSmartPasteButtonRequestContext

Properties

CancellationToken

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.

Declaration

cs-api-definition
public CancellationToken CancellationToken { get; }

Property Value

CancellationToken

Content

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.

Declaration

cs-api-definition
public string Content { get; }

Property Value

string

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.

Fields

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

Declaration

cs-api-definition
public SmartPasteButtonField[] Fields { get; }

Property Value

SmartPasteButtonField[]

Methods

Cancel()

Call this method to cancel the smart paste operation.

Declaration

cs-api-definition
public void Cancel()

SetError(Exception)

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

Declaration

cs-api-definition
public void SetError(Exception exception = null)

Parameters

exception

Exception

SetResponse(Dictionary<string, object>)

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.

Declaration

cs-api-definition
public void SetResponse(Dictionary<string, object> fieldValues)

Parameters

fieldValues

Dictionary<string, object>