Wrap 3rd party controls
Describe how to create a wrapper for any control in order to use it inside your component
Last updated
Was this helpful?
Describe how to create a wrapper for any control in order to use it inside your component
Last updated
Was this helpful?
MauiReactor lets you build MAUI applications from components in an MVU environment. Often you need to integrate external controls that are provided by Microsoft itself, by community OSS projects, or by commercial vendors.
To use these controls in MauiReactor you have to create wrappers that can handle the initializations (i.e. Mount), update (Render), and finalization (Unmount) of the native widget.
For this, MauiReactor provides a source generator that is triggered by the attribute ScaffoldAttribute
You just need to create a partial class with the name you like and apply the attribute Scaffold
with the type of native control that you'd like to embed.
For example, the following code creates a VisualNode
for the LiveChartsCore.SkiaSharpView.Maui.CartesianChart control from the great charting library :
MauiReactor can handle any kind of MAUI controls, but for some, the bare-bone wrapper is created automatically by the ScaffoldGenerator
is not enough to handle every aspect of the native widget (for example when a DataTemplate
is used to render child items). For those that are required to handle such behavior please take a look at the MauiReactor code (especially the implementation of wrappers for ItemsView and Shell) or open an issue
As you have the wrapper you can use it in a component as any other control: