Skip to content

Conversation

Epica3055
Copy link
Member

@Epica3055 Epica3055 commented Apr 11, 2025

Fixes #13071

Proposed changes

  • revert PR#12431 , use another approach to fix Issue#12440
  • Introduce EditMouseDown flag in PropertyGridView.flag. This flag is on when the TextBox in the PropertyGrid.GridEntry is focused and is off when editing is done.
  • The cause of Issue#12440 is that after editing is done, GridEntryAccessibleObject will raise AutomationFocusChangedEvent

GridEntry.GridEntryAccessibleObject.cs

        ...
        internal override void SetFocus()
        {
            if (PropertyGridView is null || !PropertyGridView.IsHandleCreated)
            {
                return;
            }

            base.SetFocus();

            RaiseAutomationEvent(UIA_EVENT_ID.UIA_AutomationFocusChangedEventId);
        }

So in order to not let TextBox loose rectangle, add conditions to that event to exclude two cases:

  1. when InPropertySet is on
  2. when EditMouseDown is on

Regression?

  • Yes

Screenshots

Before

GetProperties method didn't get invoked described in #13071

After

Issues13071.01.mp4
Issues13071.02.mp4

Test methodology

  • manually

Test environment(s)

10.0.0-preview.3.25165.3

…not requery the property list in the PropertyGrid in .net 9 (worked in .net 8) : revert PR#12431 , use another approach.
Copy link

codecov bot commented Apr 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 62.56834%. Comparing base (88c3a11) to head (ccd78fc).
Report is 150 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #13295         +/-   ##
===================================================
+ Coverage   61.34314%   62.56834%   +1.22520%     
===================================================
  Files           1547        1560         +13     
  Lines         158479      159675       +1196     
  Branches       14751       14904        +153     
===================================================
+ Hits           97216       99906       +2690     
+ Misses         60561       59000       -1561     
- Partials         702         769         +67     
Flag Coverage Δ
Debug 62.56834% <ø> (-12.60374%) ⬇️
integration 11.31915% <ø> (-7.55283%) ⬇️
production 40.74551% <ø> (-34.42657%) ⬇️
test 95.69057% <ø> (∅)
unit 38.14619% <ø> (-36.11083%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dotnet-policy-service dotnet-policy-service bot added the draft draft PR label Apr 11, 2025
@Epica3055 Epica3055 marked this pull request as ready for review April 14, 2025 02:21
@Epica3055 Epica3055 requested a review from a team as a code owner April 14, 2025 02:21
@dotnet-policy-service dotnet-policy-service bot removed the draft draft PR label Apr 14, 2025
LeafShi1
LeafShi1 previously approved these changes Apr 15, 2025
Copy link
Member

@LeafShi1 LeafShi1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!Adding a new Flag is indeed a good idea.

@LeafShi1 LeafShi1 requested a review from Tanya-Solyanik April 15, 2025 08:47
@Tanya-Solyanik
Copy link
Contributor

@Epica3055 - is it possible to add unit test? Please send to @Olina-Zhang's team for testing

@Tanya-Solyanik Tanya-Solyanik added waiting-for-testing The PR is awaiting manual testing by the primary team; no action is yet required from the author(s) area-controls-PropertyGrid PropertyGrid and editor related issues and removed needs-area-label labels Apr 16, 2025
@Olina-Zhang
Copy link
Member

Tested this PR change, GH issues: 13071, 12440, 12421 were fixed. Also tested some properties values list to choose in expand/collapse state using Accessibility Tools: Inspect/AccessibilityInsight/Narrator/NVDA, no new issue found.

@Olina-Zhang Olina-Zhang removed the waiting-for-testing The PR is awaiting manual testing by the primary team; no action is yet required from the author(s) label Apr 16, 2025
Copy link
Contributor

@Tanya-Solyanik Tanya-Solyanik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, nice fix! Please backport it to 9!

@Epica3055
Copy link
Member Author

/backport to release/9.0

Copy link
Contributor

Started backporting to release/9.0: https://github.com/dotnet/winforms/actions/runs/14612889585

Copy link
Contributor

@Epica3055 backporting to release/9.0 failed, the patch most likely resulted in conflicts:

$ git am --3way --ignore-whitespace --keep-non-patch changes.patch

Applying: fix #13071 Changing properties with RefreshProperties.All does not requery the property list in the PropertyGrid in .net 9 (worked in .net 8) : revert PR#12431 , use another approach.
Using index info to reconstruct a base tree...
A	src/System.Windows.Forms/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/GridEntry.GridEntryAccessibleObject.cs
A	src/System.Windows.Forms/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.Flags.cs
A	src/System.Windows.Forms/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.cs
Falling back to patching base and 3-way merge...
Auto-merging src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.cs
CONFLICT (content): Merge conflict in src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/PropertyGridView.cs
Auto-merging src/System.Windows.Forms/src/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/GridEntry.GridEntryAccessibleObject.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 fix #13071 Changing properties with RefreshProperties.All does not requery the property list in the PropertyGrid in .net 9 (worked in .net 8) : revert PR#12431 , use another approach.
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

@Epica3055 Epica3055 merged commit 330a7c6 into dotnet:main Apr 23, 2025
8 checks passed
Tanya-Solyanik added a commit that referenced this pull request May 8, 2025
…ll does not requery the property list in the PropertyGrid in .net 9 (worked in .net 8) (#13356)

Backport of [#13295](#13295) to
release/9.0
 
Fixes #13071 


## Proposed changes

- 
- revert [PR#12431](#12431) , use
another approach to fix
[Issue#12440](#12440)
- Introduce `EditMouseDown` flag in PropertyGridView.flag. This flag is
on when the TextBox in the PropertyGrid.GridEntry is focused and is off
when editing is done.
- The cause of
[Issue#12440](#12440) is that
after editing is done, GridEntryAccessibleObject will raise
AutomationFocusChangedEvent

GridEntry.GridEntryAccessibleObject.cs
``` c#
        ...
        internal override void SetFocus()
        {
            if (PropertyGridView is null || !PropertyGridView.IsHandleCreated)
            {
                return;
            }

            base.SetFocus();

            RaiseAutomationEvent(UIA_EVENT_ID.UIA_AutomationFocusChangedEventId);
        }
```

So in order to not let TextBox loose rectangle, add conditions to that
event to exclude two cases:
1. when InPropertySet is on
2. when EditMouseDown is on


## Regression? 

- Yes

<!-- 
## Customer Impact

- 
- 

## Risk
-

 -->



## Screenshots <!-- Remove this section if PR does not change UI -->

### Before

GetProperties method didn't get invoked described in
[#13071](#13071)

### After



https://github.com/user-attachments/assets/4d013d27-8ebc-4020-a977-d2f825280bfc



https://github.com/user-attachments/assets/7885c561-f37f-45fd-971c-6af9686db030



## Test methodology <!-- How did you ensure quality? -->

- 
- manually 
- 
<!-- 
## Accessibility testing  
   -->
@github-actions github-actions bot locked and limited conversation to collaborators May 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-PropertyGrid PropertyGrid and editor related issues
Projects
None yet
4 participants