winforms
winforms copied to clipboard
Add Click Through behavior to `ToolStrip`/`MenuStrip`
Fixes #9288 Fixes #9240 Fixes #9277 Fixed #2544
Unsure on the attributes for the new property and whether or not an auto implemented property is okay.
I went with 'AllowClickThrough' because I thought it was more self documenting.
My development environment isn't fully setup yet so this was a very quick pr without any testing.
Microsoft Reviewers: Open in CodeFlow
@merriemcgaw here is the PR.
My assumption here is that MenuStrip
inherits from ToolStrip
and so it should also get the property and behavior.
I have been able to test it and it looks like its working.
@rickbrew here is the ToolStrip ClickThrough changes if you wanted to review.
Can we have a global/static property for this, or at least to configure the default property value? This seems like a property that will be set to the same value for everything in an app — it would be unusual to have a mix of values throughout an app’s UI, in other words. It would be easy to accidentally not set the property on a new piece of UI, resulting in bug churn. Or maybe some kind of inherited property ala WPF, where we set the property at the top of the UI tree and all the child controls use that for their default value.
Excellent point. I am unsure how to go about that. I'll have to ask the team what they prefer and for an example.
... resulting in bug churn
BTW this is not theoretical -- I found a bug just a few months ago where a top-level ToolStrip
was not using click-through (with my modified WndProc
). It had been like that for years and nobody noticed / reported it. It was the only piece of UI that wasn't using it.
... resulting in bug churn
BTW this is not theoretical -- I found a bug just a few months ago where a top-level
ToolStrip
was not using click-through (with my modifiedWndProc
). It had been like that for years and nobody noticed / reported it. It was the only piece of UI that wasn't using it.
Yes, those kinds of bugs suck. We do need a centralised method of switching it.
Thanks @elachlan. team will review PR this week and share feedback.
This is awaiting API review. Now that we are in .NET 9, we plan on going through all our API suggestions in the beginning of the new year. Thank you for your patience!
Needs to solve conflicts. Otherwise LGTM.
@ricardobossan we are waiting on an API review from the team to get this included in .NET9.
@elachlan we'll be getting those API reviews early in the new year!
@merriemcgaw Just checking this is still on the radar?
Thanks for the ping @elachlan I do want this in .NET 9 for sure!
@lonitra / @JeremyKuhne can you guys get the API through review? Should we get this in now with a Preview flag while they are pending the official review?
@lonitra can you please review this? API has been approved!!
Codecov Report
Attention: Patch coverage is 16.66667%
with 5 lines
in your changes missing coverage. Please review.
Project coverage is 74.59186%. Comparing base (
2a6733d
) to head (e76fda0
). Report is 18 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #9349 +/- ##
===================================================
+ Coverage 74.55540% 74.59186% +0.03645%
===================================================
Files 3040 3041 +1
Lines 629493 629688 +195
Branches 46835 46839 +4
===================================================
+ Hits 469321 469696 +375
+ Misses 156818 156624 -194
- Partials 3354 3368 +14
Flag | Coverage Δ | |
---|---|---|
Debug | 74.59186% <16.66667%> (+0.03645%) |
:arrow_up: |
integration | 17.96192% <16.66667%> (-0.00812%) |
:arrow_down: |
production | 47.52611% <16.66667%> (+0.02471%) |
:arrow_up: |
test | 96.97607% <ø> (+0.02160%) |
:arrow_up: |
unit | 44.56790% <16.66667%> (+0.04910%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.