Skip to content

Commit

Permalink
TextBoxLineCountBehavior: Fixed issue with UpdateAttachedProperties b…
Browse files Browse the repository at this point in the history
…eing called after detached causing NullReferenceException (#3769)
  • Loading branch information
JorisCleVR authored Jan 13, 2025
1 parent 32e2584 commit 0ff7d5d
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ public class TextBoxLineCountBehavior : Behavior<TextBox>

private void UpdateAttachedProperties()
{
AssociatedObject.SetCurrentValue(TextFieldAssist.TextBoxLineCountProperty, AssociatedObject.LineCount);
AssociatedObject.SetCurrentValue(TextFieldAssist.TextBoxIsMultiLineProperty, AssociatedObject.LineCount > 1);
if (AssociatedObject != null)
{
AssociatedObject.SetCurrentValue(TextFieldAssist.TextBoxLineCountProperty, AssociatedObject.LineCount);
AssociatedObject.SetCurrentValue(TextFieldAssist.TextBoxIsMultiLineProperty, AssociatedObject.LineCount > 1);
}
}

protected override void OnAttached()
Expand Down

0 comments on commit 0ff7d5d

Please sign in to comment.