浏览代码

Merge pull request #1850 from MihaMarkic/passwordchar_affects_render

Fixes #1847 PasswordChar change doesn't affect render
Jumar Macato 7 年之前
父节点
当前提交
d0b05adf8a
共有 1 个文件被更改,包括 8 次插入0 次删除
  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