Skip to content

Commit 6154d0a

Browse files
committed
1.2.1.8
1 parent ce01b3b commit 6154d0a

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

SourceCode/SharedResources/Panuon.WPF.UI/Helpers/TextBlockHelper.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.ComponentModel;
23
using System.Text.RegularExpressions;
34
using System.Windows;
45
using System.Windows.Controls;
@@ -11,6 +12,21 @@ public static class TextBlockHelper
1112
{
1213
#region Properties
1314

15+
#region Text
16+
public static string GetText(TextBlock textBlock)
17+
{
18+
return (string)textBlock.GetValue(TextProperty);
19+
}
20+
21+
public static void SetText(TextBlock textBlock, string value)
22+
{
23+
textBlock.SetValue(TextProperty, value);
24+
}
25+
26+
public static readonly DependencyProperty TextProperty =
27+
DependencyProperty.RegisterAttached("Text", typeof(string), typeof(TextBlockHelper), new PropertyMetadata(OnHighlightTextChanged));
28+
#endregion
29+
1430
#region HighlightText
1531
public static string GetHighlightText(TextBlock textBlock)
1632
{
@@ -97,7 +113,7 @@ private static void OnHighlightTextChanged(DependencyObject d, DependencyPropert
97113
{
98114
return;
99115
}
100-
var text = textBlock.Text;
116+
var text = GetText(textBlock);
101117
var regex = GetHighlightRegex(textBlock);
102118
var highlightText = GetHighlightText(textBlock);
103119
var foreground = GetHighlightForeground(textBlock);
@@ -143,7 +159,7 @@ private static void OnHighlightTextChanged(DependencyObject d, DependencyPropert
143159
index = match.Index;
144160
matchText = match.Value;
145161

146-
if (string.IsNullOrEmpty(matchText)
162+
if (string.IsNullOrEmpty(matchText)
147163
|| rule == HighlightRule.FirstOnly)
148164
{
149165
textBlock.Inlines.Add(new Run(text));

SourceCode/SharedResources/Panuon.WPF.UI/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@
2525
ResourceDictionaryLocation.SourceAssembly
2626
)]
2727

28-
[assembly: AssemblyVersion("1.2.1.7")]
29-
[assembly: AssemblyFileVersion("1.2.1.7")]
28+
[assembly: AssemblyVersion("1.2.1.8")]
29+
[assembly: AssemblyFileVersion("1.2.1.8")]

0 commit comments

Comments
 (0)