dotnet / dotnet/maui

ContentPanel subscribes to its own SizeChanged event

Open
#29,554 1 comment 0 reactions 0 assignees View on GitHub
area-architecture perf/general platform/windows
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 10h
Merged PRs (30d)
297

Description

### Description

ContentPanel subscribes to its own SizeChanged event

ContentPanel.cs, the backing panel for ContentView on Windows. In the constructor, someone added a subscription to the ContentPanel's _own_ SizeChanged event and handles it to update some border and clipping stuff. Any change in size of the ContentPanel is going to be preceded by a measure/arrange pass; any changes to the border or clipping size/shape should be handled during the arrange step. Handling it after SizeChanged risks kicking off a whole other measure/arrange pass, which is bad for performance. And worse, it might make the border/clipping lag behind the size/shape changes of the panel itself.
I'm not 100% certain this is wrong, but if there is a good reason to do it this way, then it absolutely needs to be called out in the comments, because it's weird.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.