[Proposal] Remove Screen from WindowBase #8204
Replies: 4 comments 4 replies
-
+1 I too come into problem because of this, should be static. |
Beta Was this translation helpful? Give feedback.
-
Not static, but it could be moved to the Application probably. |
Beta Was this translation helpful? Give feedback.
-
There's a good reason for this, something about how windows can be on different seats with a different screen configuration, so the available screens can depend on where the window is displayed. I'm not sure of the details though - @kekekeks can explain. |
Beta Was this translation helpful? Give feedback.
-
Having global variables greatly restricts possible Avalonia usage scenarios. Having global screens, for example, means that there is only one set of screens with windows movable between them, which is not true in the following scenarios (we don't support all of them yet, but we shouldn't deliberately prevent ourselves from supporting them):
So in general platform services and "global" state which isn't really so global should be only accessible via a TopLevel that is actually bound to that particular "global" state. |
Beta Was this translation helpful? Give feedback.
-
Avalonia/src/Avalonia.Controls/WindowBase.cs
Line 95 in 8ad9205
I would suggest removing the Screen property and making the members of the Screens class static.
Beta Was this translation helpful? Give feedback.
All reactions