Skip to content

Commit 4733a54

Browse files
authored
Evaluate TextBox.LineCount only once in UpdateAttachedProperties (#3874)
1 parent 66b836b commit 4733a54

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/MaterialDesignThemes.Wpf/Behaviors/TextBoxLineCountBehavior.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ private void UpdateAttachedProperties()
1818
associatedObject.Dispatcher
1919
.BeginInvoke(() =>
2020
{
21-
associatedObject.SetCurrentValue(TextFieldAssist.TextBoxLineCountProperty, associatedObject.LineCount);
22-
associatedObject.SetCurrentValue(TextFieldAssist.TextBoxIsMultiLineProperty, associatedObject.LineCount > 1);
21+
int lineCount = associatedObject.LineCount;
22+
associatedObject.SetCurrentValue(TextFieldAssist.TextBoxLineCountProperty, lineCount);
23+
associatedObject.SetCurrentValue(TextFieldAssist.TextBoxIsMultiLineProperty, lineCount > 1);
2324
},
2425
DispatcherPriority.Background);
2526
}

0 commit comments

Comments
 (0)