Class
RadHighlightTextBlock

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:

cs-api-definition
[TelerikToolboxCategory("Common")]
public class RadHighlightTextBlock : TextBlock

Inheritance: objectRadHighlightTextBlock

Constructors

RadHighlightTextBlock()

Initializes a new instance of the RadHighlightTextBlock class.

Declaration

cs-api-definition
public RadHighlightTextBlock()

Fields

HighlightBackgroundProperty

Identifies the HighlightBackground dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty HighlightBackgroundProperty

Field Value

DependencyProperty

HighlightForegroundProperty

Identifies the HighlightForeground dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty HighlightForegroundProperty

Field Value

DependencyProperty

HighlightModeProperty

Identifies the HighlightMode dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty HighlightModeProperty

Field Value

DependencyProperty

HighlightTextProperty

Identifies the HighlightText dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty HighlightTextProperty

Field Value

DependencyProperty

IsCaseSensitiveProperty

Identifies the IsCaseSensitive dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty IsCaseSensitiveProperty

Field Value

DependencyProperty

Properties

HighlightBackground

Gets or sets the background of the highlighted text.

Declaration

cs-api-definition
public Brush HighlightBackground { get; set; }

Property Value

Brush

HighlightForeground

Gets or sets the foreground of the highlighted text.

Declaration

cs-api-definition
public Brush HighlightForeground { get; set; }

Property Value

Brush

HighlightMode

Gets or sets the highlight mode.

Declaration

cs-api-definition
public HighlightMode HighlightMode { get; set; }

Property Value

HighlightMode

HighlightText

Gets or sets the portion of the Text which should be highlighted.

Declaration

cs-api-definition
public string HighlightText { get; set; }

Property Value

string

IsCaseSensitive

Gets or sets a boolean value indicating whether the Text will be searched for matches in a case sensitive manner.

Declaration

cs-api-definition
public bool IsCaseSensitive { get; set; }

Property Value

bool

Methods

GetHighlightInfos()

Returns the list of HighlightTextInfo objects indicating the parts of the text that need to be highlighted.

Declaration

cs-api-definition
protected virtual IEnumerable<HighlightTextInfo> GetHighlightInfos()

Returns

IEnumerable<HighlightTextInfo>

HighlightTextRange(HighlightTextInfo)

Applies the styling to the TextRange instance created from the HighlightTextInfo.

Declaration

cs-api-definition
protected virtual void HighlightTextRange(HighlightTextInfo info)

Parameters

info

HighlightTextInfo

OnCreateAutomationPeer()

Creates a RadHighlightTextBlockAutomationPeer.

Declaration

cs-api-definition
protected override AutomationPeer OnCreateAutomationPeer()

Returns

AutomationPeer

OnInitialized(EventArgs)

Raises the event. This method is invoked whenever is set to true internally.

Declaration

cs-api-definition
protected override void OnInitialized(EventArgs e)

Parameters

e

EventArgs

The RoutedEventArgs that contains the event data.

ResetTheme()

Resets the theme.

Declaration

cs-api-definition
public void ResetTheme()

SetDefaultStyleKey()

Sets the default style key for StyleManager based on the current theme.

Declaration

cs-api-definition
protected virtual void SetDefaultStyleKey()