CommonHelpers.Maui 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package CommonHelpers.Maui --version 0.1.0
NuGet\Install-Package CommonHelpers.Maui -Version 0.1.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="CommonHelpers.Maui" Version="0.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CommonHelpers.Maui --version 0.1.0
#r "nuget: CommonHelpers.Maui, 0.1.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.
// Install CommonHelpers.Maui as a Cake Addin
#addin nuget:?package=CommonHelpers.Maui&version=0.1.0

// Install CommonHelpers.Maui as a Cake Tool
#tool nuget:?package=CommonHelpers.Maui&version=0.1.0

CommonHelpers.Maui

This is a library containing some commonly needed helpers. The goal is to build on top of the more popular CommonHelpers package, but with .NET MAUI specialized functionality.

App Extensions

Extensions for platform-specific code that can be used in MauiProgram.cs.

  • For WinUI
    • window.TryMicaOrAcrylic();
  • For MacCatalyst
    • windowScene.RestrictWindowMinimumSize(new CGSize(600, 400))
    • windowScene.RestrictWindowMaximumSize(new CGSize(1920, 1080))
    • windowScene.RestrictWindowSize(new CGSize(600, 400), new CGSize(1920, 1080))
#if WINDOWS10_0_17763_0_OR_GREATER
using CommonHelpers.Maui.Platforms.Windows;

#elif MACCATALYST
using CommonHelpers.Maui.Platforms.MacCatalyst;
using UIKit;
using CoreGraphics;

#endif

public static MauiApp CreateMauiApp()
{
    // ... your other boiler plate startup code here

    builder.ConfigureLifecycleEvents(events =>
    {
    
#if WINDOWS10_0_17763_0_OR_GREATER
        events.AddWindows(wndLifeCycleBuilder =>
        {
            wndLifeCycleBuilder.OnWindowCreated(window =>
            {
                // For automatic Mica or Acrylic support
                window.TryMicaOrAcrylic();
            });
        });
    });
    
#elif MACCATALYST
    events.AddiOS(wndLifeCycleBuilder =>
    {
        wndLifeCycleBuilder.SceneWillConnect((scene, session, options) =>
        {
            if (scene is UIWindowScene windowScene)
            {
                // Can be used for restricting the MacOS window's min, max (or both) size.
                windowScene.RestrictWindowMinimumSize(new CGSize(600, 400));
            }
        });
    });
#endif
    return builder.Build();
}
Behaviors

A BehaviorBase<T> class that lets you create your own, or use the out-of-the-box EventToCommandBehavior implementation.

Converters

There are several commonly used IValueConverter implementations:

  • IntToDoubleConverter
  • InvertBoolConverter
  • NullToBoolConverter
  • StringToUriConverter

As well as a couple boutique ones:

  • ConfigurableBoolConverter
  • NameToInitialsConverter
More to come

This is just the beginning, I plan to build this out as an indispensable comparion to the CommonHelpers library.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-android31.0 is compatible.  net6.0-ios was computed.  net6.0-ios16.1 is compatible.  net6.0-maccatalyst was computed.  net6.0-maccatalyst16.1 is compatible.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net6.0-windows10.0.19041 is compatible.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
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.2.0 199 7/28/2023
0.1.0 195 3/14/2023

Review releases on GitHub at bit.ly/CommonHelpers