A button element that provides speech-to-text functionality using a speech recognizer.
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.UI.dll
Syntax:
public class RadSpeechToTextButtonElement : LightVisualElement, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IBindableComponent, IComponent, IDisposable, ISupportDrag, ISupportDrop, IShortcutProvider, IStylableElement, IStylableNode, IPrimitiveElement, IShapedElement, IFillElement, IBorderElement, IBoxStyle, IBoxElement, IDrawFillElement, IImageElement, ITextPrimitive, ITextProvider
Inheritance: objectDisposableObjectRadObjectRadElementVisualElementRadComponentElementRadItemUIItemBaseLightVisualElementRadSpeechToTextButtonElement...
Implements:
Inherited Members
Constructors
Initializes a new instance of the RadSpeechToTextButtonElement class.
public RadSpeechToTextButtonElement()
Fields
Identifies the State dependency property, representing the current state of the speech recognizer.
public static RadProperty StateProperty
Properties
Gets or sets a value indicating whether to use pulse animation when the state is Listening.
public bool AllowAnimation { get; set; }
Gets or sets a value indicating whether the speech recognizer operates in continuous recognition mode.
When set to true, the recognizer will continuously listen and recognize speech until stopped.
When set to false, recognizer will stop automatically after a single utterance or pause.
public bool IsContinuousRecognition { get; set; }
Gets or sets the IETF BCP 47 language tag for the speech recognizer. For example "en-US", "de-DE".
public string LanguageTag { get; set; }
Gets or sets the custom factory that creates a IRadSpeechRecognizer instance.
[Browsable(false)]
public Func<IRadSpeechRecognizer> SpeechRecognizerCreator { get; set; }
Gets the current state of the speech recognizer.
public SpeechRecognizerState State { get; }
Gets or sets the recognizer states in which the tooltip callout is enabled.
public IList<SpeechRecognizerState> ToolTipStates { get; set; }
Methods
Disposes of managed resources including cached images and SVG images when the element is being disposed.
protected override void DisposeManagedResources()
Overrides:
Gets the content object used in the callout tooltip based on the current speech recognizer state.
protected virtual string GetCalloutContent()
A localized string describing the action for the current state, or null when no tooltip should be shown.
Initializes visual appearance fields such as border and fill settings, and applies theme value overrides for different visual states.
protected override void InitializeFields()
Overrides:
Performs first-time speech recognizer initialization on the first layout measure pass.
This is the TPF equivalent of WPF's OnApplyTemplate: Measure() is
skipped entirely when any ancestor element has Collapsed visibility,
so this method is structurally guaranteed to run only when the element is truly layout-visible.
This prevents eager initialization in hosts like RadPdfViewer where the speech button lives inside a
collapsed panel and may never become visible.
Handles the click event by invoking the base handler and asynchronously performing additional actions.
protected override void OnClick(EventArgs e)
An EventArgs object that contains the event data.
Overrides:
Initializes the speech recognizer if it has not already been initialized when the continuous recognition setting changes.
protected virtual void OnIsContinuousRecognitionChanged()
Handles changes to the language tag by initializing the speech recognizer if necessary.
protected virtual void OnLanguageTagChanged()
Called when a property value has changed, handling item-specific property change logic including text, visual state, and animation properties.
protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
The property changed event arguments.
Overrides:
Handles changes to the speech recognizer creator by disposing the current recognizer and creating a new one if the element is loaded.
protected virtual void OnSpeechRecognizerCreatorChanged()
Raises the StateChanged event and manages the listening animation lifecycle.
protected virtual void OnStateChanged()
Stops the speech to text button from listening.
If the speech recognizer is currently in the StartingListening or Listening state, this method will stop the recognition process. If the recognizer is not listening, this method has no effect.
Events
Occurs before the callout tooltip is opened, allowing customization or cancellation.
public event EventHandler<SpeechToTextTooltipOpeningEventArgs> CalloutOpening
Occurs when an error is encountered by the speech recognizer.
public event EventHandler<SpeechRecognizerErrorOccurredEventArgs> ErrorOccurred
Occurs when speech is successfully recognized.
public event EventHandler<SpeechRecognizerSpeechRecognizedEventArgs> SpeechRecognized
Occurs when the state of the speech recognizer changes.
public event EventHandler StateChanged