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
Initializes a new instance of the RadHighlightTextBlock class.
public RadHighlightTextBlock()
Fields
HighlightBackgroundProperty
DependencyProperty
Identifies the HighlightBackground dependency property.
public static readonly DependencyProperty HighlightBackgroundProperty
HighlightForegroundProperty
DependencyProperty
Identifies the HighlightForeground dependency property.
public static readonly DependencyProperty HighlightForegroundProperty
HighlightModeProperty
DependencyProperty
Identifies the HighlightMode dependency property.
public static readonly DependencyProperty HighlightModeProperty
HighlightTextProperty
DependencyProperty
Identifies the HighlightText dependency property.
public static readonly DependencyProperty HighlightTextProperty
IsCaseSensitiveProperty
DependencyProperty
Identifies the IsCaseSensitive dependency property.
public static readonly DependencyProperty IsCaseSensitiveProperty
Properties
HighlightBackground
Brush
Gets or sets the background of the highlighted text.
public Brush HighlightBackground { get; set; }
HighlightForeground
Brush
Gets or sets the foreground of the highlighted text.
public Brush HighlightForeground { get; set; }
Gets or sets the highlight mode.
public HighlightMode HighlightMode { get; set; }
Gets or sets the portion of the Text which should be highlighted.
public string HighlightText { get; set; }
Gets or sets a boolean value indicating whether the Text will be searched for matches in a case sensitive manner.
public bool IsCaseSensitive { get; set; }
Methods
Returns the list of HighlightTextInfo objects indicating the parts of the text that need to be highlighted.
protected virtual IEnumerable<HighlightTextInfo> GetHighlightInfos()
Applies the styling to the TextRange instance created from the HighlightTextInfo.
protected virtual void HighlightTextRange(HighlightTextInfo info)
OnCreateAutomationPeer()
AutomationPeer
Creates a RadHighlightTextBlockAutomationPeer.
protected override AutomationPeer OnCreateAutomationPeer()
AutomationPeer
Raises the event. This method is invoked whenever is set to true internally.
protected override void OnInitialized(EventArgs e)
The RoutedEventArgs that contains the event data.
Resets the theme.
public void ResetTheme()
Sets the default style key for StyleManager based on the current theme.
protected virtual void SetDefaultStyleKey()