From f4adaf65dc745979b9b99c0d0026726a1f4d6444 Mon Sep 17 00:00:00 2001 From: "Leaf Shi (BEYONDSOFT CONSULTING INC)" Date: Wed, 6 Nov 2024 14:53:38 +0800 Subject: [PATCH 1/3] Fix editor text box focus issue when switching value property grid view --- .../PropertyGrid/PropertyGridInternal/PropertyGridView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.cs index 91b70cb5d58..c1a32c563e5 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.cs @@ -3997,7 +3997,7 @@ private void Refresh(bool fullRefresh, int startRow, int endRow) startRow = 0; } - if (fullRefresh || OwnerGrid.HavePropertyEntriesChanged()) + if (OwnerGrid.HavePropertyEntriesChanged()) { if (HasEntries && !InPropertySet && !CommitEditTextBox()) { From d3cfc7230f07363e1e6b47c7d65e6fd2386a11de Mon Sep 17 00:00:00 2001 From: "Leaf Shi (BEYONDSOFT CONSULTING INC)" Date: Thu, 7 Nov 2024 18:49:45 +0800 Subject: [PATCH 2/3] Override function SelectInternal in file PropertyGridView.GridViewTextBox.cs --- .../PropertyGridView.GridViewTextBox.cs | 9 +++++++++ .../PropertyGridInternal/PropertyGridView.cs | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.GridViewTextBox.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.GridViewTextBox.cs index 10984600a7b..7398bdd65e5 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.GridViewTextBox.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.GridViewTextBox.cs @@ -306,6 +306,15 @@ private unsafe bool WmNotify(ref Message m) return false; } + private protected override void SelectInternal(int start, int length, int textLen) + { + base.SelectInternal(start, length, textLen); + if (IsAccessibilityObjectCreated) + { + AccessibilityObject.RaiseAutomationEvent(UIA_EVENT_ID.UIA_AutomationFocusChangedEventId); + } + } + protected override void WndProc(ref Message m) { if (_filter && PropertyGridView.FilterEditWndProc(ref m)) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.cs index c1a32c563e5..91b70cb5d58 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.cs @@ -3997,7 +3997,7 @@ private void Refresh(bool fullRefresh, int startRow, int endRow) startRow = 0; } - if (OwnerGrid.HavePropertyEntriesChanged()) + if (fullRefresh || OwnerGrid.HavePropertyEntriesChanged()) { if (HasEntries && !InPropertySet && !CommitEditTextBox()) { From 7b9e0f231fdfccd4f35012df0ee3d0e49144bcb6 Mon Sep 17 00:00:00 2001 From: "Leaf Shi (BEYONDSOFT CONSULTING INC)" Date: Thu, 14 Nov 2024 14:14:55 +0800 Subject: [PATCH 3/3] Removing fullRefresh condition from function Refresh --- .../PropertyGridView.GridViewTextBox.cs | 9 --------- .../PropertyGridInternal/PropertyGridView.cs | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.GridViewTextBox.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.GridViewTextBox.cs index 7398bdd65e5..10984600a7b 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.GridViewTextBox.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.GridViewTextBox.cs @@ -306,15 +306,6 @@ private unsafe bool WmNotify(ref Message m) return false; } - private protected override void SelectInternal(int start, int length, int textLen) - { - base.SelectInternal(start, length, textLen); - if (IsAccessibilityObjectCreated) - { - AccessibilityObject.RaiseAutomationEvent(UIA_EVENT_ID.UIA_AutomationFocusChangedEventId); - } - } - protected override void WndProc(ref Message m) { if (_filter && PropertyGridView.FilterEditWndProc(ref m)) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.cs index 91b70cb5d58..c1a32c563e5 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.cs @@ -3997,7 +3997,7 @@ private void Refresh(bool fullRefresh, int startRow, int endRow) startRow = 0; } - if (fullRefresh || OwnerGrid.HavePropertyEntriesChanged()) + if (OwnerGrid.HavePropertyEntriesChanged()) { if (HasEntries && !InPropertySet && !CommitEditTextBox()) {