Skip to content

Commit 343a284

Browse files
authored
Fix issue #3819 (#3820)
This change prevents an issue where the AssociatedObject unexpectedly changes in an non thread-safe manner.
1 parent c9864ca commit 343a284

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/MaterialDesignThemes.Wpf/Behaviors/TextBoxLineCountBehavior.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ public class TextBoxLineCountBehavior : Behavior<TextBox>
1212

1313
private void UpdateAttachedProperties()
1414
{
15-
if (AssociatedObject != null)
15+
if (AssociatedObject is { } associatedObject)
1616
{
17-
AssociatedObject.SetCurrentValue(TextFieldAssist.TextBoxLineCountProperty, AssociatedObject.LineCount);
18-
AssociatedObject.SetCurrentValue(TextFieldAssist.TextBoxIsMultiLineProperty, AssociatedObject.LineCount > 1);
17+
associatedObject.SetCurrentValue(TextFieldAssist.TextBoxLineCountProperty, associatedObject.LineCount);
18+
associatedObject.SetCurrentValue(TextFieldAssist.TextBoxIsMultiLineProperty, associatedObject.LineCount > 1);
1919
}
2020
}
2121

0 commit comments

Comments
 (0)