Class RadAIPromptElement
Represents the main element of the AI Prompt control that provides an interface for AI interactions with input, output, and toolbar functionality.
Inheritance
Inherited Members
Namespace: Telerik.WinControls.UI.AIPrompt
Assembly: Telerik.WinControls.UI.dll
Syntax
public class RadAIPromptElement : LightVisualElement, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IComponent, IDisposable, IBindableComponent, ISupportDrag, ISupportDrop, IShortcutProvider, IStylableElement, IStylableNode, IPrimitiveElement, IShapedElement, IFillElement, IBorderElement, IBoxStyle, IBoxElement, IDrawFillElement, IImageElement, ITextPrimitive, ITextProvider
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
RadAIPromptItem
|
InputText
Gets or sets the text content in the input area of the AI Prompt control.
Declaration
public string InputText { get; set; }
Property Value
System.String
|
Items
Gets the collection of items that represent the different views of the AI Prompt control.
Declaration
public ObservableCollection<RadAIPromptItem> Items { get; }
Property Value
System.Collections.ObjectModel.ObservableCollection<RadAIPromptItem>
|
OutputItems
Gets the collection of output items that contain responses from the AI.
Declaration
public ObservableCollection<AIPromptOutputItem> OutputItems { get; }
Property Value
System.Collections.ObjectModel.ObservableCollection<AIPromptOutputItem>
|
Toolbar
Gets the toolbar element that contains navigation and action items for the AI Prompt control.
Declaration
public AIPromptToolbar Toolbar { get; }
Property Value
AIPromptToolbar
|
ToolbarPosition
Gets or sets the position of the toolbar within the AI Prompt control.
Declaration
public ToolbarPosition ToolbarPosition { get; set; }
Property Value
ToolbarPosition
|
ViewContainer
Gets the container element that hosts the different views of the AI Prompt control.
Declaration
public AIPromptContainer ViewContainer { get; }
Property Value
AIPromptContainer
|
Methods
ArrangeOverride(SizeF)
Positions and sizes the toolbar and container elements within the AI Prompt control.
Declaration
protected override SizeF ArrangeOverride(SizeF finalSize)
Parameters
System.Drawing.SizeF
finalSize
The final area within the parent that this element should use to arrange itself and its children. |
Returns
System.Drawing.SizeF
The actual size used by the element. |
Overrides
CallOnOutputItemAction(OutputAction, AIPromptOutputItem)
Raises the OutputItemAction event for the specified action and output item.
Declaration
protected virtual bool CallOnOutputItemAction(OutputAction action, AIPromptOutputItem outputItem)
Parameters
OutputAction
action
The action being performed on the output item. |
AIPromptOutputItem
outputItem
The output item the action is being performed on. |
Returns
System.Boolean
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
AIPromptContainer
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
System.Collections.ObjectModel.ObservableCollection<RadAIPromptItem>
A new System.Collections.ObjectModel.ObservableCollection<> 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
System.Collections.ObjectModel.ObservableCollection<AIPromptOutputItem>
A new System.Collections.ObjectModel.ObservableCollection<> 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
AIPromptToolbar
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.
Declaration
protected override SizeF MeasureOverride(SizeF availableSize)
Parameters
System.Drawing.SizeF
availableSize
The available size that can be given to child elements. |
Returns
System.Drawing.SizeF
The size that this element determines it needs during layout. |
Overrides
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
System.Collections.Specialized.NotifyCollectionChangedEventArgs
e
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
OutputItemActionEventArgs
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
AIPromptOutputItem
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
AIPromptOutputItem
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
AIPromptOutputItem
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
OutputVisualItemCreatedEventArgs
args
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
PromptRequestEventArgs
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
RadElement
child
The child element to check. |
Returns
System.Boolean
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 Type
OutputItemActionEventHandler
|
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 Type
OutputVisualItemCreatedEventHandler
|
PromptRequest
Occurs when the user initiates a prompt request by clicking the generate or retry button.
Declaration
public event PromptRequestEventHandler PromptRequest
Event Type
PromptRequestEventHandler
|