AutoGenMaui 1.0.2

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

// Install AutoGenMaui as a Cake Tool
#tool nuget:?package=AutoGenMaui&version=1.0.2                

AutoGenMaui

Prerequisites

  • Visual Studio 2022 version 17.3 or newest, with module .NET Multi-platform App UI
  • MaUI project version .NET 7, where we want use framework

Instalation

Add NuGet Packages: https://www.nuget.org/packages/AutoGenMaui/

Or install via Packat Manager Console:

NuGet\Install-Package AutoGenMaui -Version 1.0.1

Or add source code, that is on github: https://github.com/Brano5/AutoGenMaui

Using

In our MaUI project, we will create a simple class for demonstration. For example:

public class SimpleClass
{
    public string stringType { get; set; }
    public int intType { get; set; }
}

We can test it, for example, on the main page. So in the "MainPage.xaml" file, we add the line:

<autoGenMaui:AutoGen Context="{Binding Source={x:Reference this}, Path=simpleClass}"/>

If we want to use "AutoGen" we need to add a reference to this class:

xmlns:autoGenMaui="clr-namespace:AutoGenMaui;assembly=AutoGenMaui"

And also name:

x:Name="this"

Subsequently, in the background code in the "MainPage.xaml.cs" class, we create the attribute that we want to generate:

public SimpleClass simpleClass { get; set; }

And we initialize this attribute in the constructor:

simpleClass = new SimpleClass();
simpleClass.intType = 5;

After running the application, for example, in Windows applications, the main page is displayed, which already contains the generated class.

MaUI App

Supported types

  • simple - Byte, Int, Double, Char, String, Bool, DateTime, Enum
  • complex - any object that consists of supported types
  • enumerable - array, list, dictionary

Customization options

Setting attributes for appearance modification can be done in two ways:

  • Determination of parameters of the main component for generation
<AutoGen Context="obj" Presentation="Control" Layout="Horizontal" Margin="30" />
  • Adding attribute metadata directly to an object or attribute
public class AllTypes
{
    [Layout(LayoutEnum.Vertical)]
    public string simpleType { get; set; }

    [Presentation(PresentationEnum.Control)]
    [Padding(30, 50)]
    public int[] enumerableType { get; set; }
}

We can modify the generated view by adding one of these attributes:

  • Layout
  • Presentation
  • Margin
  • Padding
  • Name
  • Ignore

License

This project is licensed under the MIT License

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-android33.0 is compatible.  net7.0-ios was computed.  net7.0-ios16.1 is compatible.  net7.0-maccatalyst was computed.  net7.0-maccatalyst16.1 is compatible.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net7.0-windows10.0.19041 is compatible.  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.
  • net7.0

    • No dependencies.
  • net7.0-android33.0

    • No dependencies.
  • net7.0-ios16.1

    • No dependencies.
  • net7.0-maccatalyst16.1

    • No dependencies.
  • net7.0-windows10.0.19041

    • No dependencies.

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
1.1.0 224 5/3/2023
1.0.2 184 4/12/2023
1.0.1 201 4/10/2023
1.0.0 224 2/18/2023