Class SuggestionSettings
Represents the automatic suggestion settings for SfRichTextBoxAdv control.
Inheritance
System.Object
SuggestionSettings
Namespace: Syncfusion.UI.Xaml.RichTextBoxAdv
Assembly: Syncfusion.SfRichTextBoxAdv.UWP.dll
Syntax
public class SuggestionSettings : DependencyObject
Examples
The following code example demonstrates how to add automatic suggestion settings for SfRichTextBoxAdv control.
<!-- Defines the SfRichTextBoxAdv control. -->
<Window.Resources>
<coll:ArrayList x:Key="suggestionItems">
<syncfusion:NameSuggestionItem Name="Nancy Davolio" Link="mailto:[email protected]" ImageSource="images/nancy.png" />
<syncfusion:NameSuggestionItem Name="Andrew Fuller" Link="mailto:[email protected]" ImageSource="images/andrew.png"/>
<syncfusion:NameSuggestionItem Name="Steven Buchanan" Link="mailto:[email protected]" ImageSource="images/steven.png"/>
</coll:ArrayList>
<Style x:Key="suggestionBoxStyle" TargetType="ListBox">
<Setter Property = "MinWidth" Value="300" />
<Setter Property = "MinHeight" Value="250" />
<Setter Property = "ItemTemplate">
<Setter.Value>
<DataTemplate>
<StackPanel Orientation="Horizontal" Height="44" Padding="12" AutomationProperties.Name="{Binding Name}">
<Image Source = "{Binding ImageSource}" Height="16" Width="16" VerticalAlignment="Center" />
<TextBlock Text = "{Binding Name}" FontSize="14" VerticalAlignment="Center" Margin="12,0,0,0" />
</StackPanel>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<RichTextBoxAdv:SfRichTextBoxAdv x:Name="richTextBoxAdv">
<RichTextBoxAdv:SfRichTextBoxAdv.SuggestionSettings>
<RichTextBoxAdv:SuggestionSettings>
<RichTextBoxAdv:SuggestionSettings.SuggestionProviders>
<RichTextBoxAdv:NameSuggestionProvider MentionCharacter="@" ItemsSource="{StaticResource suggestionItems}" SuggestionBoxStyle="{StaticResource suggestionBoxStyle}">
</RichTextBoxAdv:NameSuggestionProvider>
</RichTextBoxAdv:SuggestionSettings.SuggestionProviders>
</RichTextBoxAdv:SuggestionSettings>
</RichTextBoxAdv:SfRichTextBoxAdv.SuggestionSettings>
</RichTextBoxAdv:SfRichTextBoxAdv>
Defines the SfRichTextBoxAdv control.
SfRichTextBoxAdv richTextBoxAdv = new SfRichTextBoxAdv();
ISuggestionProvider suggestionProvider = new NameSuggestionProvider();
suggestionProvider.MentionCharacter = '@';
suggestionProvider.SuggestionBoxStyle = Resources["suggestionBoxStyle"] as Style;
List<NameSuggestionItem> suggestionItems = new List<NameSuggestionItem>();
NameSuggestionItem suggestionItem = new NameSuggestionItem();
suggestionItem.Name = "Nancy Davolio";
suggestionItem.Link="mailto:[email protected]";
suggestionItem.ImageSource="images/nancy.png";
suggestionItems.Add(suggestionItem);
suggestionItem = new NameSuggestionItem();
suggestionItem.Name = "Andrew Fuller";
suggestionItem.Link="mailto:[email protected]";
suggestionItem.ImageSource="images/andrew.png";
suggestionItems.Add(suggestionItem);
suggestionItem = new NameSuggestionItem();
suggestionItem.Name = "Steven Buchanan";
suggestionItem.Link="mailto:[email protected]";
suggestionItem.ImageSource="images/steven.png";
suggestionItems.Add(suggestionItem);
(suggestionProvider as NameSuggestionProvider).ItemsSource = suggestionItems;
richTextBoxAdv.SuggestionSettings = new SuggestionSettings();
richTextBoxAdv.SuggestionSettings.SuggestionProviders.Add(suggestionProvider);
' Defines the SfRichTextBoxAdv control.
Dim richTextBoxAdv As SfRichTextBoxAdv = New SfRichTextBoxAdv()
Dim suggestionProvider As ISuggestionProvider = New NameSuggestionProvider()
suggestionProvider.MentionCharacter = '@'
suggestionProvider.SuggestionBoxStyle = TryCast(Resources("suggestionBoxStyle"), Style)
Dim suggestionItems As List<NameSuggestionItem> = New List<NameSuggestionItem>()
Dim suggestionItem As NameSuggestionItem = New NameSuggestionItem()
suggestionItem.Name = "Nancy Davolio"
suggestionItem.Link = "mailto:[email protected]"
suggestionItem.ImageSource = "images/nancy.png"
suggestionItems.Add(suggestionItem)
suggestionItem = New NameSuggestionItem()
suggestionItem.Name = "Andrew Fuller"
suggestionItem.Link = "mailto:[email protected]"
suggestionItem.ImageSource = "images/andrew.png"
suggestionItems.Add(suggestionItem)
suggestionItem = New NameSuggestionItem()
suggestionItem.Name = "Steven Buchanan"
suggestionItem.Link = "mailto:[email protected]"
suggestionItem.ImageSource = "images/steven.png"
suggestionItems.Add(suggestionItem)
TryCast(suggestionProvider, NameSuggestionProvider).ItemsSource = suggestionItems
richTextBoxAdv.SuggestionSettings = New SuggestionSettings()
richTextBoxAdv.SuggestionSettings.SuggestionProviders.Add(suggestionProvider)
Constructors
SuggestionSettings()
Initializes a new instance of the SuggestionSettings class.
Declaration
public SuggestionSettings()
Properties
SuggestionProviders
Gets or sets the collection of ISuggestionProvider instance that provides automatic suggestion functionality.
Declaration
public ObservableCollection<ISuggestionProvider> SuggestionProviders { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Collections.ObjectModel.ObservableCollection<ISuggestionProvider> | The collection of ISuggestionProvider instance. |
Examples
The following code example demonstrates how to add automatic suggestion settings for SfRichTextBoxAdv control.
<!-- Defines the SfRichTextBoxAdv control. -->
<Window.Resources>
<coll:ArrayList x:Key="suggestionItems">
<syncfusion:NameSuggestionItem Name="Nancy Davolio" Link="mailto:[email protected]" ImageSource="images/nancy.png" />
<syncfusion:NameSuggestionItem Name="Andrew Fuller" Link="mailto:[email protected]" ImageSource="images/andrew.png"/>
<syncfusion:NameSuggestionItem Name="Steven Buchanan" Link="mailto:[email protected]" ImageSource="images/steven.png"/>
</coll:ArrayList>
<Style x:Key="suggestionBoxStyle" TargetType="ListBox">
<Setter Property = "MinWidth" Value="300" />
<Setter Property = "MinHeight" Value="250" />
<Setter Property = "ItemTemplate">
<Setter.Value>
<DataTemplate>
<StackPanel Orientation="Horizontal" Height="44" Padding="12" AutomationProperties.Name="{Binding Name}">
<Image Source = "{Binding ImageSource}" Height="16" Width="16" VerticalAlignment="Center" />
<TextBlock Text = "{Binding Name}" FontSize="14" VerticalAlignment="Center" Margin="12,0,0,0" />
</StackPanel>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<RichTextBoxAdv:SfRichTextBoxAdv x:Name="richTextBoxAdv">
<RichTextBoxAdv:SfRichTextBoxAdv.SuggestionSettings>
<RichTextBoxAdv:SuggestionSettings>
<RichTextBoxAdv:SuggestionSettings.SuggestionProviders>
<RichTextBoxAdv:NameSuggestionProvider MentionCharacter="@" ItemsSource="{StaticResource suggestionItems}" SuggestionBoxStyle="{StaticResource suggestionBoxStyle}">
</RichTextBoxAdv:NameSuggestionProvider>
</RichTextBoxAdv:SuggestionSettings.SuggestionProviders>
</RichTextBoxAdv:SuggestionSettings>
</RichTextBoxAdv:SfRichTextBoxAdv.SuggestionSettings>
</RichTextBoxAdv:SfRichTextBoxAdv>
// Defines the SfRichTextBoxAdv control.
SfRichTextBoxAdv richTextBoxAdv = new SfRichTextBoxAdv();
ISuggestionProvider suggestionProvider = new NameSuggestionProvider();
suggestionProvider.MentionCharacter = '@';
suggestionProvider.SuggestionBoxStyle = Resources["suggestionBoxStyle"] as Style;
List<NameSuggestionItem> suggestionItems = new List<NameSuggestionItem>();
NameSuggestionItem suggestionItem = new NameSuggestionItem();
suggestionItem.Name = "Nancy Davolio";
suggestionItem.Link="mailto:[email protected]";
suggestionItem.ImageSource="images/nancy.png";
suggestionItems.Add(suggestionItem);
suggestionItem = new NameSuggestionItem();
suggestionItem.Name = "Andrew Fuller";
suggestionItem.Link="mailto:[email protected]";
suggestionItem.ImageSource="images/andrew.png";
suggestionItems.Add(suggestionItem);
suggestionItem = new NameSuggestionItem();
suggestionItem.Name = "Steven Buchanan";
suggestionItem.Link="mailto:[email protected]";
suggestionItem.ImageSource="images/steven.png";
suggestionItems.Add(suggestionItem);
(suggestionProvider as NameSuggestionProvider).ItemsSource = suggestionItems;
richTextBoxAdv.SuggestionSettings = new SuggestionSettings();
richTextBoxAdv.SuggestionSettings.SuggestionProviders.Add(suggestionProvider);
' Defines the SfRichTextBoxAdv control.
Dim richTextBoxAdv As SfRichTextBoxAdv = New SfRichTextBoxAdv()
Dim suggestionProvider As ISuggestionProvider = New NameSuggestionProvider()
suggestionProvider.MentionCharacter = '@'
suggestionProvider.SuggestionBoxStyle = TryCast(Resources("suggestionBoxStyle"), Style)
Dim suggestionItems As List<NameSuggestionItem> = New List<NameSuggestionItem>()
Dim suggestionItem As NameSuggestionItem = New NameSuggestionItem()
suggestionItem.Name = "Nancy Davolio"
suggestionItem.Link = "mailto:[email protected]"
suggestionItem.ImageSource = "images/nancy.png"
suggestionItems.Add(suggestionItem)
suggestionItem = New NameSuggestionItem()
suggestionItem.Name = "Andrew Fuller"
suggestionItem.Link = "mailto:[email protected]"
suggestionItem.ImageSource = "images/andrew.png"
suggestionItems.Add(suggestionItem)
suggestionItem = New NameSuggestionItem()
suggestionItem.Name = "Steven Buchanan"
suggestionItem.Link = "mailto:[email protected]"
suggestionItem.ImageSource = "images/steven.png"
suggestionItems.Add(suggestionItem)
TryCast(suggestionProvider, NameSuggestionProvider).ItemsSource = suggestionItems
richTextBoxAdv.SuggestionSettings = New SuggestionSettings()
richTextBoxAdv.SuggestionSettings.SuggestionProviders.Add(suggestionProvider)