共用方式為


MauiHandlersCollectionExtensions.AddHandler 方法

定義

多載

AddHandler(IMauiHandlersCollection, Type, Type)

透過 AddTransient 向基礎服務容器註冊處理程式。

AddHandler<TType,TTypeRender>(IMauiHandlersCollection)

透過 AddTransient 向基礎服務容器註冊處理程式。

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

透過 AddTransient 向基礎服務容器註冊處理程式。

AddHandler(IMauiHandlersCollection, Type, Type)

來源:
MauiHandlersCollectionExtensions.cs
來源:
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)

來源:
MauiHandlersCollectionExtensions.cs
來源:
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>)

來源:
MauiHandlersCollectionExtensions.cs
來源:
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>

用來建立處理程式的 Factory 方法

傳回

處理程式集合

適用於