This commit is contained in:
Javier Suárez 2021-07-18 19:48:44 +02:00
Родитель bd5a730d18
Коммит fa49ffb197
1 изменённых файлов: 18 добавлений и 1 удалений

Просмотреть файл

@ -274,4 +274,21 @@ public partial class App : Application
#endif
}
}
```
```
### Registering the handler
Unlike Xamarin.Forms using the ExportRenderer attribute which in turn made use of Assembly Scanning, in .NET MAUI the handler registration is slightly different.
```
appBuilder
.UseMauiApp<App>()
.ConfigureMauiHandlers(handlers =>
{
#if __ANDROID__
handlers.AddHandler(typeof(CustomEntry), typeof(CustomEntryHandler));
#endif
});
```
We make use of AppHostBuilder and the **AddHandler** method to register the Handler. In the end, it requires, as in Xamarin.Forms, a line to indicate that we want to register the Handler, but the use of Assembly Scanning is avoided, which is slow and expensive, penalizing startup.