Class NameSuggestionItem
Provides the content for suggestion item in SfRichTextBoxAdv control.
Inheritance
Namespace: Syncfusion.UI.Xaml.RichTextBoxAdv
Assembly: Syncfusion.SfRichTextBoxAdv.UWP.dll
Syntax
public class NameSuggestionItem : DependencyObject
Remarks
This class contains name, image to display in suggestion box and link to create hyperlink in SfRichTextBoxAdv control.
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
NameSuggestionItem()
Declaration
public NameSuggestionItem()
Properties
ImageSource
Gets or sets the Windows.UI.Xaml.Media.ImageSource for NameSuggestionItem instance.
Declaration
public ImageSource ImageSource { get; set; }
Property Value
| Type | Description |
|---|---|
| Windows.UI.Xaml.Media.ImageSource | The image to be displayed in suggestion box for NameSuggestionItem 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)
ImageSourceProperty
Gets or sets value for ImageSource instance.
Declaration
public static DependencyProperty ImageSourceProperty { get; }
Property Value
| Type |
|---|
| Windows.UI.Xaml.DependencyProperty |
Link
Gets or sets the link for NameSuggestionItem instance.
Declaration
public string Link { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | The link that used for creating hyperlink in SfRichTextBoxAdv control. |
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)
LinkProperty
Gets or sets a value for Link instance.
Declaration
public static DependencyProperty LinkProperty { get; }
Property Value
| Type |
|---|
| Windows.UI.Xaml.DependencyProperty |
Name
Gets or sets the name for NameSuggestionItem instance.
Declaration
public string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | The name to be displayed in suggestion box for NameSuggestionItem 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)
NameProperty
Gets or sets a value for Name instance.
Declaration
public static DependencyProperty NameProperty { get; }
Property Value
| Type |
|---|
| Windows.UI.Xaml.DependencyProperty |
Methods
Dispose()
Releases unmanaged and - optionally - managed resources.
Declaration
public void Dispose()