MauiHandlersCollectionExtensions.AddHandler 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.
Overloads
AddHandler(IMauiHandlersCollection, Type, Type) |
Registers a handler with the underlying service container via AddTransient. |
AddHandler<TType,TTypeRender>(IMauiHandlersCollection) |
Registers a handler with the underlying service container via AddTransient. |
AddHandler<TType>(IMauiHandlersCollection, Func<IServiceProvider,IElementHandler>) |
Registers a handler with the underlying service container via AddTransient. |
AddHandler(IMauiHandlersCollection, Type, Type)
Registers a handler with the underlying service container via AddTransient.
public:
[System::Runtime::CompilerServices::Extension]
static Microsoft::Maui::Hosting::IMauiHandlersCollection ^ AddHandler(Microsoft::Maui::Hosting::IMauiHandlersCollection ^ handlersCollection, Type ^ viewType, Type ^ handlerType);
public static Microsoft.Maui.Hosting.IMauiHandlersCollection AddHandler (this Microsoft.Maui.Hosting.IMauiHandlersCollection handlersCollection, Type viewType, Type handlerType);
static member AddHandler : Microsoft.Maui.Hosting.IMauiHandlersCollection * Type * Type -> Microsoft.Maui.Hosting.IMauiHandlersCollection
<Extension()>
Public Function AddHandler (handlersCollection As IMauiHandlersCollection, viewType As Type, handlerType As Type) As IMauiHandlersCollection
Parameters
- handlersCollection
- IMauiHandlersCollection
The element collection
- viewType
- Type
The type of view to register
- handlerType
- Type
The handler type that represents the element
Returns
The handler collection
Applies to
AddHandler<TType,TTypeRender>(IMauiHandlersCollection)
Registers a handler with the underlying service container via AddTransient.
public:
generic <typename TType, typename TTypeRender>
where TType : Microsoft::Maui::IElement where TTypeRender : Microsoft::Maui::IElementHandler[System::Runtime::CompilerServices::Extension]
static Microsoft::Maui::Hosting::IMauiHandlersCollection ^ AddHandler(Microsoft::Maui::Hosting::IMauiHandlersCollection ^ handlersCollection);
public static Microsoft.Maui.Hosting.IMauiHandlersCollection AddHandler<TType,TTypeRender> (this Microsoft.Maui.Hosting.IMauiHandlersCollection handlersCollection) where TType : Microsoft.Maui.IElement where TTypeRender : Microsoft.Maui.IElementHandler;
static member AddHandler : Microsoft.Maui.Hosting.IMauiHandlersCollection -> Microsoft.Maui.Hosting.IMauiHandlersCollection (requires 'ype :> Microsoft.Maui.IElement and 'ypeRender :> Microsoft.Maui.IElementHandler)
<Extension()>
Public Function AddHandler(Of TType As IElement, TTypeRender As IElement) (handlersCollection As IMauiHandlersCollection) As IMauiHandlersCollection
Type Parameters
- TType
The type of element to register
- TTypeRender
The handler type that represents the element
Parameters
- handlersCollection
- IMauiHandlersCollection
The handler collection
Returns
The handler collection
Applies to
AddHandler<TType>(IMauiHandlersCollection, Func<IServiceProvider,IElementHandler>)
Registers a handler with the underlying service container via AddTransient.
public:
generic <typename TType>
where TType : Microsoft::Maui::IElement[System::Runtime::CompilerServices::Extension]
static Microsoft::Maui::Hosting::IMauiHandlersCollection ^ AddHandler(Microsoft::Maui::Hosting::IMauiHandlersCollection ^ handlersCollection, Func<IServiceProvider ^, Microsoft::Maui::IElementHandler ^> ^ handlerImplementationFactory);
public static Microsoft.Maui.Hosting.IMauiHandlersCollection AddHandler<TType> (this Microsoft.Maui.Hosting.IMauiHandlersCollection handlersCollection, Func<IServiceProvider,Microsoft.Maui.IElementHandler> handlerImplementationFactory) where TType : Microsoft.Maui.IElement;
static member AddHandler : Microsoft.Maui.Hosting.IMauiHandlersCollection * Func<IServiceProvider, Microsoft.Maui.IElementHandler> -> Microsoft.Maui.Hosting.IMauiHandlersCollection (requires 'ype :> Microsoft.Maui.IElement)
<Extension()>
Public Function AddHandler(Of TType As IElement) (handlersCollection As IMauiHandlersCollection, handlerImplementationFactory As Func(Of IServiceProvider, IElementHandler)) As IMauiHandlersCollection
Type Parameters
- TType
The type of element to register
Parameters
- handlersCollection
- IMauiHandlersCollection
The handler collection
- handlerImplementationFactory
- Func<IServiceProvider,IElementHandler>
A factory method to create the handler
Returns
The handler collection