alexa
menu

UWP

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download

    Show / Hide Table of Contents

    Class NameSuggestionProvider

    Provides the real-time automatic suggestion functionality for SfRichTextBoxAdv control.

    Inheritance
    System.Object
    NameSuggestionProvider
    Implements
    ISuggestionProvider
    Namespace: Syncfusion.UI.Xaml.RichTextBoxAdv
    Assembly: Syncfusion.SfRichTextBoxAdv.UWP.dll
    Syntax
    public class NameSuggestionProvider : DependencyObject, ISuggestionProvider
    Remarks

    This interface allows component authors to implement their own class for automatic suggestion functionality.

    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

    NameSuggestionProvider()

    Declaration
    public NameSuggestionProvider()

    Properties

    ItemsSource

    Gets or sets the collection of System.Collections.IEnumerable object that has content for automatic suggestions.

    Declaration
    public IEnumerable ItemsSource { get; set; }
    Property Value
    Type Description
    System.Collections.IEnumerable

    A collection of System.Collections.IEnumerable object that has content for automatic suggestions. The default is null.

    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)

    ItemsSourceProperty

    Gets the ItemsSource property for NameSuggestionProvider instance.

    Declaration
    public static DependencyProperty ItemsSourceProperty { get; }
    Property Value
    Type
    Windows.UI.Xaml.DependencyProperty

    MentionCharacter

    Gets or sets a character that represents the mention character for NameSuggestionProvider instance.

    Declaration
    public char MentionCharacter { get; set; }
    Property Value
    Type Description
    System.Char

    A character that represents the mention character for NameSuggestionProvider 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)

    MentionCharacterProperty

    Gets the MentionCharacter property for NameSuggestionProvider instance.

    Declaration
    public static DependencyProperty MentionCharacterProperty { get; }
    Property Value
    Type
    Windows.UI.Xaml.DependencyProperty

    SuggestionBoxStyle

    Gets or sets the style used by Windows.UI.Xaml.Controls.ListBox element when it is rendered for displaying suggestion items from this NameSuggestionProvider instance.

    Declaration
    public Style SuggestionBoxStyle { get; set; }
    Property Value
    Type Description
    Windows.UI.Xaml.Style

    The Windows.UI.Xaml.Style 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)

    SuggestionBoxStyleProperty

    Gets the SuggestionBox Style property for NameSuggestionProvider instance.

    Declaration
    public static DependencyProperty SuggestionBoxStyleProperty { get; }
    Property Value
    Type
    Windows.UI.Xaml.DependencyProperty

    Methods

    Dispose()

    Releases unmanaged and - optionally - managed resources.

    Declaration
    public void Dispose()

    InsertSelectedItem(SfRichTextBoxAdv, Object)

    Inserts the selected item into the SfRichTextBoxAdv control at cursor position

    Declaration
    public void InsertSelectedItem(SfRichTextBoxAdv richTextBoxAdv, object selectedItem)
    Parameters
    Type Name Description
    SfRichTextBoxAdv richTextBoxAdv

    The instance of the SfRichTextBoxAdv.

    System.Object selectedItem

    The instance of the selected item.

    Remarks

    You can implement your own logic to insert the selected item by inheriting ISuggestionProvider interface.

    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)

    Search(String)

    Searches the suggestion source of ISuggestionProvider instance.

    Declaration
    public List<object> Search(string searchText)
    Parameters
    Type Name Description
    System.String searchText

    The text to search in suggestion items.

    Returns
    Type Description
    System.Collections.Generic.List<System.Object>

    Returns the collection of matching suggestion items.

    Remarks

    You can implement your own search logic by inheriting ISuggestionProvider interface.

    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)

    Implements

    ISuggestionProvider

    Extension Methods

    DateTimeExtension.ToDateTime(Object)
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved