Method GetObjectPage
GetObjectPage(object?)
Retrieves the Page associated with the specified object instance.
public static Page? GetObjectPage(object? instance)
Parameters
instance
objectThe object for which to retrieve the associated Page. This can be a Page, View, or Control. If
instance
isnull
, the method attempts to retrieve the main page from the application.
Returns
- Page
The Page associated with the specified object instance, or the main page of the application if no associated page is found. Returns
null
if no page can be determined.
Remarks
This method attempts to resolve the associated Page based
on the type of the provided instance
. If the instance is a
View, the method uses utility logic to locate the parent page.
If the instance is a Control, it attempts to find
the parent page of the control. If no association can be determined, the main page
of the application is returned as a fallback.