TPF element implementing the an element that can be used to prompt and input. Acts as a coordinator between the PromptInputAttachedFilesElement, PromptInputTextBoxElement, and PromptInputButtonsPanelElement. Manages text synchronization, send flow orchestration, layout mode switching, and speech-to-text integration.
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.UI.dll
Syntax:
public class RadPromptInputElement : LightVisualElement, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IBindableComponent, IComponent, IDisposable, ISupportDrag, ISupportDrop, IShortcutProvider, IStylableElement, IStylableNode, IPrimitiveElement, IShapedElement, IFillElement, IBorderElement, IBoxStyle, IBoxElement, IDrawFillElement, IImageElement, ITextPrimitive, ITextProvider
Inheritance: objectDisposableObjectRadObjectRadElementVisualElementRadComponentElementRadItemUIItemBaseLightVisualElementRadPromptInputElement...
Implements:
Inherited Members
Constructors
Initializes a new instance of the RadPromptInputElement class.
public RadPromptInputElement()
Fields
Identifies the IsProcessing property.
public static RadProperty IsProcessingProperty
Properties
Gets or sets a value indicating whether the input box accepts the Return key to create new lines.
public bool AcceptsReturn { get; set; }
Gets the collection of files attached to the prompt. The collection is owned by the underlying PromptInputAttachedFilesElement; adding or removing items automatically updates the chip UI and the send-button state.
[Browsable(false)]
public ObservableCollection<PromptInputAttachedFile> AttachedFiles { get; }
Gets the attached files element.
[Browsable(false)]
public PromptInputAttachedFilesElement AttachedFilesElement { get; }
Gets the buttons panel element.
[Browsable(false)]
public PromptInputButtonsPanelElement ButtonsPanelElement { get; }
Gets or sets the text displayed inside the prompt-suggestions popup when both
SuggestedPrompts and RecentPrompts are empty.
When null or empty, the popup does not open when there are no suggestions.
Forwarded to EmptyPromptSuggestionsText.
public string EmptyPromptSuggestionsText { get; set; }
Gets or sets a callback that resolves the icon shown next to an attached file.
The callback receives the file name and returns a PromptInputFileIcon
carrying a glyph character, a Image, or a
RadSvgImage. Return null to fall back
to the default extension-based glyph.
Forwarded to FileIconProvider.
[Browsable(false)]
public Func<string, PromptInputFileIcon> FileIconProvider { get; set; }
Gets the input row dock layout panel.
[Browsable(false)]
public DockLayoutPanel InputRow { get; }
Gets the input text box element.
[Browsable(false)]
public ChatInputTextBoxElement InputTextBox { get; }
Gets or sets a value indicating whether the control is in a processing state.
When true, clicking the send button raises CancelProcessing
instead of SendMessage. The same state is currently also reused
during speech-to-text listening.
public bool IsProcessing { get; set; }
Gets or sets the maximum number of visible lines in the input text box.
public int MaxInputLines { get; set; }
Gets or sets the list of actions shown in the "more" button popup. Forwarded to MoreButtonActions.
[Browsable(false)]
public IList<PromptInputButtonAction> MoreButtonActions { get; set; }
Gets or sets the prompt text that is displayed when the input text box is empty.
public string NullText { get; set; }
Gets or sets a value indicating whether the suggestions popup opens automatically
when the input text box gains keyboard focus. Default is false.
public bool OpenPromptSuggestionsOnFocus { get; set; }
RecentPrompts
IList<string>
Gets or sets the list of recent prompts shown in the suggestions popup. Forwarded to RecentPrompts.
[Browsable(false)]
public IList<string> RecentPrompts { get; set; }
Gets or sets a value indicating whether the clear button is visible when text is present.
public bool ShowClearButton { get; set; }
Gets or sets a value indicating whether the "more" button is visible.
public bool ShowMoreButton { get; set; }
Gets or sets a value indicating whether the prompt-suggestions button is visible. Forwarded to ShowPromptSuggestionsButton.
public bool ShowPromptSuggestionsButton { get; set; }
Gets or sets a value indicating whether the recent-prompts section is visible inside the suggestions popup.
public bool ShowRecentPrompts { get; set; }
Gets or sets a value indicating whether the speech-to-text button is visible.
public bool ShowSpeechToTextButton { get; set; }
Gets or sets a value indicating whether the suggested-prompts section is visible inside the suggestions popup.
public bool ShowSuggestedPrompts { get; set; }
SuggestedPrompts
IList<string>
Gets or sets the list of suggested prompts shown in the suggestions popup. Forwarded to SuggestedPrompts.
[Browsable(false)]
public IList<string> SuggestedPrompts { get; set; }
Methods
Opens the file attachment dialog for all file types. Forwarded to AttachFiles().
public void AttachFiles()
Opens the file attachment dialog for image file types. Forwarded to AttachPhotos().
public void AttachPhotos()
Creates the attached files element. Override to customize.
protected virtual PromptInputAttachedFilesElement CreateAttachedFilesElement()
Creates the buttons panel element. Override to customize.
protected virtual PromptInputButtonsPanelElement CreateButtonsPanelElement()
Called by the element when constructed. Allows inheritors to build the element tree.
protected override void CreateChildElements()
Overrides:
Creates the input text box element. Override to customize.
Creates the input row panel. Override to customize.
Creates the main stack layout element. Override to customize.
Disposes of managed resources including cached images and SVG images when the element is being disposed.
protected override void DisposeManagedResources()
Overrides:
Initializes the internal fields and components of the LightVisualElement. This method sets up text primitives, image primitives, and layout management components.
protected override void InitializeFields()
Overrides:
Raises the CancelProcessing event.
Handles property change events by invalidating the fill cache and invoking the base class property change handler.
protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
Event arguments containing information about the property that changed.
Overrides:
Raises the SendingMessage event.
protected virtual void OnSendingMessage(PromptInputSendingMessageEventArgs args)
Raises the SendMessage event.
protected virtual void OnSendMessage(PromptInputSendMessageEventArgs args)
Removes the specified file from the AttachedFiles collection. Raises AttachedFileRemoving beforehand (cancelable) and AttachedFileRemoved afterwards. Forwarded to RemoveAttachedFile(PromptInputAttachedFile).
public void RemoveAttachedFile(PromptInputAttachedFile file)
Events
Occurs after an attached file has been removed from the AttachedFiles collection. Forwarded from AttachedFileRemoved.
public event PromptInputAttachedFileRemovedEventHandler AttachedFileRemoved
Occurs before an attached file is removed as a result of the user clicking
the remove button on its chip. Set
Cancel to true to
keep the file in the AttachedFiles collection.
Forwarded from AttachedFileRemoving.
public event PromptInputAttachedFileRemovingEventHandler AttachedFileRemoving
Occurs after the AttachedFiles collection changes (file added or removed, from the built-in dialog or programmatically). Forwarded from AttachedFilesChanged.
public event EventHandler AttachedFilesChanged
Occurs when the user clicks the send button while the control is in a processing state.
public event EventHandler CancelProcessing
Occurs when a file dialog is about to open (Attach / Photo actions).
Set Cancel to true
to suppress the built-in OpenFileDialog and
handle file selection externally; populate
FileNames in that case to still
produce attachments. Forwarded from DialogOpening.
public event PromptInputDialogOpeningEventHandler DialogOpening
Occurs when the user selects an item from the prompt suggestions popup. Forwarded from SuggestionSelected.
public event PromptInputSuggestionSelectedEventHandler PromptSuggestionSelected
Occurs before a message is sent. Set Cancel to true to prevent sending.
public event PromptInputSendingMessageEventHandler SendingMessage
Occurs when the user sends a message via the send button.
public event PromptInputSendMessageEventHandler SendMessage
Occurs before a suggestion is applied to the input text.
Set Cancel to true
to prevent the suggestion from being applied.
Forwarded from SuggestionSelecting.
public event PromptInputSuggestionSelectingEventHandler SuggestionSelecting