Share via


Routing.GetOrCreateContent(String, IServiceProvider) Method

Definition

Gets or creates content for the specified route using dependency injection services.

public static Microsoft.Maui.Controls.Element GetOrCreateContent(string route, IServiceProvider services = default);
static member GetOrCreateContent : string * IServiceProvider -> Microsoft.Maui.Controls.Element
Public Shared Function GetOrCreateContent (route As String, Optional services As IServiceProvider = Nothing) As Element

Parameters

route
String

The route string to get or create content for.

services
IServiceProvider

Optional service provider for dependency injection when creating new content instances.

Returns

The Element associated with the route, or null if not found and cannot be created.

Applies to