FindMyFiles
FindMyFiles.Highlighting
HighlightText Class
Attached behavior that renders SourceProperty into a TextBlock's Inlines, emphasizing the spans named by RangesProperty with bold + accent foreground. Lets the result list's name/path cells show match highlights without giving up their TextBlock styles, x:Phase, or virtualization: the same cell instance is reused across rows, and FindMyFiles.Highlighting.HighlightText.Rebuild(Microsoft.UI.Xaml.Controls.TextBlock,System.String,System.Collections.Generic.IReadOnlyList{FindMyFiles.Highlighting.HighlightRange}) clears and refills it on every change so a reused container never shows the previous row's text.
public static class HighlightText
Inheritance System.Object → HighlightText
Fields
HighlightText.RangesProperty Field
Ranges of SourceProperty to emphasize (UTF-16 coordinates, sorted and merged by the highlighter).
public static readonly DependencyProperty RangesProperty;
Field Value
Microsoft.UI.Xaml.DependencyProperty
HighlightText.SourceProperty Field
The full text to display (set with RangesProperty; either change rebuilds the inlines).
public static readonly DependencyProperty SourceProperty;
Field Value
Microsoft.UI.Xaml.DependencyProperty
Methods
HighlightText.GetRanges(DependencyObject) Method
Get the highlight ranges from element.
public static System.Collections.Generic.IReadOnlyList<FindMyFiles.Highlighting.HighlightRange>? GetRanges(Microsoft.UI.Xaml.DependencyObject element);
Parameters
element Microsoft.UI.Xaml.DependencyObject
The element to read the highlight ranges from.
Returns
System.Collections.Generic.IReadOnlyList<HighlightRange>
The highlight ranges, or null if none are set.
HighlightText.GetSource(DependencyObject) Method
Get the display text from element.
public static string? GetSource(Microsoft.UI.Xaml.DependencyObject element);
Parameters
element Microsoft.UI.Xaml.DependencyObject
The element to read the display text from.
Returns
System.String
The display text, or null if none is set.
HighlightText.SetRanges(DependencyObject, IReadOnlyList<HighlightRange>) Method
Set the highlight ranges on element.
public static void SetRanges(Microsoft.UI.Xaml.DependencyObject element, System.Collections.Generic.IReadOnlyList<FindMyFiles.Highlighting.HighlightRange>? value);
Parameters
element Microsoft.UI.Xaml.DependencyObject
The element to set the highlight ranges on.
value System.Collections.Generic.IReadOnlyList<HighlightRange>
The ranges to emphasize.
HighlightText.SetSource(DependencyObject, string) Method
Set the display text on element.
public static void SetSource(Microsoft.UI.Xaml.DependencyObject element, string? value);
Parameters
element Microsoft.UI.Xaml.DependencyObject
The element to set the display text on.
value System.String
The text to display.