Class MauiUtils
Contains static methods and properties related to MAUI platform.
public static class MauiUtils
- Inheritance
-
MauiUtils
Properties
- ControlViews
Gets collection of ControlView elements added to pages of the application.
- Controls
Gets collection of Control added to pages of the application inside ControlView elements.
- IsDarkTheme
Gets whether current application theme is dark.
- Pages
Gets collection of all pages in the application. If application is not yet created, returns an empty collection. Uses Windows, Page, ModalStack, NavigationStack in order to get the result.
- Windows
Gets collection of all windows in the application. This is safe property and it returns an empty collection if application is not yet created.
Methods
- AddAllViewsToParent(Layout)
Debug related method. Do not use directly.
- AllParents(Element?)
Enumerates all parent elements of the specified VisualElement.
- CloseApplication()
Closes the application.
- EnumViewsToLog(Layout)
Debug related method. Do not use directly.
- FindViewInContainer<T>(VisualElement)
Finds a view of the specified type inside a container.
- GetAbsoluteLayoutChild(Page)
Gets the first AbsoluteLayout child from a Page using IVisualTreeElement.
- GetAbsolutePosition(VisualElement)
Gets the absolute position of a VisualElement relative to its ancestors.
- GetAllChildren<T>()
Gets collection of View elements added to pages of the application.
- GetChildren<T>(object?, bool)
Gets collection of the child elements in the specified container.
- GetDevicePlatform()
Gets device platform.
- GetDeviceType()
Gets device the app is running on, such as a desktop computer or a tablet.
- GetFirstWindowPage()
Gets the current page of the first window in the application.
- GetMainPageFromApplication()
Gets main page from the first window of the application.
- GetObjectAbsoluteLayout(object?)
Retrieves the AbsoluteLayout associated with the specified object instance.
- GetObjectPage(object?)
Retrieves the Page associated with the specified object instance.
- GetObjectView(object?)
Retrieves the View associated with the specified object, if available.
- GetPage(VisualElement?)
Gets the page that contains the specified view.
- GetParentAbsoluteLayout(Element?)
Retrieves the nearest parent AbsoluteLayout that contains the specified view.
- GetParentPage(AbstractControl?)
Gets parent Page for the specified control. If control is not attached to the parent, this function returns main page.
- GetRootChild(Page)
Retrieves the root child element of the specified Page.
- GetSpecialParent<T>(Element?)
Searches for the closest parent of type
T
in the view hierarchy.
- GetTopAbsoluteLayout(Element?)
Retrieves the highest-level parent
AbsoluteLayout
that contains the specified element.
- GetTopSpecialParent<T>(Element?)
Searches for the highest-level parent of type
T
in the element hierarchy.
- HideViewsInContainer<T>(VisualElement?, Type?)
Hides all child views of the specified type within the given container.
- ImageSourceFromImage(Image?)
Converts an Image to an SKBitmapImageSource.
- ImageSourceFromSvg(SvgImage?, int, bool)
Creates ImageSource with disabled images from the specified SvgImage.
- ImageSourceFromSvg(SvgImage?, int, bool, bool)
Creates ImageSource from the specified SvgImage.
- IsAndroid()
Checks whether device platform is Android.
- IsIOS()
Checks whether device platform is iOS.
- IsMacCatalyst()
Checks whether device platform is MacCatalyst.
- IsMacOS()
Checks whether device platform is macOS.
- SetButtonImage(Button, SvgImage?, int, bool)
Sets the image for a Button using the specified SVG image and size.
- SetButtonImage(ImageButton, SvgImage?, int)
Sets the image for a ImageButton using the specified SVG image and size.
- SetWindowSoftInputModeAdjust(Window?, bool)
Sets soft input mode for the window.
- SuppressMenuBarFocus()
Disables focus-related interactions for the menu bar on supported platforms.
- TrySetFocusWithTimeout(object?)
Attempts to set focus on the specified object within a predefined timeout period.