ClassRadAIPromptElement
Represents the main element of the AI Prompt control that provides an interface for AI interactions with input, output, and toolbar functionality.
Definition
Namespace:Telerik.WinControls.UI.AIPrompt
Assembly:Telerik.WinControls.UI.dll
Syntax:
public class RadAIPromptElement : LightVisualElement, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IBindableComponent, IComponent, IDisposable, ISupportDrag, ISupportDrop, IShortcutProvider, IStylableElement, IStylableNode, IPrimitiveElement, IShapedElement, IFillElement, IBorderElement, IBoxStyle, IBoxElement, IDrawFillElement, IImageElement, ITextPrimitive, ITextProvider
Inheritance: objectDisposableObjectRadObjectRadElementVisualElementRadComponentElementRadItemUIItemBaseLightVisualElementRadAIPromptElement
Implements:
Inherited Members
Constructors
RadAIPromptElement()
Declaration
public RadAIPromptElement()
Properties
ActiveItem
Gets or sets the currently active item that is displayed in the AI Prompt control.
Declaration
public RadAIPromptItem ActiveItem { get; set; }
Property Value
InputText
Gets or sets the text content in the input area of the AI Prompt control.
Items
Gets the collection of items that represent the different views of the AI Prompt control.
Declaration
public ObservableCollection<RadAIPromptItem> Items { get; }
Property Value
OutputItems
Gets the collection of output items that contain responses from the AI.
Declaration
public ObservableCollection<AIPromptOutputItem> OutputItems { get; }
Property Value
Toolbar
Gets the toolbar element that contains navigation and action items for the AI Prompt control.
Declaration
public AIPromptToolbar Toolbar { get; }
Property Value
ToolbarPosition
Gets or sets the position of the toolbar within the AI Prompt control.
Declaration
public ToolbarPosition ToolbarPosition { get; set; }
Property Value
ViewContainer
Gets the container element that hosts the different views of the AI Prompt control.
Declaration
public AIPromptContainer ViewContainer { get; }
Property Value
Methods
ArrangeOverride(SizeF)
Positions and sizes the toolbar and container elements within the AI Prompt control.
CallOnOutputItemAction(OutputAction, AIPromptOutputItem)
Raises the OutputItemAction event for the specified action and output item.
Declaration
protected virtual bool CallOnOutputItemAction(OutputAction action, AIPromptOutputItem outputItem)
Parameters
action
The action being performed on the output item.
outputItem
The output item the action is being performed on.
Returns
True if the event was handled; otherwise, false.
CreateChildElements()
Creates the child elements including the toolbar and container for the AI Prompt control.
Declaration
protected override void CreateChildElements()
Overrides
CreateContainerElement()
Creates the container element that hosts the views for the AI Prompt control. Override this method to provide a custom container.
Declaration
protected virtual AIPromptContainer CreateContainerElement()
Returns
A new AIPromptContainer instance.
CreateItemsCollection()
Creates the collection that holds the AI Prompt items. Override this method to provide a custom items collection.
Declaration
protected virtual ObservableCollection<RadAIPromptItem> CreateItemsCollection()
Returns
ObservableCollection<RadAIPromptItem>
A new ObservableCollection<T> of RadAIPromptItem objects.
CreateOutputItemsCollection()
Creates the collection that holds the AI output items. Override this method to provide a custom output items collection.
Declaration
protected virtual ObservableCollection<AIPromptOutputItem> CreateOutputItemsCollection()
Returns
ObservableCollection<AIPromptOutputItem>
A new ObservableCollection<T> of AIPromptOutputItem objects.
CreateToolbarElement()
Creates the toolbar element for the AI Prompt control. Override this method to provide a custom toolbar.
Declaration
protected virtual AIPromptToolbar CreateToolbarElement()
Returns
A new AIPromptToolbar instance.
InitializeFields()
Initializes the default field values and sets up the appearance properties of the AI Prompt element.
Declaration
protected override void InitializeFields()
Overrides
MeasureOverride(SizeF)
Measures the size required for the AI Prompt element and its child elements.
OnItemsChanged(NotifyCollectionChangedEventArgs)
Called when the Items collection changes to validate the types and uniqueness of items being added.
Declaration
protected virtual void OnItemsChanged(NotifyCollectionChangedEventArgs e)
Parameters
e
NotifyCollectionChangedEventArgs
The event arguments containing information about the collection change.
OnOutputItemAction(OutputItemActionEventArgs)
Raises the OutputItemAction event when the user interacts with an output visual item.
Declaration
protected virtual void OnOutputItemAction(OutputItemActionEventArgs args)
Parameters
args
The event arguments containing information about the output item action.
OnOutputItemAdded()
Called when a new item is added to the OutputItems collection to switch to the output view and clear the input text.
Declaration
protected virtual void OnOutputItemAdded()
OnOutputItemCopy(AIPromptOutputItem)
Called when the copy button of an AIPromptOutputVisualItem is clicked.
Declaration
protected virtual void OnOutputItemCopy(AIPromptOutputItem outputItem)
Parameters
outputItem
The output item from the OutputItems collection that is being copied.
OnOutputItemRatingChanged(AIPromptOutputItem)
Called when the rating of an AIPromptOutputVisualItem is changed through the UI.
Declaration
protected virtual void OnOutputItemRatingChanged(AIPromptOutputItem outputItem)
Parameters
outputItem
The output item from the OutputItems collection whose rating was changed.
OnOutputItemRetry(AIPromptOutputItem)
Called when the retry button of an AIPromptOutputVisualItem is clicked.
Declaration
protected virtual void OnOutputItemRetry(AIPromptOutputItem outputItem)
Parameters
outputItem
The output item from the OutputItems collection that is being retried.
OnOutputVisualItemCreated(OutputVisualItemCreatedEventArgs)
Raises the OutputVisualItemCreated event when a new visual item is created for an output item.
Declaration
protected virtual void OnOutputVisualItemCreated(OutputVisualItemCreatedEventArgs args)
Parameters
args
OutputVisualItemCreatedEventArgs
The event arguments containing the output item and visual item information.
OnPromptRequest(PromptRequestEventArgs)
Raises the PromptRequest event when the end-user makes a request by pressing the input or retry button.
Declaration
protected virtual void OnPromptRequest(PromptRequestEventArgs args)
Parameters
args
The event arguments containing information about the prompt request.
ShouldArrangeChild(RadElement)
Determines whether the specified child element should be arranged by this element.
Declaration
protected override bool ShouldArrangeChild(RadElement child)
Parameters
child
The child element to check.
Returns
False if the child is the toolbar or container, as they have custom arrangement logic; otherwise, the base implementation result.
Overrides
Events
OutputItemAction
Occurs when the user initiates an interaction with an output visual item such as copy, retry, or rating actions.
Declaration
public event OutputItemActionEventHandler OutputItemAction
Event Value
OutputVisualItemCreated
Occurs when a new item is added to the OutputItems collection and a new visual item is about to be created for the output view.
Declaration
public event OutputVisualItemCreatedEventHandler OutputVisualItemCreated
Event Value
PromptRequest
Occurs when the user initiates a prompt request by clicking the generate or retry button.
Declaration
public event PromptRequestEventHandler PromptRequest
Event Value