Microsoft.Maui.Graphics.Controls

[删除(380066935@qq.com或微信通知)]

https://github.com/dotnet/Microsoft.Maui.Graphics.Controls

Microsoft.Maui.Graphics.Controls: Pixel-Perfect Drawn Controls for .NET MAUI

Microsoft.Maui.Graphics.Controls is a .NET MAUI experiment that offers cross-platform, pixel-perfect, drawn controls, with three built-in themes: CupertinoFluent and Material.

NOTE: Want to see all of this in action? Have a look at this video

Microsoft.Maui.Graphics

This project uses Microsoft.Maui.Graphics to draw the controls. Microsoft.Maui.Graphics is a cross-platform graphics library for iOS, Android, Windows, macOS and Linux completely built in C#.

This library allows you to use a common API across multiple platforms allowing you to share your drawing code between them, or mix and match graphics implentations within a single application.

How To Use This Library

At the moment this library is experimental. Because of this we are distributing it as a NuGet package on a separate feed (aka nightly).

If you want to try it out, add the nightly feed to your NuGet sources or add a NuGet.config file like below and install the Microsoft.Maui.Graphics.Controls package.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <clear />
    <add key="maui-graphics-controls-nightly" value="https://aka.ms/maui-graphics-controls-nightly/index.json" />
    <add key="NuGet.org" value="https://api.nuget.org/v3/index.json" />
  </packageSources>
</configuration>

After adding the Microsoft.Maui.Graphics.Controls package, modify the MauiProgram class to register the drawn control handlers:

public static class MauiProgram
{
    public static MauiApp CreateMauiApp()
    {
        var appBuilder = MauiApp.CreateBuilder();

        appBuilder
            .UseMauiApp<App>()
            .ConfigureGraphicsControls();

        return appBuilder.Build();
    }
}

What controls are available?

Currently, the following controls are available:

ControlCupertinoFluentMaterial
Button
CheckBox
DatePicker
Editor
Entry
ProgressBar
RadioButton
Slider
Stepper
Switch
TimePicker

The controls above have the same properties and events as they exist in Xamarin.Forms/.NET MAUI today.