ClassRadHighlightTextBlock
Represents a customizable text block that highlights specific portions of its text based on predefined criteria. This class extends the TextBlock control, introducing properties to specify which text to highlight and how to style the highlighted text. It includes features such as case sensitivity, different highlight modes (first match, last match, all matches), and customizable foreground and background colors for the highlighted text. The RadHighlightTextBlock class supports theming through the IThemable interface, allowing it to adapt its style based on the current application theme. The highlighted text is refreshed dynamically when the underlying text or highlight properties change. Additionally, it integrates with the automation framework, enabling accessibility features.
Definition
Namespace:Telerik.Windows.Controls
Assembly:Telerik.Windows.Controls.dll
Syntax:
[TelerikToolboxCategory("Common")]
public class RadHighlightTextBlock : TextBlock
Inheritance: objectRadHighlightTextBlock
Constructors
RadHighlightTextBlock()
Initializes a new instance of the RadHighlightTextBlock class.
Declaration
public RadHighlightTextBlock()
Fields
HighlightBackgroundProperty
Identifies the HighlightBackground dependency property.
Declaration
public static readonly DependencyProperty HighlightBackgroundProperty
Field Value
DependencyProperty
HighlightForegroundProperty
Identifies the HighlightForeground dependency property.
Declaration
public static readonly DependencyProperty HighlightForegroundProperty
Field Value
DependencyProperty
HighlightModeProperty
Identifies the HighlightMode dependency property.
Declaration
public static readonly DependencyProperty HighlightModeProperty
Field Value
DependencyProperty
HighlightTextProperty
Identifies the HighlightText dependency property.
Declaration
public static readonly DependencyProperty HighlightTextProperty
Field Value
DependencyProperty
IsCaseSensitiveProperty
Identifies the IsCaseSensitive dependency property.
Declaration
public static readonly DependencyProperty IsCaseSensitiveProperty
Field Value
DependencyProperty
Properties
HighlightBackground
Gets or sets the background of the highlighted text.
Declaration
public Brush HighlightBackground { get; set; }
Property Value
Brush
HighlightForeground
Gets or sets the foreground of the highlighted text.
Declaration
public Brush HighlightForeground { get; set; }
Property Value
Brush
HighlightMode
Gets or sets the highlight mode.
Declaration
public HighlightMode HighlightMode { get; set; }
Property Value
HighlightText
Gets or sets the portion of the Text which should be highlighted.
IsCaseSensitive
Gets or sets a boolean value indicating whether the Text will be searched for matches in a case sensitive manner.
Methods
GetHighlightInfos()
Returns the list of HighlightTextInfo objects indicating the parts of the text that need to be highlighted.
Declaration
protected virtual IEnumerable<HighlightTextInfo> GetHighlightInfos()
Returns
HighlightTextRange(HighlightTextInfo)
Applies the styling to the TextRange instance created from the HighlightTextInfo.
Declaration
protected virtual void HighlightTextRange(HighlightTextInfo info)
Parameters
info
OnCreateAutomationPeer()
Creates a RadHighlightTextBlockAutomationPeer.
Declaration
protected override AutomationPeer OnCreateAutomationPeer()
Returns
AutomationPeer
OnInitialized(EventArgs)
Raises the event. This method is invoked whenever is set to true internally.
Declaration
protected override void OnInitialized(EventArgs e)
Parameters
e
The RoutedEventArgs that contains the event data.
SetDefaultStyleKey()
Sets the default style key for StyleManager based on the current theme.
Declaration
protected virtual void SetDefaultStyleKey()