SlideShare una empresa de Scribd logo
1 de 40
#MonkeyConf
.NET MAUI
Handlers
SPONSORS
Antes de empezar,
¿qué es .NET MAUI?
El viaje hacia un único .NET
– .De .NET 5 a .NET 6
.NET Framework
Mono / Xamarin
.NET Core.NET
Un SDK, un BCL, herramientas unificadas
Mobile & Desktop Cross-platform UI nativa
UI web Cross-platform
Investigaciones en la nube
Continuar mejorando la velocidad, tamaño, diagnóstico en
servicios Azure
La vision de un .NET
UI nativa multiplataforma
Proyecto único, base de código única
Implementar en múltiples dispositivos, móviles y de
escritorio
Evolución de Xamarin.Forms
Dirigido a .NET 6, disponible a finales del próximo año
Crear interfaces de usuario atractivas para cualquier dispositivo
La evolución de Xamarin.Forms
.NET MAUI
.NET Platform
.NET MAUI
Proyectos SDK-style
Proyecto único
Soporte CLI
.NET 6 BCL
Multi-paradigma
• Interfaz de usuario compatible con XAML y C#
• Listo para Blazor y C# MVU
DESKTOP MOBILE
Windows
macOS
iOS
Android
.NET MAUI
File | New
• Multi-platform App UI (.NET)
CLI
• dotnet install maui
• dotnet new maui
Namespaces
• System.Maui (previously Xamarin.Forms)
• System.Device (previously Xamarin.
Los objetivos de .NET MAUI
La arquitectura de .NET MAUI
Las API de Android, iOS, macOS y Windows están unificadas en una API abstracta que permite una experiencia
de desarrollo que permita escribir una vez y ejecutar en cualquier plataforma, al tiempo que proporciona un
acceso total a todos los aspectos de cada plataforma nativa.
App Code interactúa principalmente con .NET
MAUI API (1).
Según sea necesario, App Code puede acceder
directamente las API de la plataforma (2) a través
Handlers, etc.
.NET MAUI accede directamente las API de la
plataforma nativa (3).
Android iOS macOS Windows
Xamarin.Android Xamarin.iOS Xamarin.Mac WinUI
.NET MAUI
App Code
Mono Runtime WinRT
.NET 6 BCL
1
2
3
¿Handlers?
.NET MAUI no tiene renderers
.NET MAUI usa handlers
Glosario de términos
¿Cuáles son los problemas de arquitectura de Xamarin.Forms?
Xamarin.Forms.Button
- Los Renderers estan muy acoplados a componentes Xamarin.Forms
[assembly: ExportRenderer (typeof(MyEntry), typeof(MyEntryRenderer))]
namespace CustomRenderer.iOS {
public class MyEntryRenderer : EntryRenderer
- Assembly Scanning es realmente lento
- Realmente dificil de acceder a la plataforma nativa desde código xplat
using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.iOSSpecific;
boxView.On<iOS>().UseBlurEffect(BlurEffectStyle.ExtraLight);
Xamarin.Forms: Añadir un comportamiento personalizado, podría ser más sencillo
// You need to know to export this renderer and tie it to a core type…
[assembly: ExportRenderer (typeof(MyEntry), typeof(MyEntryRenderer))]
namespace CustomRenderer.iOS
{
// You need to know what type to inherit from…
public class MyEntryRenderer : EntryRenderer
{
// You need to know what method to override…
protected override void OnElementChanged (ElementChangedEventArgs<Entry> e)
{
// You need to know when to do your work (before? after?)
base.OnElementChanged (e);
// You need to know that we call the native view “Control”
// Spoiler alert: this varies from platform to platform and
// sometimes it even varies from renderer to renderer!
if (Control != null) {
// Finally! We can change the color!
public class MyEntry : Entry
{
}
Los objetivos con .NET MAUI
- Desacoplar los Renderers de Xamarin.Forms
IButton
Los objetivos con .NET MAUI
- Mejorar el rendimiento es uno de los objetivos principales
- Desde el proyecto xplat, registre fácilmente cualquier handler personalizado
RegistrarHandlers.Handlers.Register<Xamarin.Forms.Label, LabelHandler>();
#if MONOANDROID
RegistrarHandlers.Handlers.Register<Xamarin.Forms.Label,
Xamarin.Forms.Platform.Android.LabelRenderer>();
RegistrarHandlers.Handlers.Register<Xamarin.Forms.Button,
Xamarin.Forms.Platform.Android.AppCompat.ButtonRenderer>();
#endif
- No hacer assembly scanning
Los objetivos con .NET MAUI
- Permitir acceder a código nativo con facilidad
using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.iOSSpecific;
boxView.On<iOS>().UseBlurEffect(BlurEffectStyle.ExtraLight);
[assembly: ExportRenderer (typeof(MyEntry), typeof(MyEntryRenderer))]
namespace CustomRenderer.iOS {
public class MyEntryRenderer : EntryRenderer
- Eliminar APIs confusas
#if MONOANDROID
ViewHandler.ViewMapper[nameof(IView.BackgroundColor)] = (handler, view) =>
(handler.NativeView as
AView).SetBackgroundColor(Xamarin.Forms.Color.Purple.ToNative());
var textView = crossPlatformLabel.Handler.NativeView as TextView;
#endif
Los Renderers actuales
 Fundamentalmente es un control nativo
 Implementa IVisualElementRenderer
public interface IVisualElementRenderer
{
VisualElement Element { get; }
VisualElementTracker Tracker { get; }
AView View { get; }
event EventHandler<VisualElementChangedEventArgs> ElementChanged;
event EventHandler<PropertyChangedEventArgs> ElementPropertyChanged;
SizeRequest GetDesiredSize(int widthConstraint, int heightConstraint);
void SetElement(VisualElement element);
void SetLabelFor(int? id);
void UpdateLayout();
}
public interface IViewHandler
{
void SetView(IView view);
void UpdateValue(string property);
void Remove(IView view);
object NativeView { get; }
bool HasContainer { get; set; }
SizeRequest GetDesiredSize(double widthConstraint, double heightConstraint);
void SetFrame(Rectangle frame);
}
public interface IVisualElementRenderer
{
VisualElement Element { get; }
VisualElementTracker Tracker { get; }
AView View { get; }
event EventHandler<VisualElementChangedEventArgs> ElementChanged;
event EventHandler<PropertyChangedEventArgs> ElementPropertyChanged;
SizeRequest GetDesiredSize(int widthConstraint, int heightConstraint);
void SetElement(VisualElement element);
void SetLabelFor(int? id);
void UpdateLayout();
}
IVisualElementRenderer
IViewHandler - .NET
MAUI
IView & IViewHandler
public interface IViewHandler
{
void SetView(IView view);
void UpdateValue(string property);
void Remove(IView view);
object NativeView { get; }
bool HasContainer { get; set; }
SizeRequest GetDesiredSize(double widthConstraint, double heightConstraint);
void SetFrame(Rectangle frame);
}
public interface IView
{
Rectangle Frame { get; }
IViewHandler Handler { get; set; }
IView Parent { get; }
void Arrange(Rectangle bounds);
SizeRequest Measure(double widthConstraint, double heightConstraint);
SizeRequest DesiredSize { get; }
La estrategia actual con Xamarin.Forms Renderers
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs
e)
{
if (e.PropertyName == Button.TextColorProperty.PropertyName)
UpdateTextColor();
else if (e.PropertyName == VisualElement.IsEnabledProperty.PropertyName)
UpdateEnabled();
else if (e.PropertyName == Button.FontProperty.PropertyName)
UpdateFont();
else if (e.PropertyName == Button.CharacterSpacingProperty.PropertyName)
UpdateCharacterSpacing();
base.OnElementPropertyChanged(sender, e);
}
private void UpdateFont()
private void UpdateTextColor()
La estrategia con Handlers en .NET MAUI
public partial class LabelHandler : AbstractViewHandler<ILabel, TextView>
{
protected override TextView CreateView() => new TextView(Context);
public static void MapText(IViewHandler handler, ILabel view) =>
(handler as LabelHandler).TypedNativeView.UpdateText(view);
}
public static class TextViewExtensions
{
public static void UpdateText(this TextView textView, IText text)
{
textView.Text = text.Text;
}
public partial class LabelHandler
{
public static PropertyMapper<ILabel> LabelMapper =
new PropertyMapper<ILabel>(ViewHandler.ViewMapper)
{
[nameof(ILabel.Text)] = MapPropertyText,
Los Handlers son “solo” una reorganización
public static class TextViewExtensions
{
public static void UpdateText(this TextView textView, IText text)
{
textView.Text = text.Text;
}
public class LabelRenderer : ViewRenderer<Label, TextView>
{
void UpdateText()
{
textView.Text = text.Text;
}
Xamarin.Forms: Personalizar el comportamiento de un control
// You need to know to export this renderer and tie it to a core type…
[assembly: ExportRenderer (typeof(MyEntry), typeof(MyEntryRenderer))]
namespace CustomRenderer.iOS
{
// You need to know what type to inherit from…
public class MyEntryRenderer : EntryRenderer
{
// You need to know what method to override…
protected override void OnElementChanged (ElementChangedEventArgs<Entry> e)
{
// You need to know when to do your work (before? after?)
base.OnElementChanged (e);
// You need to know that we call the native view “Control”
// Spoiler alert: this varies from platform to platform and
// sometimes it even varies from renderer to renderer!
if (Control != null) {
// Finally! We can change the color!
public class MyEntry : Entry
{
}
Maui: Personalizar el comportamiento de un control
// You don’t need to register a new renderer.
public partial class EntryRenderer
{
// You know what method to call because you named it!
public static void MapBackgroundColor (IViewRenderer renderer, IView view)
{
// You don’t need to call any base methods here or worry about order.
// Every renderer is consistent; you know where the native view is.
var nativeView = (NativeView)renderer.NativeView;
var color = view.BackgroundColor;
if (color != null) {
// Phew! That was easy!
nativeView.BackgroundColor = UIColor.FromRGB (204, 153, 255);
}
}
}
public partial class EntryRenderer {
public static PropertyMapper<IView> ViewMapper = new
PropertyMapper<IView> {
// Add your own method to map to any property
[nameof(IView.BackgroundColor)] = MapBackgroundColor
};
}
Maui: Personalizar el comportamiento de un control
#if MONOANDROID
ButtonRenderer.ButtonMapper[nameof(IButton.TextColor)] = (handler, view) =>
{
var nativeView = handler.NativeView as Aview;
// Add your own logic to map the TextColor property
};
#endif
Veamos como
funcionan los
Handlers de .NET
MAUI
Veamos como hacer el
port de un
Xamarin.Forms Renderer
a un .NET MAUI Handler
Pero…
Renderer to Handler &
Handler to Renderer
Shims
https://github.com/xamarin/Xamarin.Forms/pull/12546
.NET MAUI e inyección de dependencias
.NET MAUI usará el concepto de Host similar a ASP.NET. Esto permitirá usar Containers y providers
para nuestros handlers al igual que permitir configuraciones con archivos appsettings, y otras
posibilidades como gestionar el ciclo de vida de cada plataforma, registrar servicios, logging
extensions etc.
El AppBuilder estará oculto por defecto, pero se podrá sobreescribir y usarlo para extender y registrar
servicios, configurar logging o registrar nuevos handlers.
En .NET MAUI, vamos a usar Microsoft Dependency Injection para permitir registrar custom handlers.
var (host,app) = App.CreateDefaultBuilder()
.RegisterHandler<IButton, CustomHandlers.CustomPinkTextButtonHandler>()
.ConfigureServices(ConfigureExtraServices)
.Init<MyApp>();
var page = app.GetStartup()
https://github.com/xamarin/Xamarin.Forms/pull/12460
¿Y que ocurre con los renderers de Xamarin.Forms?
En Xamarin.Forms se usaba el atributo ExportRenderer para registrar un Renderer. Internamente en Xamarin.Forms, se usa el escaneo de
ensamblados para buscar y registrar los Renderers.
En .NET MAUI, el escaneo de ensamblado no se usará por defecto, y permitiremos registrar un Renderer de esta manera:
Sin embargo, permitiremos en los casos deseados registrar Renderers usando el escaneo de ensamblaje:
var (host,app) = App.CreateDefaultBuilder()
.RegisterRenderer<CustomBoxView, CustomBoxViewRenderer>()
.ConfigureServices(ConfigureExtraServices)
.Init<MyApp>();
var page = app.GetStartup()
var (host,app) = App.CreateDefaultBuilder()
.ConfigureRenderers( options => options.ScanForRendererAttribute = true)
.ConfigureServices(ConfigureExtraServices)
.Init<MyApp>();
var page = app.GetStartup()
Usando los Renderers “antiguos” en .NET MAUI
Puedes elegir la que más te convenga en cada caso, pero ten en cuenta
que:
Usando Handlers:
• Requiere "algo de tiempo" para la conversión de código.
• Cada Handler es equivalente a un Fast Renderer además de ser
gestionado de forma diferente por Layouts que tienen un mejor
rendimiento.
• Permita más opciones de extensibilidad.
Usando Renderers:
• No requiere cambios.
• No aprovecha ninguna de las mejoras de los Handlers (rendimiento,
extensibilidad, etc.)
Mezclando renderers y
handlers en la misma App
.NET MAUI
La arquitectura de .NET MAUI
.NET MAUI utiliza Layouts multiplataforma, interfaces para definir controles, métodos de extension con las
vistas nativas e implementaciones usando vistas nativas. Se utilizan los mismos controles nativos
independientemente de MVVM, MVU, RxUI, Blazor, etc.
Interfaces
System.Maui.Views son interfaces que describen
cada control.
IButton > IText > IView
Handlers
Estos son las abstracciones e implementaciones de
cada control sin conocimiento de MVU o MVVM.
System.Maui.Handlers:
• ButtonHandler.Android.cs
• ButtonHandler.Mac.cs
• ButtonHandler.Standard.cs
• ButtonHandler.Win32.cs
• ButtonHandler.cs
• ButtonHandler.iOS.cs
Patrones
Estas implementaciones de controles añaden soporte a los
patrones de diseño soportados.
System.Maui.Bindables contiene las capacidades relacionadas con
MVVM, y controles con soporte a databinding.
El trabajo con .NET MAUI Handlers
• Nueva arquitectura de Renderers
• Nueva metodología
• Nueva organización
• Nueva arquitectura de Layouts
• Eliminar obsoletos
• Eliminar “slow” renderers
• Eliminar pre-AppCompat
• Unificar APIs entre Xamarin.Forms y
Xamarin.Essentials
• Usar
Microsoft.Extensions.DependencyInjection
• Cross-Platform Lifecycle
• Corregir “AndExpand”
• Corregir “MinHeightRequest” & similares
• Usar GlideX
 Migration Tool con try-convert
 Xamarin Native -> .NET 6
 Xamarin.Forms -> .NET MAUI
• .NET 5.0 se ha lanzado en Noviembre 2020
• Xamarin.Forms 5.0 en Diciembre 2020
• .NET 6.0 MAUI + soporte a móvil previews con .NET 6 Preview 1
El roadmap de .NET
Dic 2019
.NET Core 3.1
LTS
Nov 2020
.NET 5.0
Nov 2021
.NET 6.0
LTS
Nov 2022
.NET 7.0
Nov 2023
.NET 8.0
LTS
Preguntas &
Respuestas
Gracias!
Gracias a nuestros Sponsors.
Sin ellos el evento no sería posible.

Más contenido relacionado

La actualidad más candente

Monkey Conf 2019: Presente y futuro de Xamarin.Forms
Monkey Conf 2019: Presente y futuro de Xamarin.FormsMonkey Conf 2019: Presente y futuro de Xamarin.Forms
Monkey Conf 2019: Presente y futuro de Xamarin.FormsJavier Suárez Ruiz
 
DotNet 2019: Optimizando Apps con Xamarin.Forms
DotNet 2019: Optimizando Apps con Xamarin.FormsDotNet 2019: Optimizando Apps con Xamarin.Forms
DotNet 2019: Optimizando Apps con Xamarin.FormsJavier Suárez Ruiz
 
OpenSouthCode 2018: Taller Xamarin
OpenSouthCode 2018: Taller XamarinOpenSouthCode 2018: Taller Xamarin
OpenSouthCode 2018: Taller XamarinJavier Suárez Ruiz
 
SVQXDG - Introducción a Embeddinator-4000
SVQXDG - Introducción a Embeddinator-4000SVQXDG - Introducción a Embeddinator-4000
SVQXDG - Introducción a Embeddinator-4000Javier Suárez Ruiz
 
WinObjC: Windows Bridge para iOS
WinObjC: Windows Bridge para iOSWinObjC: Windows Bridge para iOS
WinObjC: Windows Bridge para iOSJavier Suárez Ruiz
 
Integración Continua con Apps Xamarin
Integración Continua con Apps XamarinIntegración Continua con Apps Xamarin
Integración Continua con Apps XamarinJavier Suárez Ruiz
 
Xamarin Dev Days Málaga 2017 - Apps conectadas con Azure
Xamarin Dev Days Málaga 2017 - Apps conectadas con AzureXamarin Dev Days Málaga 2017 - Apps conectadas con Azure
Xamarin Dev Days Málaga 2017 - Apps conectadas con AzureJavier Suárez Ruiz
 
Reconnect(); Sevilla - Introducción a Xamarin 4
Reconnect(); Sevilla - Introducción a Xamarin 4Reconnect(); Sevilla - Introducción a Xamarin 4
Reconnect(); Sevilla - Introducción a Xamarin 4Javier Suárez Ruiz
 
Trucos y consejos rendimiento Xamarin.Forms
Trucos y consejos rendimiento Xamarin.FormsTrucos y consejos rendimiento Xamarin.Forms
Trucos y consejos rendimiento Xamarin.FormsJavier Suárez Ruiz
 
Windows 10: Hel10 World! - Novedades XAML
Windows 10: Hel10 World! - Novedades XAMLWindows 10: Hel10 World! - Novedades XAML
Windows 10: Hel10 World! - Novedades XAMLJavier Suárez Ruiz
 
Arquitectura xamarin - Nuestra primera app
Arquitectura xamarin - Nuestra primera appArquitectura xamarin - Nuestra primera app
Arquitectura xamarin - Nuestra primera appBorja García Cueto
 
Microsoft Tech Summit - Taller Xamarin
Microsoft Tech Summit - Taller XamarinMicrosoft Tech Summit - Taller Xamarin
Microsoft Tech Summit - Taller XamarinJavier Suárez Ruiz
 
Interfaces nativas Cross-Platform con Xamarin.Forms
Interfaces nativas Cross-Platform con Xamarin.FormsInterfaces nativas Cross-Platform con Xamarin.Forms
Interfaces nativas Cross-Platform con Xamarin.FormsJavier Suárez Ruiz
 

La actualidad más candente (20)

.Net Conf Sevilla 2018
.Net Conf Sevilla 2018.Net Conf Sevilla 2018
.Net Conf Sevilla 2018
 
Monkey Conf 2019: Presente y futuro de Xamarin.Forms
Monkey Conf 2019: Presente y futuro de Xamarin.FormsMonkey Conf 2019: Presente y futuro de Xamarin.Forms
Monkey Conf 2019: Presente y futuro de Xamarin.Forms
 
DotNet 2019: Optimizando Apps con Xamarin.Forms
DotNet 2019: Optimizando Apps con Xamarin.FormsDotNet 2019: Optimizando Apps con Xamarin.Forms
DotNet 2019: Optimizando Apps con Xamarin.Forms
 
Extendiendo Xamarin.Forms
Extendiendo Xamarin.FormsExtendiendo Xamarin.Forms
Extendiendo Xamarin.Forms
 
OpenSouthCode 2018: Taller Xamarin
OpenSouthCode 2018: Taller XamarinOpenSouthCode 2018: Taller Xamarin
OpenSouthCode 2018: Taller Xamarin
 
SVQXDG - Introducción a Embeddinator-4000
SVQXDG - Introducción a Embeddinator-4000SVQXDG - Introducción a Embeddinator-4000
SVQXDG - Introducción a Embeddinator-4000
 
WinObjC: Windows Bridge para iOS
WinObjC: Windows Bridge para iOSWinObjC: Windows Bridge para iOS
WinObjC: Windows Bridge para iOS
 
Xamarin REvolve 2016
Xamarin REvolve 2016Xamarin REvolve 2016
Xamarin REvolve 2016
 
Integración Continua con Apps Xamarin
Integración Continua con Apps XamarinIntegración Continua con Apps Xamarin
Integración Continua con Apps Xamarin
 
Introducción a Xamarin
Introducción a XamarinIntroducción a Xamarin
Introducción a Xamarin
 
Xamarin Dev Days Málaga 2017 - Apps conectadas con Azure
Xamarin Dev Days Málaga 2017 - Apps conectadas con AzureXamarin Dev Days Málaga 2017 - Apps conectadas con Azure
Xamarin Dev Days Málaga 2017 - Apps conectadas con Azure
 
Reconnect(); Sevilla - Introducción a Xamarin 4
Reconnect(); Sevilla - Introducción a Xamarin 4Reconnect(); Sevilla - Introducción a Xamarin 4
Reconnect(); Sevilla - Introducción a Xamarin 4
 
Trucos y consejos rendimiento Xamarin.Forms
Trucos y consejos rendimiento Xamarin.FormsTrucos y consejos rendimiento Xamarin.Forms
Trucos y consejos rendimiento Xamarin.Forms
 
Servicios Xamarin
Servicios XamarinServicios Xamarin
Servicios Xamarin
 
Windows 10: Hel10 World! - Novedades XAML
Windows 10: Hel10 World! - Novedades XAMLWindows 10: Hel10 World! - Novedades XAML
Windows 10: Hel10 World! - Novedades XAML
 
Desktop App Converter
Desktop App ConverterDesktop App Converter
Desktop App Converter
 
Arquitectura xamarin - Nuestra primera app
Arquitectura xamarin - Nuestra primera appArquitectura xamarin - Nuestra primera app
Arquitectura xamarin - Nuestra primera app
 
Microsoft Tech Summit - Taller Xamarin
Microsoft Tech Summit - Taller XamarinMicrosoft Tech Summit - Taller Xamarin
Microsoft Tech Summit - Taller Xamarin
 
Interfaces nativas Cross-Platform con Xamarin.Forms
Interfaces nativas Cross-Platform con Xamarin.FormsInterfaces nativas Cross-Platform con Xamarin.Forms
Interfaces nativas Cross-Platform con Xamarin.Forms
 
Novedades de Xamarin 4
Novedades de Xamarin 4Novedades de Xamarin 4
Novedades de Xamarin 4
 

Similar a Monkey Conf 2020: .NET MAUI Handlers

Unidad jme-02--ingbarcia-final
Unidad jme-02--ingbarcia-finalUnidad jme-02--ingbarcia-final
Unidad jme-02--ingbarcia-finalOrlando Barcia
 
Java ME (Micro Edition)
Java ME (Micro Edition) Java ME (Micro Edition)
Java ME (Micro Edition) Anderson Rubio
 
LabAndroid: Taller "Mi Primera Aplicación Android"
LabAndroid: Taller "Mi Primera Aplicación Android"LabAndroid: Taller "Mi Primera Aplicación Android"
LabAndroid: Taller "Mi Primera Aplicación Android"Alberto Ruibal
 
La web como Plataforma con Dojo Toolkit
La web como Plataforma con Dojo ToolkitLa web como Plataforma con Dojo Toolkit
La web como Plataforma con Dojo ToolkitAlex Fuentes
 
Estrategias para desarrollo crossplatform en Windows Phone 8 y Windows 8
Estrategias para desarrollo crossplatform en Windows Phone 8 y Windows 8Estrategias para desarrollo crossplatform en Windows Phone 8 y Windows 8
Estrategias para desarrollo crossplatform en Windows Phone 8 y Windows 8Sorey García
 
Desymfony 2011 - Tutorial #1: Instalacion y primeros pasos
Desymfony 2011 - Tutorial #1: Instalacion y primeros pasosDesymfony 2011 - Tutorial #1: Instalacion y primeros pasos
Desymfony 2011 - Tutorial #1: Instalacion y primeros pasosJavier Eguiluz
 
Taller de programación
Taller de programaciónTaller de programación
Taller de programaciónRafa Perez
 
Deletreando Android
Deletreando AndroidDeletreando Android
Deletreando Androidjezabelink
 
eyeOS: Arquitectura y desarrollo de una aplicación
eyeOS: Arquitectura y desarrollo de una aplicacióneyeOS: Arquitectura y desarrollo de una aplicación
eyeOS: Arquitectura y desarrollo de una aplicaciónJose Luis Lopez Pino
 
Xamarin - Aplicaciones Móviles con .Net
Xamarin - Aplicaciones Móviles con .Net Xamarin - Aplicaciones Móviles con .Net
Xamarin - Aplicaciones Móviles con .Net Andrés Londoño
 
inLab FIB MeteorJS workshop by uLab UPC - Telefonica I+D
inLab FIB MeteorJS workshop by uLab UPC - Telefonica I+DinLab FIB MeteorJS workshop by uLab UPC - Telefonica I+D
inLab FIB MeteorJS workshop by uLab UPC - Telefonica I+DinLabFIB
 
Extendiendo Xamarin.Forms con Custom Renders
Extendiendo Xamarin.Forms con Custom RendersExtendiendo Xamarin.Forms con Custom Renders
Extendiendo Xamarin.Forms con Custom RendersJavier Suárez Ruiz
 

Similar a Monkey Conf 2020: .NET MAUI Handlers (20)

Xamarin Forms y MVVM
Xamarin Forms y MVVMXamarin Forms y MVVM
Xamarin Forms y MVVM
 
Unidad jme-02--ingbarcia-final
Unidad jme-02--ingbarcia-finalUnidad jme-02--ingbarcia-final
Unidad jme-02--ingbarcia-final
 
Java ME (Micro Edition)
Java ME (Micro Edition) Java ME (Micro Edition)
Java ME (Micro Edition)
 
LabAndroid: Taller "Mi Primera Aplicación Android"
LabAndroid: Taller "Mi Primera Aplicación Android"LabAndroid: Taller "Mi Primera Aplicación Android"
LabAndroid: Taller "Mi Primera Aplicación Android"
 
La web como Plataforma con Dojo Toolkit
La web como Plataforma con Dojo ToolkitLa web como Plataforma con Dojo Toolkit
La web como Plataforma con Dojo Toolkit
 
Curso c sharp
Curso c sharpCurso c sharp
Curso c sharp
 
Estrategias para desarrollo crossplatform en Windows Phone 8 y Windows 8
Estrategias para desarrollo crossplatform en Windows Phone 8 y Windows 8Estrategias para desarrollo crossplatform en Windows Phone 8 y Windows 8
Estrategias para desarrollo crossplatform en Windows Phone 8 y Windows 8
 
Desymfony 2011 - Tutorial #1: Instalacion y primeros pasos
Desymfony 2011 - Tutorial #1: Instalacion y primeros pasosDesymfony 2011 - Tutorial #1: Instalacion y primeros pasos
Desymfony 2011 - Tutorial #1: Instalacion y primeros pasos
 
Taller de programación
Taller de programaciónTaller de programación
Taller de programación
 
Deletreando Android
Deletreando AndroidDeletreando Android
Deletreando Android
 
eyeOS: Arquitectura y desarrollo de una aplicación
eyeOS: Arquitectura y desarrollo de una aplicacióneyeOS: Arquitectura y desarrollo de una aplicación
eyeOS: Arquitectura y desarrollo de una aplicación
 
GWT
GWTGWT
GWT
 
Gwt III - Avanzado
Gwt III - AvanzadoGwt III - Avanzado
Gwt III - Avanzado
 
introducción a flutter
introducción a flutterintroducción a flutter
introducción a flutter
 
J2me midlet1
J2me  midlet1J2me  midlet1
J2me midlet1
 
Xamarin - Aplicaciones Móviles con .Net
Xamarin - Aplicaciones Móviles con .Net Xamarin - Aplicaciones Móviles con .Net
Xamarin - Aplicaciones Móviles con .Net
 
inLab FIB MeteorJS workshop by uLab UPC - Telefonica I+D
inLab FIB MeteorJS workshop by uLab UPC - Telefonica I+DinLab FIB MeteorJS workshop by uLab UPC - Telefonica I+D
inLab FIB MeteorJS workshop by uLab UPC - Telefonica I+D
 
Introduccion android
Introduccion androidIntroduccion android
Introduccion android
 
Custom Renderers Made Simple
Custom Renderers Made SimpleCustom Renderers Made Simple
Custom Renderers Made Simple
 
Extendiendo Xamarin.Forms con Custom Renders
Extendiendo Xamarin.Forms con Custom RendersExtendiendo Xamarin.Forms con Custom Renders
Extendiendo Xamarin.Forms con Custom Renders
 

Más de Javier Suárez Ruiz

Cape Town MS Developer User Group: Xamarin Community Toolkit
Cape Town MS Developer User Group: Xamarin Community ToolkitCape Town MS Developer User Group: Xamarin Community Toolkit
Cape Town MS Developer User Group: Xamarin Community ToolkitJavier Suárez Ruiz
 
Monkey Conf 2020: Xamarin Community Toolkit: More possibilities with Xamarin....
Monkey Conf 2020: Xamarin Community Toolkit: More possibilities with Xamarin....Monkey Conf 2020: Xamarin Community Toolkit: More possibilities with Xamarin....
Monkey Conf 2020: Xamarin Community Toolkit: More possibilities with Xamarin....Javier Suárez Ruiz
 
Crear interfaces de usuario atractivas con Xamarin.Forms
Crear interfaces de usuario atractivas con Xamarin.FormsCrear interfaces de usuario atractivas con Xamarin.Forms
Crear interfaces de usuario atractivas con Xamarin.FormsJavier Suárez Ruiz
 
Desarrollo Xamarin, más allá del desarrollo
Desarrollo Xamarin, más allá del desarrolloDesarrollo Xamarin, más allá del desarrollo
Desarrollo Xamarin, más allá del desarrolloJavier Suárez Ruiz
 
Aumento de productividad, herramientas Xamarin
Aumento de productividad, herramientas XamarinAumento de productividad, herramientas Xamarin
Aumento de productividad, herramientas XamarinJavier Suárez Ruiz
 
Plain Concepts Tech Day: Desarrollo de aplicaciones multiplataforma con Xamarin
Plain Concepts Tech Day:  Desarrollo de aplicaciones multiplataforma con XamarinPlain Concepts Tech Day:  Desarrollo de aplicaciones multiplataforma con Xamarin
Plain Concepts Tech Day: Desarrollo de aplicaciones multiplataforma con XamarinJavier Suárez Ruiz
 
Novedades Xamarin Connect(); 2017
Novedades Xamarin Connect(); 2017Novedades Xamarin Connect(); 2017
Novedades Xamarin Connect(); 2017Javier Suárez Ruiz
 
Codemotion 2017 - Taller Xamarin
Codemotion 2017 - Taller XamarinCodemotion 2017 - Taller Xamarin
Codemotion 2017 - Taller XamarinJavier Suárez Ruiz
 
dotNetMálaga 2017 - Taller Hololens con Wave Engine
dotNetMálaga 2017 - Taller Hololens con Wave EnginedotNetMálaga 2017 - Taller Hololens con Wave Engine
dotNetMálaga 2017 - Taller Hololens con Wave EngineJavier Suárez Ruiz
 
Xamarin Hol - Módulo V: Mobile DevOps con Visual Studio Team Services y Hocke...
Xamarin Hol - Módulo V: Mobile DevOps con Visual Studio Team Services y Hocke...Xamarin Hol - Módulo V: Mobile DevOps con Visual Studio Team Services y Hocke...
Xamarin Hol - Módulo V: Mobile DevOps con Visual Studio Team Services y Hocke...Javier Suárez Ruiz
 
Xamarin Dev Days Madrid 2017 - Xamarin.Forms
Xamarin Dev Days Madrid 2017 -  Xamarin.FormsXamarin Dev Days Madrid 2017 -  Xamarin.Forms
Xamarin Dev Days Madrid 2017 - Xamarin.FormsJavier Suárez Ruiz
 

Más de Javier Suárez Ruiz (16)

Cape Town MS Developer User Group: Xamarin Community Toolkit
Cape Town MS Developer User Group: Xamarin Community ToolkitCape Town MS Developer User Group: Xamarin Community Toolkit
Cape Town MS Developer User Group: Xamarin Community Toolkit
 
Monkey Conf 2020: Xamarin Community Toolkit: More possibilities with Xamarin....
Monkey Conf 2020: Xamarin Community Toolkit: More possibilities with Xamarin....Monkey Conf 2020: Xamarin Community Toolkit: More possibilities with Xamarin....
Monkey Conf 2020: Xamarin Community Toolkit: More possibilities with Xamarin....
 
Crear interfaces de usuario atractivas con Xamarin.Forms
Crear interfaces de usuario atractivas con Xamarin.FormsCrear interfaces de usuario atractivas con Xamarin.Forms
Crear interfaces de usuario atractivas con Xamarin.Forms
 
#XamarinUIJuly Summary
#XamarinUIJuly Summary#XamarinUIJuly Summary
#XamarinUIJuly Summary
 
Novedades Xamarin 3.0 Preview
Novedades Xamarin 3.0 PreviewNovedades Xamarin 3.0 Preview
Novedades Xamarin 3.0 Preview
 
Desarrollo Xamarin, más allá del desarrollo
Desarrollo Xamarin, más allá del desarrolloDesarrollo Xamarin, más allá del desarrollo
Desarrollo Xamarin, más allá del desarrollo
 
Introducción a Xamarin.Forms
Introducción a Xamarin.FormsIntroducción a Xamarin.Forms
Introducción a Xamarin.Forms
 
Introducción a Xamarin
Introducción a XamarinIntroducción a Xamarin
Introducción a Xamarin
 
Aumento de productividad, herramientas Xamarin
Aumento de productividad, herramientas XamarinAumento de productividad, herramientas Xamarin
Aumento de productividad, herramientas Xamarin
 
Plain Concepts Tech Day: Desarrollo de aplicaciones multiplataforma con Xamarin
Plain Concepts Tech Day:  Desarrollo de aplicaciones multiplataforma con XamarinPlain Concepts Tech Day:  Desarrollo de aplicaciones multiplataforma con Xamarin
Plain Concepts Tech Day: Desarrollo de aplicaciones multiplataforma con Xamarin
 
Novedades Xamarin Connect(); 2017
Novedades Xamarin Connect(); 2017Novedades Xamarin Connect(); 2017
Novedades Xamarin Connect(); 2017
 
Codemotion 2017 - Taller Xamarin
Codemotion 2017 - Taller XamarinCodemotion 2017 - Taller Xamarin
Codemotion 2017 - Taller Xamarin
 
dotNetMálaga 2017 - Taller Hololens con Wave Engine
dotNetMálaga 2017 - Taller Hololens con Wave EnginedotNetMálaga 2017 - Taller Hololens con Wave Engine
dotNetMálaga 2017 - Taller Hololens con Wave Engine
 
Embeddinator-4000
Embeddinator-4000Embeddinator-4000
Embeddinator-4000
 
Xamarin Hol - Módulo V: Mobile DevOps con Visual Studio Team Services y Hocke...
Xamarin Hol - Módulo V: Mobile DevOps con Visual Studio Team Services y Hocke...Xamarin Hol - Módulo V: Mobile DevOps con Visual Studio Team Services y Hocke...
Xamarin Hol - Módulo V: Mobile DevOps con Visual Studio Team Services y Hocke...
 
Xamarin Dev Days Madrid 2017 - Xamarin.Forms
Xamarin Dev Days Madrid 2017 -  Xamarin.FormsXamarin Dev Days Madrid 2017 -  Xamarin.Forms
Xamarin Dev Days Madrid 2017 - Xamarin.Forms
 

Último

SalmorejoTech 2024 - Spring Boot <3 Testcontainers
SalmorejoTech 2024 - Spring Boot <3 TestcontainersSalmorejoTech 2024 - Spring Boot <3 Testcontainers
SalmorejoTech 2024 - Spring Boot <3 TestcontainersIván López Martín
 
El uso de las TIC's en la vida cotidiana.
El uso de las TIC's en la vida cotidiana.El uso de las TIC's en la vida cotidiana.
El uso de las TIC's en la vida cotidiana.241514949
 
Cortes-24-de-abril-Tungurahua-3 año 2024
Cortes-24-de-abril-Tungurahua-3 año 2024Cortes-24-de-abril-Tungurahua-3 año 2024
Cortes-24-de-abril-Tungurahua-3 año 2024GiovanniJavierHidalg
 
Redes direccionamiento y subredes ipv4 2024 .pdf
Redes direccionamiento y subredes ipv4 2024 .pdfRedes direccionamiento y subredes ipv4 2024 .pdf
Redes direccionamiento y subredes ipv4 2024 .pdfsoporteupcology
 
El gusano informático Morris (1988) - Julio Ardita (1995) - Citizenfour (2014...
El gusano informático Morris (1988) - Julio Ardita (1995) - Citizenfour (2014...El gusano informático Morris (1988) - Julio Ardita (1995) - Citizenfour (2014...
El gusano informático Morris (1988) - Julio Ardita (1995) - Citizenfour (2014...JaquelineJuarez15
 
ATAJOS DE WINDOWS. Los diferentes atajos para utilizar en windows y ser más e...
ATAJOS DE WINDOWS. Los diferentes atajos para utilizar en windows y ser más e...ATAJOS DE WINDOWS. Los diferentes atajos para utilizar en windows y ser más e...
ATAJOS DE WINDOWS. Los diferentes atajos para utilizar en windows y ser más e...FacuMeza2
 
La era de la educación digital y sus desafios
La era de la educación digital y sus desafiosLa era de la educación digital y sus desafios
La era de la educación digital y sus desafiosFundación YOD YOD
 
Crear un recurso multimedia. Maricela_Ponce_DomingoM1S3AI6-1.pptx
Crear un recurso multimedia. Maricela_Ponce_DomingoM1S3AI6-1.pptxCrear un recurso multimedia. Maricela_Ponce_DomingoM1S3AI6-1.pptx
Crear un recurso multimedia. Maricela_Ponce_DomingoM1S3AI6-1.pptxNombre Apellidos
 
GonzalezGonzalez_Karina_M1S3AI6... .pptx
GonzalezGonzalez_Karina_M1S3AI6... .pptxGonzalezGonzalez_Karina_M1S3AI6... .pptx
GonzalezGonzalez_Karina_M1S3AI6... .pptx241523733
 
ejercicios pseint para aprogramacion sof
ejercicios pseint para aprogramacion sofejercicios pseint para aprogramacion sof
ejercicios pseint para aprogramacion sofJuancarlosHuertasNio1
 
dokumen.tips_36274588-sistema-heui-eui.ppt
dokumen.tips_36274588-sistema-heui-eui.pptdokumen.tips_36274588-sistema-heui-eui.ppt
dokumen.tips_36274588-sistema-heui-eui.pptMiguelAtencio10
 
Clase N°4 - Purificación y secuenciación de acidos nucleicos Benoit Diringer ...
Clase N°4 - Purificación y secuenciación de acidos nucleicos Benoit Diringer ...Clase N°4 - Purificación y secuenciación de acidos nucleicos Benoit Diringer ...
Clase N°4 - Purificación y secuenciación de acidos nucleicos Benoit Diringer ...Luis Olivera
 
tics en la vida cotidiana prepa en linea modulo 1.pptx
tics en la vida cotidiana prepa en linea modulo 1.pptxtics en la vida cotidiana prepa en linea modulo 1.pptx
tics en la vida cotidiana prepa en linea modulo 1.pptxazmysanros90
 
trabajotecologiaisabella-240424003133-8f126965.pdf
trabajotecologiaisabella-240424003133-8f126965.pdftrabajotecologiaisabella-240424003133-8f126965.pdf
trabajotecologiaisabella-240424003133-8f126965.pdfIsabellaMontaomurill
 
R1600G CAT Variables de cargadores en mina
R1600G CAT Variables de cargadores en minaR1600G CAT Variables de cargadores en mina
R1600G CAT Variables de cargadores en minaarkananubis
 
Medidas de formas, coeficiente de asimetría y coeficiente de curtosis.pptx
Medidas de formas, coeficiente de asimetría y coeficiente de curtosis.pptxMedidas de formas, coeficiente de asimetría y coeficiente de curtosis.pptx
Medidas de formas, coeficiente de asimetría y coeficiente de curtosis.pptxaylincamaho
 
definicion segun autores de matemáticas educativa
definicion segun autores de matemáticas  educativadefinicion segun autores de matemáticas  educativa
definicion segun autores de matemáticas educativaAdrianaMartnez618894
 
Plan de aula informatica segundo periodo.docx
Plan de aula informatica segundo periodo.docxPlan de aula informatica segundo periodo.docx
Plan de aula informatica segundo periodo.docxpabonheidy28
 
El uso delas tic en la vida cotidiana MFEL
El uso delas tic en la vida cotidiana MFELEl uso delas tic en la vida cotidiana MFEL
El uso delas tic en la vida cotidiana MFELmaryfer27m
 
Arenas Camacho-Practica tarea Sesión 12.pptx
Arenas Camacho-Practica tarea Sesión 12.pptxArenas Camacho-Practica tarea Sesión 12.pptx
Arenas Camacho-Practica tarea Sesión 12.pptxJOSEFERNANDOARENASCA
 

Último (20)

SalmorejoTech 2024 - Spring Boot <3 Testcontainers
SalmorejoTech 2024 - Spring Boot <3 TestcontainersSalmorejoTech 2024 - Spring Boot <3 Testcontainers
SalmorejoTech 2024 - Spring Boot <3 Testcontainers
 
El uso de las TIC's en la vida cotidiana.
El uso de las TIC's en la vida cotidiana.El uso de las TIC's en la vida cotidiana.
El uso de las TIC's en la vida cotidiana.
 
Cortes-24-de-abril-Tungurahua-3 año 2024
Cortes-24-de-abril-Tungurahua-3 año 2024Cortes-24-de-abril-Tungurahua-3 año 2024
Cortes-24-de-abril-Tungurahua-3 año 2024
 
Redes direccionamiento y subredes ipv4 2024 .pdf
Redes direccionamiento y subredes ipv4 2024 .pdfRedes direccionamiento y subredes ipv4 2024 .pdf
Redes direccionamiento y subredes ipv4 2024 .pdf
 
El gusano informático Morris (1988) - Julio Ardita (1995) - Citizenfour (2014...
El gusano informático Morris (1988) - Julio Ardita (1995) - Citizenfour (2014...El gusano informático Morris (1988) - Julio Ardita (1995) - Citizenfour (2014...
El gusano informático Morris (1988) - Julio Ardita (1995) - Citizenfour (2014...
 
ATAJOS DE WINDOWS. Los diferentes atajos para utilizar en windows y ser más e...
ATAJOS DE WINDOWS. Los diferentes atajos para utilizar en windows y ser más e...ATAJOS DE WINDOWS. Los diferentes atajos para utilizar en windows y ser más e...
ATAJOS DE WINDOWS. Los diferentes atajos para utilizar en windows y ser más e...
 
La era de la educación digital y sus desafios
La era de la educación digital y sus desafiosLa era de la educación digital y sus desafios
La era de la educación digital y sus desafios
 
Crear un recurso multimedia. Maricela_Ponce_DomingoM1S3AI6-1.pptx
Crear un recurso multimedia. Maricela_Ponce_DomingoM1S3AI6-1.pptxCrear un recurso multimedia. Maricela_Ponce_DomingoM1S3AI6-1.pptx
Crear un recurso multimedia. Maricela_Ponce_DomingoM1S3AI6-1.pptx
 
GonzalezGonzalez_Karina_M1S3AI6... .pptx
GonzalezGonzalez_Karina_M1S3AI6... .pptxGonzalezGonzalez_Karina_M1S3AI6... .pptx
GonzalezGonzalez_Karina_M1S3AI6... .pptx
 
ejercicios pseint para aprogramacion sof
ejercicios pseint para aprogramacion sofejercicios pseint para aprogramacion sof
ejercicios pseint para aprogramacion sof
 
dokumen.tips_36274588-sistema-heui-eui.ppt
dokumen.tips_36274588-sistema-heui-eui.pptdokumen.tips_36274588-sistema-heui-eui.ppt
dokumen.tips_36274588-sistema-heui-eui.ppt
 
Clase N°4 - Purificación y secuenciación de acidos nucleicos Benoit Diringer ...
Clase N°4 - Purificación y secuenciación de acidos nucleicos Benoit Diringer ...Clase N°4 - Purificación y secuenciación de acidos nucleicos Benoit Diringer ...
Clase N°4 - Purificación y secuenciación de acidos nucleicos Benoit Diringer ...
 
tics en la vida cotidiana prepa en linea modulo 1.pptx
tics en la vida cotidiana prepa en linea modulo 1.pptxtics en la vida cotidiana prepa en linea modulo 1.pptx
tics en la vida cotidiana prepa en linea modulo 1.pptx
 
trabajotecologiaisabella-240424003133-8f126965.pdf
trabajotecologiaisabella-240424003133-8f126965.pdftrabajotecologiaisabella-240424003133-8f126965.pdf
trabajotecologiaisabella-240424003133-8f126965.pdf
 
R1600G CAT Variables de cargadores en mina
R1600G CAT Variables de cargadores en minaR1600G CAT Variables de cargadores en mina
R1600G CAT Variables de cargadores en mina
 
Medidas de formas, coeficiente de asimetría y coeficiente de curtosis.pptx
Medidas de formas, coeficiente de asimetría y coeficiente de curtosis.pptxMedidas de formas, coeficiente de asimetría y coeficiente de curtosis.pptx
Medidas de formas, coeficiente de asimetría y coeficiente de curtosis.pptx
 
definicion segun autores de matemáticas educativa
definicion segun autores de matemáticas  educativadefinicion segun autores de matemáticas  educativa
definicion segun autores de matemáticas educativa
 
Plan de aula informatica segundo periodo.docx
Plan de aula informatica segundo periodo.docxPlan de aula informatica segundo periodo.docx
Plan de aula informatica segundo periodo.docx
 
El uso delas tic en la vida cotidiana MFEL
El uso delas tic en la vida cotidiana MFELEl uso delas tic en la vida cotidiana MFEL
El uso delas tic en la vida cotidiana MFEL
 
Arenas Camacho-Practica tarea Sesión 12.pptx
Arenas Camacho-Practica tarea Sesión 12.pptxArenas Camacho-Practica tarea Sesión 12.pptx
Arenas Camacho-Practica tarea Sesión 12.pptx
 

Monkey Conf 2020: .NET MAUI Handlers

  • 3. Antes de empezar, ¿qué es .NET MAUI?
  • 4. El viaje hacia un único .NET
  • 5. – .De .NET 5 a .NET 6 .NET Framework Mono / Xamarin .NET Core.NET Un SDK, un BCL, herramientas unificadas Mobile & Desktop Cross-platform UI nativa UI web Cross-platform Investigaciones en la nube Continuar mejorando la velocidad, tamaño, diagnóstico en servicios Azure La vision de un .NET
  • 6. UI nativa multiplataforma Proyecto único, base de código única Implementar en múltiples dispositivos, móviles y de escritorio Evolución de Xamarin.Forms Dirigido a .NET 6, disponible a finales del próximo año Crear interfaces de usuario atractivas para cualquier dispositivo La evolución de Xamarin.Forms .NET MAUI .NET Platform
  • 7. .NET MAUI Proyectos SDK-style Proyecto único Soporte CLI .NET 6 BCL Multi-paradigma • Interfaz de usuario compatible con XAML y C# • Listo para Blazor y C# MVU DESKTOP MOBILE Windows macOS iOS Android .NET MAUI File | New • Multi-platform App UI (.NET) CLI • dotnet install maui • dotnet new maui Namespaces • System.Maui (previously Xamarin.Forms) • System.Device (previously Xamarin.
  • 8. Los objetivos de .NET MAUI
  • 9. La arquitectura de .NET MAUI Las API de Android, iOS, macOS y Windows están unificadas en una API abstracta que permite una experiencia de desarrollo que permita escribir una vez y ejecutar en cualquier plataforma, al tiempo que proporciona un acceso total a todos los aspectos de cada plataforma nativa. App Code interactúa principalmente con .NET MAUI API (1). Según sea necesario, App Code puede acceder directamente las API de la plataforma (2) a través Handlers, etc. .NET MAUI accede directamente las API de la plataforma nativa (3). Android iOS macOS Windows Xamarin.Android Xamarin.iOS Xamarin.Mac WinUI .NET MAUI App Code Mono Runtime WinRT .NET 6 BCL 1 2 3
  • 11. .NET MAUI no tiene renderers
  • 12. .NET MAUI usa handlers
  • 14. ¿Cuáles son los problemas de arquitectura de Xamarin.Forms? Xamarin.Forms.Button - Los Renderers estan muy acoplados a componentes Xamarin.Forms [assembly: ExportRenderer (typeof(MyEntry), typeof(MyEntryRenderer))] namespace CustomRenderer.iOS { public class MyEntryRenderer : EntryRenderer - Assembly Scanning es realmente lento - Realmente dificil de acceder a la plataforma nativa desde código xplat using Xamarin.Forms.PlatformConfiguration; using Xamarin.Forms.PlatformConfiguration.iOSSpecific; boxView.On<iOS>().UseBlurEffect(BlurEffectStyle.ExtraLight);
  • 15. Xamarin.Forms: Añadir un comportamiento personalizado, podría ser más sencillo // You need to know to export this renderer and tie it to a core type… [assembly: ExportRenderer (typeof(MyEntry), typeof(MyEntryRenderer))] namespace CustomRenderer.iOS { // You need to know what type to inherit from… public class MyEntryRenderer : EntryRenderer { // You need to know what method to override… protected override void OnElementChanged (ElementChangedEventArgs<Entry> e) { // You need to know when to do your work (before? after?) base.OnElementChanged (e); // You need to know that we call the native view “Control” // Spoiler alert: this varies from platform to platform and // sometimes it even varies from renderer to renderer! if (Control != null) { // Finally! We can change the color! public class MyEntry : Entry { }
  • 16. Los objetivos con .NET MAUI - Desacoplar los Renderers de Xamarin.Forms IButton
  • 17. Los objetivos con .NET MAUI - Mejorar el rendimiento es uno de los objetivos principales - Desde el proyecto xplat, registre fácilmente cualquier handler personalizado RegistrarHandlers.Handlers.Register<Xamarin.Forms.Label, LabelHandler>(); #if MONOANDROID RegistrarHandlers.Handlers.Register<Xamarin.Forms.Label, Xamarin.Forms.Platform.Android.LabelRenderer>(); RegistrarHandlers.Handlers.Register<Xamarin.Forms.Button, Xamarin.Forms.Platform.Android.AppCompat.ButtonRenderer>(); #endif - No hacer assembly scanning
  • 18. Los objetivos con .NET MAUI - Permitir acceder a código nativo con facilidad using Xamarin.Forms.PlatformConfiguration; using Xamarin.Forms.PlatformConfiguration.iOSSpecific; boxView.On<iOS>().UseBlurEffect(BlurEffectStyle.ExtraLight); [assembly: ExportRenderer (typeof(MyEntry), typeof(MyEntryRenderer))] namespace CustomRenderer.iOS { public class MyEntryRenderer : EntryRenderer - Eliminar APIs confusas #if MONOANDROID ViewHandler.ViewMapper[nameof(IView.BackgroundColor)] = (handler, view) => (handler.NativeView as AView).SetBackgroundColor(Xamarin.Forms.Color.Purple.ToNative()); var textView = crossPlatformLabel.Handler.NativeView as TextView; #endif
  • 19. Los Renderers actuales  Fundamentalmente es un control nativo  Implementa IVisualElementRenderer public interface IVisualElementRenderer { VisualElement Element { get; } VisualElementTracker Tracker { get; } AView View { get; } event EventHandler<VisualElementChangedEventArgs> ElementChanged; event EventHandler<PropertyChangedEventArgs> ElementPropertyChanged; SizeRequest GetDesiredSize(int widthConstraint, int heightConstraint); void SetElement(VisualElement element); void SetLabelFor(int? id); void UpdateLayout(); }
  • 20. public interface IViewHandler { void SetView(IView view); void UpdateValue(string property); void Remove(IView view); object NativeView { get; } bool HasContainer { get; set; } SizeRequest GetDesiredSize(double widthConstraint, double heightConstraint); void SetFrame(Rectangle frame); } public interface IVisualElementRenderer { VisualElement Element { get; } VisualElementTracker Tracker { get; } AView View { get; } event EventHandler<VisualElementChangedEventArgs> ElementChanged; event EventHandler<PropertyChangedEventArgs> ElementPropertyChanged; SizeRequest GetDesiredSize(int widthConstraint, int heightConstraint); void SetElement(VisualElement element); void SetLabelFor(int? id); void UpdateLayout(); } IVisualElementRenderer IViewHandler - .NET MAUI
  • 21. IView & IViewHandler public interface IViewHandler { void SetView(IView view); void UpdateValue(string property); void Remove(IView view); object NativeView { get; } bool HasContainer { get; set; } SizeRequest GetDesiredSize(double widthConstraint, double heightConstraint); void SetFrame(Rectangle frame); } public interface IView { Rectangle Frame { get; } IViewHandler Handler { get; set; } IView Parent { get; } void Arrange(Rectangle bounds); SizeRequest Measure(double widthConstraint, double heightConstraint); SizeRequest DesiredSize { get; }
  • 22. La estrategia actual con Xamarin.Forms Renderers protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == Button.TextColorProperty.PropertyName) UpdateTextColor(); else if (e.PropertyName == VisualElement.IsEnabledProperty.PropertyName) UpdateEnabled(); else if (e.PropertyName == Button.FontProperty.PropertyName) UpdateFont(); else if (e.PropertyName == Button.CharacterSpacingProperty.PropertyName) UpdateCharacterSpacing(); base.OnElementPropertyChanged(sender, e); } private void UpdateFont() private void UpdateTextColor()
  • 23. La estrategia con Handlers en .NET MAUI public partial class LabelHandler : AbstractViewHandler<ILabel, TextView> { protected override TextView CreateView() => new TextView(Context); public static void MapText(IViewHandler handler, ILabel view) => (handler as LabelHandler).TypedNativeView.UpdateText(view); } public static class TextViewExtensions { public static void UpdateText(this TextView textView, IText text) { textView.Text = text.Text; } public partial class LabelHandler { public static PropertyMapper<ILabel> LabelMapper = new PropertyMapper<ILabel>(ViewHandler.ViewMapper) { [nameof(ILabel.Text)] = MapPropertyText,
  • 24. Los Handlers son “solo” una reorganización public static class TextViewExtensions { public static void UpdateText(this TextView textView, IText text) { textView.Text = text.Text; } public class LabelRenderer : ViewRenderer<Label, TextView> { void UpdateText() { textView.Text = text.Text; }
  • 25. Xamarin.Forms: Personalizar el comportamiento de un control // You need to know to export this renderer and tie it to a core type… [assembly: ExportRenderer (typeof(MyEntry), typeof(MyEntryRenderer))] namespace CustomRenderer.iOS { // You need to know what type to inherit from… public class MyEntryRenderer : EntryRenderer { // You need to know what method to override… protected override void OnElementChanged (ElementChangedEventArgs<Entry> e) { // You need to know when to do your work (before? after?) base.OnElementChanged (e); // You need to know that we call the native view “Control” // Spoiler alert: this varies from platform to platform and // sometimes it even varies from renderer to renderer! if (Control != null) { // Finally! We can change the color! public class MyEntry : Entry { }
  • 26. Maui: Personalizar el comportamiento de un control // You don’t need to register a new renderer. public partial class EntryRenderer { // You know what method to call because you named it! public static void MapBackgroundColor (IViewRenderer renderer, IView view) { // You don’t need to call any base methods here or worry about order. // Every renderer is consistent; you know where the native view is. var nativeView = (NativeView)renderer.NativeView; var color = view.BackgroundColor; if (color != null) { // Phew! That was easy! nativeView.BackgroundColor = UIColor.FromRGB (204, 153, 255); } } } public partial class EntryRenderer { public static PropertyMapper<IView> ViewMapper = new PropertyMapper<IView> { // Add your own method to map to any property [nameof(IView.BackgroundColor)] = MapBackgroundColor }; }
  • 27. Maui: Personalizar el comportamiento de un control #if MONOANDROID ButtonRenderer.ButtonMapper[nameof(IButton.TextColor)] = (handler, view) => { var nativeView = handler.NativeView as Aview; // Add your own logic to map the TextColor property }; #endif
  • 29. Veamos como hacer el port de un Xamarin.Forms Renderer a un .NET MAUI Handler
  • 31. Renderer to Handler & Handler to Renderer Shims https://github.com/xamarin/Xamarin.Forms/pull/12546
  • 32. .NET MAUI e inyección de dependencias .NET MAUI usará el concepto de Host similar a ASP.NET. Esto permitirá usar Containers y providers para nuestros handlers al igual que permitir configuraciones con archivos appsettings, y otras posibilidades como gestionar el ciclo de vida de cada plataforma, registrar servicios, logging extensions etc. El AppBuilder estará oculto por defecto, pero se podrá sobreescribir y usarlo para extender y registrar servicios, configurar logging o registrar nuevos handlers. En .NET MAUI, vamos a usar Microsoft Dependency Injection para permitir registrar custom handlers. var (host,app) = App.CreateDefaultBuilder() .RegisterHandler<IButton, CustomHandlers.CustomPinkTextButtonHandler>() .ConfigureServices(ConfigureExtraServices) .Init<MyApp>(); var page = app.GetStartup() https://github.com/xamarin/Xamarin.Forms/pull/12460
  • 33. ¿Y que ocurre con los renderers de Xamarin.Forms? En Xamarin.Forms se usaba el atributo ExportRenderer para registrar un Renderer. Internamente en Xamarin.Forms, se usa el escaneo de ensamblados para buscar y registrar los Renderers. En .NET MAUI, el escaneo de ensamblado no se usará por defecto, y permitiremos registrar un Renderer de esta manera: Sin embargo, permitiremos en los casos deseados registrar Renderers usando el escaneo de ensamblaje: var (host,app) = App.CreateDefaultBuilder() .RegisterRenderer<CustomBoxView, CustomBoxViewRenderer>() .ConfigureServices(ConfigureExtraServices) .Init<MyApp>(); var page = app.GetStartup() var (host,app) = App.CreateDefaultBuilder() .ConfigureRenderers( options => options.ScanForRendererAttribute = true) .ConfigureServices(ConfigureExtraServices) .Init<MyApp>(); var page = app.GetStartup()
  • 34. Usando los Renderers “antiguos” en .NET MAUI Puedes elegir la que más te convenga en cada caso, pero ten en cuenta que: Usando Handlers: • Requiere "algo de tiempo" para la conversión de código. • Cada Handler es equivalente a un Fast Renderer además de ser gestionado de forma diferente por Layouts que tienen un mejor rendimiento. • Permita más opciones de extensibilidad. Usando Renderers: • No requiere cambios. • No aprovecha ninguna de las mejoras de los Handlers (rendimiento, extensibilidad, etc.)
  • 35. Mezclando renderers y handlers en la misma App .NET MAUI
  • 36. La arquitectura de .NET MAUI .NET MAUI utiliza Layouts multiplataforma, interfaces para definir controles, métodos de extension con las vistas nativas e implementaciones usando vistas nativas. Se utilizan los mismos controles nativos independientemente de MVVM, MVU, RxUI, Blazor, etc. Interfaces System.Maui.Views son interfaces que describen cada control. IButton > IText > IView Handlers Estos son las abstracciones e implementaciones de cada control sin conocimiento de MVU o MVVM. System.Maui.Handlers: • ButtonHandler.Android.cs • ButtonHandler.Mac.cs • ButtonHandler.Standard.cs • ButtonHandler.Win32.cs • ButtonHandler.cs • ButtonHandler.iOS.cs Patrones Estas implementaciones de controles añaden soporte a los patrones de diseño soportados. System.Maui.Bindables contiene las capacidades relacionadas con MVVM, y controles con soporte a databinding.
  • 37. El trabajo con .NET MAUI Handlers • Nueva arquitectura de Renderers • Nueva metodología • Nueva organización • Nueva arquitectura de Layouts • Eliminar obsoletos • Eliminar “slow” renderers • Eliminar pre-AppCompat • Unificar APIs entre Xamarin.Forms y Xamarin.Essentials • Usar Microsoft.Extensions.DependencyInjection • Cross-Platform Lifecycle • Corregir “AndExpand” • Corregir “MinHeightRequest” & similares • Usar GlideX  Migration Tool con try-convert  Xamarin Native -> .NET 6  Xamarin.Forms -> .NET MAUI
  • 38. • .NET 5.0 se ha lanzado en Noviembre 2020 • Xamarin.Forms 5.0 en Diciembre 2020 • .NET 6.0 MAUI + soporte a móvil previews con .NET 6 Preview 1 El roadmap de .NET Dic 2019 .NET Core 3.1 LTS Nov 2020 .NET 5.0 Nov 2021 .NET 6.0 LTS Nov 2022 .NET 7.0 Nov 2023 .NET 8.0 LTS
  • 40. Gracias! Gracias a nuestros Sponsors. Sin ellos el evento no sería posible.

Notas del editor

  1. Now let’s talk about the future…..
  2. Animated slide Our vision for one .NET is to simplify the platform and choices for .NET developers and provide a single stack that supports the best of breed solutions for all modern workloads. Last year at Build, we laid out our vision for one .NET starting with .NET 5. We said we would take .NET Core and Mono/Xamarin implementations and unify them into one base class library (BCL) and toolchain (SDK). In the wake of the global health pandemic, we have had to adapt to the changing needs of our customers and provide the support needed to assist with smooth operations. Our efforts continue to be anchored in helping our customers address their most urgent needs. As a result, we expect these features to be available in preview for the .NET 5 release but the unification will be truly completed with .NET 6, our Long-Term Support (LTS) release.  Our vision has not changed, but our timeline has. .NET 5 will have several cloud & web investments, such as smaller, faster, single file EXEs that use less memory which are appropriate for microservices and containerized applications across operating systems. We will continue to build on the work we have done. We are still committed to one .NET platform and delivering a quality .NET 5 release to our millions of users in November this year. You will continue to see a wave of innovation happening with multiple previews along the way on the journey to one .NET.
  3. I’m also excited to announce .NET Multi-platform App UI, or just .NET MAUI. <CLICK> It is a cross-platform, native UI stack so you’ll get great performance on any device. <CLICK> It will allow you to build these apps for any device from a single codebase and project system <CLICK> And that includes desktop and mobile across operating systems, like Windows, MacOS, iOS and Android. <CLICK> This is the evolution of Xamarin technology, building on Xamarin.Forms and expanding that to cross-platform desktop scenarios. <CLICK> It will be part of the unified .NET in the .NET 6 timeframe with previews available end of this year. You’ll see us working on it in the open on GitHub.
  4. In Xamarin.Forms, the Renderers are tightly couple to Xamarin.Forms components. In the ButtonRenderer, have several references to a Xamarin.Forms Button which is a bindable object implementing INotifyPropertyChanged, etc. The other topic is, the Xamarin.Forms Registrar where register the available renderers, etc. In this case, use assembly scanning and it is really slow. What happens is basically, Xamarin.Forms goes through and scans all your assemblies for assembly attributes and then automatically registers to the framework, and Allow to use that components. This is great because is easy to use, and try to remove some requirements from the user, but impact in the performance. The third topic is, in some cases is really complex to reach the native platform from cross platform code. Mainly, because the way that dependency tree works. The button renderer depends on button component so, the button has no concept of a renderer. When you are in the Button context, have no context or reference to the renderer. If you want to Access the native layer, you have different options. You can register your own custom renderer and interact with it or, use an API, that is great but very difficult to discover. I am talking about Platform Specifics. At the end, is not doing anything really special, just setting a cross platform pproperty to a native UI control property.
  5. Relying on event handlers to orchestrate behavior and property changes Lots of boilerplate code Tons of knowledge required about order of events, both on the platform side and on the Xamarin.Forms side (i.e,, Does this need to happen on ElementChanged? What about ElementPropertyChanged? Etc.)
  6. The main goal with .NET MAUI is to decouple the renderers. The basic idea is invert the dependency tree. Now, the Xamarin.Forms Button depends on Ibutton and that interface is what is used by the Button and the ButtonHandler only knows about an IButton. The Handler doesnt know nothing about the Button component. This allow you to map different type of controls, because use the interface and have not any concept about what is .NET MAUI.
  7. There are several ideas driving this, but one of the most important ones is performance minded and simplified. Achieve a much better performance and allow to understand how everything Works in a easy way. Mostly, if you are a new developer. In Xamarin.Forms is a Little bit hard to understanding how to get the renderer, the lifecycle, etc. Also, is complex as we mentioned to Access to any native element from the cross platform layer. So, what we are doing is sort of moving everything into the cross-platform side to allow you Access things within the context of your shared application. So you can see in the slides some samples, and as you can see, the idea is to allow register any handler you want. For sure, there are handlers registered by defaut, but, you can swap those in and out. The idea behind this is, we are not going to use assembly scanning by default. In next slides we will see that we will allow the use of scanning assembly for a very specific case. This is for teo reason; first one, to gain performance and second one; to simplify the registration process. Of course, the code sample from the slides, also Works with multitargeting so you can include it in cross platform code.
  8. Ok, let’s continue talking about the goals of .NET MAUI. Removing confusing APIs and this particular example refers again to Platform Specific. So, the main idea is, you will have Access to native bits from a cross-platform standpoint. If I have a .NET MAUI Label, I can just Access the native View from cross platform context. You can use compilation directives or créate a platform specific file, then Access the native control and customize, modify whatever you want. So, again, that is possible because we inverted the inversion as we said earlier, now .NET MAUI taking dependency on the renderes opposed the renderers taking dependency on Xamarin.Forms.
  9. Let’s see the current Xamarin.Forms Renderers implementation. Is an IVisualElementRenderer. This is what drives all the renderers at the native level. This is how the Layout system interact with the native controls, etc. Can get basic information about what size should use, when should update a property, etc.
  10. Ok, let’s see the changes between Xamarin.Forms and .NET MAUI. IVisualElementRenderer is the Xamarin.Forms stuff, and the new one is IViewHandler. If you do a quick comparison, are very close, or very much the same. Is a new interface that allow to represent controls using the new implementation, but no crazy changes, are close. For example: SetView is SetElement, UpdateValue is mostly the same as ElementPropertyChanged, etc. Again, for different points, but mostly again for the performance topic, we are removing eventing. SetFrame is a Little bit more powerful in respect Xamarin.Forms, because we are applying some important changes in Layouts and want to be more aggresive projecting the sizing information to avoid some unnecesary measurements, etc.
  11. IView is the interface that any cross platform UI element will implement. For example: IButton. IViewHandler is the interface that any Handler will implement.
  12. Now, I am going to compare the ways renderers strategy Works in Xamarin.Forms and .NET MAUI. In Xamarin.Forms, there are some huge if statements, some consistency problems, all of the methods to update any property are privates.
  13. The .NET MAUI strategy is more function based. The idea here is that, all the update methods we have seen before, will be moved to extensión methods. Why?. Will be public methods that you will be able to apply in your own handlers. Also, is very powerful for cross-platform, because since the way everything Works is créate a standard API across all platforms, for example, the LabelExtensions, you can use it from a cross platform class, and you can say, handler, UpdateText and in every platform will use the same method with the correct implementation for the platform. So, image this, and we will see this in samples more later, but can have just one class to implement the Handler while in Xamarin.Forms we used several projects, several clases, etc. Finally, the mapper is just a dictionary of functions, so before when you saw the Xamarin.Forms property changed stuff, what was doing is just mapping string with methods. And is what the mapper is doing but standarizing that to use a structure and something much more pluggable.
  14. So, a quick summary before jump to code. The Handlers are just a reorganization, we are creating some new interfaces to allow some basic changes in how the renderers are created and how the layouts manage the native views; and also créate the mapper concept to allow more options to extend, and finally; move the logic used to update native views to extensions methods. We are taking all the renderers and converting them to créate a more consistent API.
  15. Relying on event handlers to orchestrate behavior and property changes Lots of boilerplate code Tons of knowledge required about order of events, both on the platform side and on the Xamarin.Forms side (i.e,, Does this need to happen on ElementChanged? What about ElementPropertyChanged? Etc.)
  16. You don’t actually have to make this specific to iOS. You could actually make an extension method that changes the background color for each platform, and this mapping can live in one shared partial class…even less code! Way easier to unit test, much less specific knowledge required about the inner workings of Maui to do something simple as change a color.
  17. Button can be registered to either a Handler or a Renderer and the registrar will react accordingly. The ContentPage calls CreateRenderer on its content which will return an IVisualElementRenderer. If the Content is of type IViewHandler then it gets wrapped with a HandlerToRendererShim so that ContentPage can still render the control successfully.
  18. Predictable releases helps everyone, not only the businesses that use .NET but also the open source projects that are built upon .NET.