MauiHandlersCollectionExtensions.AddHandler 方法

定义

重载

AddHandler(IMauiHandlersCollection, Type, Type)

通过 AddTransient 向基础服务容器注册处理程序。

AddHandler<TType,TTypeRender>(IMauiHandlersCollection)

通过 AddTransient 向基础服务容器注册处理程序。

AddHandler<TType>(IMauiHandlersCollection, Func<IServiceProvider,IElementHandler>)

通过 AddTransient 向基础服务容器注册处理程序。

AddHandler(IMauiHandlersCollection, Type, Type)

Source:
MauiHandlersCollectionExtensions.cs
Source:
MauiHandlersCollectionExtensions.cs

通过 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

参数

handlersCollection
IMauiHandlersCollection

元素集合

viewType
Type

要注册的视图类型

handlerType
Type

表示元素的处理程序类型

返回

处理程序集合

适用于

AddHandler<TType,TTypeRender>(IMauiHandlersCollection)

Source:
MauiHandlersCollectionExtensions.cs
Source:
MauiHandlersCollectionExtensions.cs

通过 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

类型参数

TType

要注册的元素的类型

TTypeRender

表示元素的处理程序类型

参数

handlersCollection
IMauiHandlersCollection

处理程序集合

返回

处理程序集合

适用于

AddHandler<TType>(IMauiHandlersCollection, Func<IServiceProvider,IElementHandler>)

Source:
MauiHandlersCollectionExtensions.cs
Source:
MauiHandlersCollectionExtensions.cs

通过 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

类型参数

TType

要注册的元素的类型

参数

handlersCollection
IMauiHandlersCollection

处理程序集合

handlerImplementationFactory
Func<IServiceProvider,IElementHandler>

用于创建处理程序的工厂方法

返回

处理程序集合

适用于