Routing.GetOrCreateContent(String, IServiceProvider) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.