From 517e860b27db8fe6619e5410c1ef3f9f0211f7c9 Mon Sep 17 00:00:00 2001 From: Jumar Macato Date: Mon, 24 Aug 2020 18:51:45 +0800 Subject: [PATCH] Disable commands when Textbox is on password textbox mode. --- src/Avalonia.Controls/TextBox.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Avalonia.Controls/TextBox.cs b/src/Avalonia.Controls/TextBox.cs index a07aeb16f1..73a1ae3335 100644 --- a/src/Avalonia.Controls/TextBox.cs +++ b/src/Avalonia.Controls/TextBox.cs @@ -456,9 +456,9 @@ namespace Avalonia.Controls private void UpdateCommandStates() { var text = GetSelection(); - var isNullOrEmpty = string.IsNullOrEmpty(text); - CanCopy = !isNullOrEmpty; - CanCut = !isNullOrEmpty && !IsReadOnly; + var isSelectionNullOrEmpty = string.IsNullOrEmpty(text); + CanCopy = !IsPasswordBox && !isSelectionNullOrEmpty; + CanCut = !IsPasswordBox && !isSelectionNullOrEmpty && !IsReadOnly; CanPaste = !IsReadOnly; }