Pārlūkot izejas kodu

Merge pull request #1850 from MihaMarkic/passwordchar_affects_render

Fixes #1847 PasswordChar change doesn't affect render
Jumar Macato 7 gadi atpakaļ
vecāks
revīzija
d0b05adf8a
1 mainītis faili ar 8 papildinājumiem un 0 dzēšanām
  1. 8 0
      src/Avalonia.Controls/Presenters/TextPresenter.cs

+ 8 - 0
src/Avalonia.Controls/Presenters/TextPresenter.cs

@@ -35,6 +35,11 @@ namespace Avalonia.Controls.Presenters
         private int _selectionEnd;
         private bool _caretBlink;
         private IBrush _highlightBrush;
+        
+        static TextPresenter()
+        {
+            AffectsRender(PasswordCharProperty);
+        }
 
         public TextPresenter()
         {
@@ -49,6 +54,9 @@ namespace Avalonia.Controls.Presenters
 
             this.GetObservable(CaretIndexProperty)
                 .Subscribe(CaretIndexChanged);
+
+            this.GetObservable(PasswordCharProperty)
+                .Subscribe(_ => InvalidateFormattedText());
         }
 
         public int CaretIndex