Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/brminnick/hellomauitoolkit

An iOS, Android, macOS + Windows app built using .NET MAUI, demonstrating how to use the .NET MAUI CommunityToolkit
https://github.com/brminnick/hellomauitoolkit

android catalyst csh dotnet ios maccatalyst macos maui net net6 windows winui

Last synced: about 1 month ago
JSON representation

An iOS, Android, macOS + Windows app built using .NET MAUI, demonstrating how to use the .NET MAUI CommunityToolkit

Awesome Lists containing this project

README

        

[![.NET MAUI](https://github.com/brminnick/HelloMauiToolkit/actions/workflows/maui.yml/badge.svg)](https://github.com/brminnick/HelloMauiToolkit/actions/workflows/maui.yml)

# HelloMauiToolkit
The [.NET MAUI Community Toolkit](https://github.com/communitytoolkit/maui) is a collection of common elements for development with .NET MAUI that developers tend to replicate across multiple apps. It simplifies and demonstrates common developer tasks when building apps with .NET MAUI.

### .NET MAUI Community Toolkit: Converters

This specific example uses the [`ColorToHexRgbStringConverter`](https://github.com/CommunityToolkit/Maui/blob/202565a8ac06ae2df81123ebb87cce8c8ea673b9/src/CommunityToolkit.Maui/Converters/ColorToStringConverter.shared.cs#L25-L30).

#### Add `UseMauiCommunityToolkit()`

In order to use the .NET MAUI Community Toolkit you need to call the extension method in your `MauiProgram.cs` file as follows:

```csharp
using CommunityToolkit.Maui;

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

// Initialise the toolkit
builder.UseMauiApp().UseMauiCommunityToolkit();

// the rest of your logic...
}
}
```

#### Add XAML Namespace

At the top of your XAML file, add the following `xmlns`

```xml
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
```

#### Use `ColorToHexRgbStringConverter`

In your `Binding` assign `Converter={converters:ColorToHexRgbStringConverter}`:

```xml
Text="{Binding Source={x:Reference ClickMeButton}, Path=BackgroundColor, Converter={toolkit:ColorToHexRgbStringConverter}}
```