MartyIX
This line https://github.com/VladislavAntonyuk/MauiSamples/blob/739531a109e4c95d8703faee10c4c63accea72e6/MauiCursor/CursorBehavior.cs#L11 reports the following warning in .NET 9: ``` CS0618 'Application.MainPage.get' is obsolete: 'This property has been deprecated. For single-window applications, use Windows[0].Page. For multi-window applications, identify and use the appropriate Window object to access the desired Page. Additionally, each element features a Window property, accessible when it's part of the current window. ``` However, I wonder how to fix the warning. ```diff -visualElement.SetHoverCursor((CursorIcon)newValue, Application.Current?.MainPage?.Handler?.MauiContext); +visualElement.SetHoverCursor((CursorIcon)newValue, visualElement.Window?.Handler?.MauiContext); // not possible as `visualElement.Window `is null ``` So I was thinking if one can do ```diff -visualElement.SetHoverCursor((CursorIcon)newValue, Application.Current?.MainPage?.Handler?.MauiContext); + IMauiContext? mauiContext = visualElement.Window?.Handler?.MauiContext + ?? Application.Current?.Windows[0].Handler?.MauiContext; +visualElement.SetHoverCursor((CursorIcon)newValue, mauiContext); ``` but I'm not really sure if it's a correct way to approach it. Would anyone know please? cc @VladislavAntonyuk