Loading...
Loading...
Implements Syncfusion WPF Smart Text Editor (SfSmartTextEditor), an AI-powered multiline input control with intelligent text completion. Use this when implementing smart text editors, AI-powered text input, or predictive text suggestions in WPF applications. The control provides context-aware typing assistance through integration with AI services including Azure OpenAI, OpenAI, Ollama, Claude, Gemini, Groq, and DeepSeek. Features include dual suggestion display modes (inline/popup), custom phrase libraries for offline suggestions, full text customization, and comprehensive command handling for workflow integration.
npx skill4agent add syncfusion/wpf-ui-components-skills syncfusion-wpf-smart-text-editorIChatInferenceServiceConfigureSyncfusionAIServices()Install-Package Syncfusion.SfSmartComponents.WPF<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
x:Class="YourApp.MainWindow">
<Grid>
<syncfusion:SfSmartTextEditor
x:Name="smartTextEditor"
Placeholder="Type your response..."
UserRole="Customer support agent responding to inquiries">
<syncfusion:SfSmartTextEditor.UserPhrases>
<x:String>Thank you for reaching out.</x:String>
<x:String>We'll investigate and get back to you shortly.</x:String>
</syncfusion:SfSmartTextEditor.UserPhrases>
</syncfusion:SfSmartTextEditor>
</Grid>
</Window>using Azure.AI.OpenAI;
using Microsoft.Extensions.AI;
using Microsoft.Extensions.DependencyInjection;
using Syncfusion.UI.Xaml.SmartComponents;
using System.ClientModel;
using System.Windows;
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
// Configure Azure OpenAI
string azureApiKey = "<YOUR-API-KEY>";
Uri azureEndpoint = new Uri("<YOUR-ENDPOINT>");
string deploymentName = "<YOUR-DEPLOYMENT>";
AzureOpenAIClient azureClient = new AzureOpenAIClient(
azureEndpoint,
new ApiKeyCredential(azureApiKey)
);
IChatClient chatClient = azureClient
.GetChatClient(deploymentName)
.AsIChatClient();
SyncfusionAIExtension.Services.AddSingleton<IChatClient>(chatClient);
SyncfusionAIExtension.ConfigureSyncfusionAIServices();
}
}<syncfusion:SfSmartTextEditor
Placeholder="Write your response..."
UserRole="Technical support engineer helping customers with product issues"
MaxLength="2000"
SuggestionDisplayMode="Inline">
<syncfusion:SfSmartTextEditor.UserPhrases>
<x:String>Thanks for contacting Syncfusion support.</x:String>
<x:String>Could you please share a reproducible sample?</x:String>
<x:String>We've logged this as a bug and will update you soon.</x:String>
<x:String>Let us know if you need further assistance.</x:String>
</syncfusion:SfSmartTextEditor.UserPhrases>
</syncfusion:SfSmartTextEditor><syncfusion:SfSmartTextEditor
Placeholder="Compose your email..."
UserRole="Professional email author"
SuggestionDisplayMode="Popup"
MaxLength="5000">
<syncfusion:SfSmartTextEditor.Style>
<Style TargetType="{x:Type syncfusion:SfSmartTextEditor}">
<Setter Property="FontSize" Value="14"/>
<Setter Property="Foreground" Value="#333333"/>
<Setter Property="FontFamily" Value="Segoe UI"/>
</Style>
</syncfusion:SfSmartTextEditor.Style>
<syncfusion:SfSmartTextEditor.SuggestionPopupStyle>
<Style TargetType="syncfusion:SuggestionPopup">
<Setter Property="Background" Value="#0078D4"/>
<Setter Property="Foreground" Value="White"/>
</Style>
</syncfusion:SfSmartTextEditor.SuggestionPopupStyle>
</syncfusion:SfSmartTextEditor><syncfusion:SfSmartTextEditor
x:Name="smartTextEditor"
TextChangedCommand="{Binding TextChangedCommand}"
Placeholder="Start typing..."/>public class EditorViewModel : INotifyPropertyChanged
{
public ICommand TextChangedCommand { get; }
public EditorViewModel()
{
TextChangedCommand = new RelayCommand(OnTextChanged);
}
private void OnTextChanged()
{
// Auto-save, validation, or tracking logic
Debug.WriteLine("Text changed - triggering auto-save");
}
}<syncfusion:SfSmartTextEditor
Placeholder="Type your message..."
UserRole="Sales representative responding to leads">
<syncfusion:SfSmartTextEditor.UserPhrases>
<x:String>Thank you for your interest in our products.</x:String>
<x:String>I'd be happy to schedule a demo.</x:String>
<x:String>Our pricing starts at $99 per month.</x:String>
<x:String>Let me connect you with our solutions team.</x:String>
<x:String>Feel free to reach out with any questions.</x:String>
</syncfusion:SfSmartTextEditor.UserPhrases>
</syncfusion:SfSmartTextEditor>| Property | Type | Description | Default |
|---|---|---|---|
| | Gets or sets the text content | |
| | Placeholder text when editor is empty | |
| | Describes who is typing and intent (shapes AI suggestions) | |
| | Custom phrase library for offline suggestions | |
| | Display mode: | |
| | Maximum character limit | |
| | Command triggered when text changes | |
| | Text style (FontSize, Foreground, etc.) | Default |
| | Placeholder styling | Default |
| | Inline suggestion text style | Default |
| | Popup suggestion background style | Default |
SuggestionDisplayMode="Inline"SuggestionDisplayMode="Popup"AzureOpenAIClientIChatInferenceServiceMaxLengthTextChangedCommandUserPhrasesStylePlaceholderStyleSuggestionInlineStyle