MolDraw.Maui 0.4.0

dotnet add package MolDraw.Maui --version 0.4.0
                    
NuGet\Install-Package MolDraw.Maui -Version 0.4.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MolDraw.Maui" Version="0.4.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MolDraw.Maui" Version="0.4.0" />
                    
Directory.Packages.props
<PackageReference Include="MolDraw.Maui" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MolDraw.Maui --version 0.4.0
                    
#r "nuget: MolDraw.Maui, 0.4.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MolDraw.Maui@0.4.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MolDraw.Maui&version=0.4.0
                    
Install as a Cake Addin
#tool nuget:?package=MolDraw.Maui&version=0.4.0
                    
Install as a Cake Tool

MolDraw.Maui

NuGet Downloads License: Apache-2.0

MoleculeView — an interactive 2D chemical structure control for .NET MAUI. Show structures from SMILES or from precomputed coordinates, colour atoms by heat-map weights (perfect for mass-spec peaks, docking scores or model attention), let the user tap and hover atoms through MVVM bindings, and follow the app's light/dark theme. Runs on Windows (x64/ARM64), Android, iOS and Mac Catalyst — the .NET MAUI part contains no chemistry toolkit.

Install

dotnet add package MolDraw.Maui      # the control (pulls MolDraw.Skia + MolDraw.Depiction)
dotnet add package MolDraw.Core      # optional: NCDK engine so `Smiles` works out of the box

Requires .NET 11, .NET MAUI 11 and SkiaSharp 4.156.x.

Quick start

// MauiProgram.cs
using MolDraw.Core;

builder.UseMauiApp<App>()
       .UseMolDraw();                    // UseSkiaSharp() + renderer + depiction cache
builder.Services.AddMolDrawCore();       // chemistry engine (SMILES -> depiction); optional
<ContentPage xmlns:md="clr-namespace:MolDraw.Maui;assembly=MolDraw.Maui" ...>
    <md:MoleculeView Smiles="{Binding Smiles}"
                     AtomWeights="{Binding AtomWeights}"
                     Colormap="{Binding Colormap}"
                     ShowColorBar="True"
                     SelectedAtomIndex="{Binding SelectedAtomIndex}"
                     AtomTappedCommand="{Binding AtomTappedCommand}"
                     ErrorMessage="{Binding SmilesError}" />
</ContentPage>

Highlighting atoms (MVVM)

public partial class PeakViewModel : ObservableObject
{
    [ObservableProperty] private string smiles = "CC(=O)OC1=CC=CC=C1C(=O)O";
    [ObservableProperty] private IReadOnlyList<float>? atomWeights;   // 0..1 per atom index
    [ObservableProperty] private int? selectedAtomIndex;              // TwoWay: tap selects/deselects
    [ObservableProperty] private string? smilesError;                 // pushed by the control

    public void ShowPeak(float[] modelOutput) => AtomWeights = modelOutput;  // assign a new list to refresh

    [RelayCommand] private void AtomTapped(int atomIndex) { /* show matching peaks */ }
}

Atom indices in AtomWeights are the heavy-atom indices of the SMILES — the same order RDKit uses — so model outputs can be bound directly. Recolouring never recomputes coordinates.

Properties

Property Default mode Purpose
Smiles OneWay Depicted by the registered IChemistryEngine, cached by SMILES string
Depiction (MoleculeDepiction) OneWay Precomputed depiction, e.g. from RDKit or Indigo (takes precedence over Smiles)
DepictionOptions OneWay ForceLayout, PerceiveAromaticity, AssignMissingWedges, CarbonLabels
RenderOptions OneWay null → Light/Dark preset following Application.RequestedTheme
AtomWeights (IReadOnlyList<float>) OneWay 0..1 per atom, mapped through Colormap
AtomColors, BondColors OneWay Explicit per-index highlight colours (win over weights)
Colormap, ShowColorBar, HighlightRadiusScale OneWay Highlight customisation
SelectedAtomIndex (int?) TwoWay Tap selects; tapping again or empty space deselects
HoveredAtomIndex (int?) OneWayToSource Pointer hover (desktop)
AtomTappedCommand, AtomHoveredCommand – ICommand with the atom index
ErrorMessage (string?) OneWayToSource Invalid input, shown inside the control and never thrown
IsInteractive, HitTolerance OneWay Pointer handling

Using another chemistry engine

MolDraw.Maui only knows IChemistryEngine (from MolDraw.Depiction). Register your own implementation — RDKit, Indigo, a web service — before or after UseMolDraw() and Smiles follows it:

builder.Services.AddSingleton<IChemistryEngine, IndigoEngine>();

Without any engine, Smiles produces an explanatory ErrorMessage instead of a picture, while a bound Depiction always renders. That also means: no LGPL dependency in this package — NCDK only enters your app via MolDraw.Core.

Platforms

Platform Package target
Windows 10/11 (WinUI), x64 + ARM64 net11.0-windows10.0.19041.0
Android (arm64-v8a, arm, x64, x86) net11.0-android37.0
iOS 15+ net11.0-ios27.2
Mac Catalyst 15+ net11.0-maccatalyst27.2

The control is managed code; native Skia binaries come from SkiaSharp for the consuming app's runtime identifier.

Package Purpose
MolDraw.Depiction model + IChemistryEngine seam
MolDraw.Core NCDK engine (AddMolDrawCore())
MolDraw.Skia renderer, highlights, PNG/SVG export
MolDraw.Maui this package — MAUI control

Documentation

License

Apache-2.0 © Agredo Application. Uses SkiaSharp and .NET MAUI (both MIT); no chemistry toolkit is bundled.

Product Compatible and additional computed target framework versions.
.NET net11.0-android37.0 is compatible.  net11.0-ios27.2 is compatible.  net11.0-maccatalyst27.2 is compatible.  net11.0-windows10.0.19041 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.4.0 54 11/18/2026
0.3.0 50 11/17/2026