Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a MeasureUpdated event and look at deprecating SizeChanged for LayoutUpdated #23274

Open
PureWeen opened this issue Jun 26, 2024 · 0 comments
Labels
area-controls-general General issues that span multiple controls, or common base classes such as View or Element t/perf The issue affects performance (runtime speed, memory usage, startup time, etc.)

Comments

@PureWeen
Copy link
Member

PureWeen commented Jun 26, 2024

Description

The SizeChanged event is called from the arrange pass on each platform. At the point that you're doing an arrange pass everything should have its proper size. If you modify the size of anything during the arrange pass it's going to trigger a new layout loop. We see a lot of patterns where people will listen to the SizeChanged event and then modify the size of something else based on this change. This is always going to trigger a second layout loop. This is also going to happen if users are binding to the Height/Width property on controls

Things to Investigate

  • Can we give an accurate size for the controls inside the measure loop?
  • We could just wire up to the platform sizechanged events and propagate these out as MeasureUpdated

Current workarounds

  • if you're curious to watch the SizeChanged of something to influence another control. Try inheriting from the control and overriding "MeasureOverride". Use the result of this to size other elements.
@PureWeen PureWeen added this to the .NET 9 Planning milestone Jun 26, 2024
@dotnet-policy-service dotnet-policy-service bot added the s/triaged Issue has been reviewed label Jun 26, 2024
@PureWeen PureWeen added area-controls-general General issues that span multiple controls, or common base classes such as View or Element t/perf The issue affects performance (runtime speed, memory usage, startup time, etc.) and removed s/triaged Issue has been reviewed labels Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-general General issues that span multiple controls, or common base classes such as View or Element t/perf The issue affects performance (runtime speed, memory usage, startup time, etc.)
Projects
None yet
Development

No branches or pull requests

1 participant