Skip to content

Commit 9d4809c

Browse files
committed
trigger RichSuggestToken PropertyChanged individually
1 parent d091e6a commit 9d4809c

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

Microsoft.Toolkit.Uwp.UI.Controls.Input/RichSuggestBox/RichSuggestToken.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,26 @@ public RichSuggestToken(Guid id, string displayText)
6363

6464
internal void UpdateTextRange(ITextRange range)
6565
{
66-
bool invoke = _range == null || RangeStart != range.StartPosition || RangeEnd != range.EndPosition;
66+
bool rangeStartChanged = RangeStart != range.StartPosition;
67+
bool rangeEndChanged = RangeEnd != range.EndPosition;
68+
bool positionChanged = _range == null || rangeStartChanged;
6769
_range = range.GetClone();
6870
RangeStart = _range.StartPosition;
6971
RangeEnd = _range.EndPosition;
7072

71-
if (invoke)
73+
if (rangeStartChanged)
7274
{
73-
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(string.Empty));
75+
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(RangeStart)));
76+
}
77+
78+
if (rangeEndChanged)
79+
{
80+
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(RangeEnd)));
81+
}
82+
83+
if (positionChanged)
84+
{
85+
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Position)));
7486
}
7587
}
7688

0 commit comments

Comments
 (0)