M.BindableProperty.Generator 0.3.2

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

// Install M.BindableProperty.Generator as a Cake Tool
#tool nuget:?package=M.BindableProperty.Generator&version=0.3.2                

NuGet

Maui.BindableProperty.Generator

Source generator that automatically transforms fields into BindableProperties that can be used in MAUI.

Installation

First, install NuGet. Then, install M.BindableProperty.Generator from the package manager console:

PM> Install-Package M.BindableProperty.Generator

Usage - Simple implementation

Just decorate field with the Bindable attribute.

    using Maui.BindableProperty.Generator.Core.BindableProperty;

    public partial class CustomEntry : ContentView
    {
        [AutoBindable]
        private string _placeholder;
    }

the prevoius code will generate this:

    public partial class CustomEntry
    {
        public static readonly Microsoft.Maui.Controls.BindableProperty PlaceholderProperty = Microsoft.Maui.Controls.BindableProperty.Create(nameof(Placeholder), typeof(string), typeof(CustomEntry), default(string));
        public string Placeholder
        {
            get => (string)GetValue(PlaceholderProperty);
            set => SetValue(PlaceholderProperty, value);
        }
    }

Usage - Custom property name

Just decorate field with the Bindable attribute.

    using Maui.BindableProperty.Generator.Core.BindableProperty;
    
    public partial class CustomEntry : ContentView
    {
        [AutoBindable(PropertyName = "Text")]
        private string _t;
    }

the prevoius code will generate this:

    public partial class CustomEntry
    {
        public static readonly Microsoft.Maui.Controls.BindableProperty TextProperty = Microsoft.Maui.Controls.BindableProperty.Create(nameof(Text), typeof(string), typeof(CustomEntry), default(string));
        public string Text
        {
            get => (string)GetValue(TextProperty);
            set => SetValue(TextProperty, value);
        }
    }

Project status

  • ✅ Simple implementation - Done
  • ✅ Custom property name - Done
  • 🔲 Custom Parameters - In Progress
  • 🔲 OnChanged method - Pending
  • 🔲 Dependent properties - Pending

Extra info

This repo is using part of the code of this repo CodeWriter to generate the CSharp files, thanks to the author.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.0

    • No dependencies.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on M.BindableProperty.Generator:

Package Downloads
The49.Maui.ContextMenu

.NET MAUI library for Android and iOS to open a native context menu on long press.

Sm.Maui.BottomSheet

ModalBottomSheet view for .NET MAUI

SimpleRatingControl.MAUI

Simple Rating Control for .NET MAUI

Yang.Maui.Helper.Controls

Package Description

tsjdevapps.MauiControlsLib

Controls Library for .NET MAUI

GitHub repositories (3)

Showing the top 3 popular GitHub repositories that depend on M.BindableProperty.Generator:

Repository Stars
VladislavAntonyuk/MauiSamples
.NET MAUI Samples
the49ltd/The49.Maui.BottomSheet
.NET MAUI library used to display pages as Bottom Sheets
nor0x/Dots
the 🙂 friendly .NET SDK manager
Version Downloads Last updated
0.11.1 64,242 6/28/2023
0.11.0 208 6/28/2023
0.10.0 5,938 3/28/2023
0.9.3 8,954 12/7/2022
0.9.2 6,213 11/15/2022
0.9.1 915 9/27/2022
0.9.0 1,248 8/30/2022
0.8.3 1,343 7/27/2022
0.8.2 4,027 7/4/2022
0.8.1 552 7/1/2022
0.8.0 548 6/29/2022
0.7.0 659 4/28/2022
0.6.0 532 4/28/2022
0.5.0 519 4/21/2022
0.4.1 533 4/14/2022
0.4.0 537 4/12/2022
0.3.3 510 4/1/2022
0.3.2 503 4/1/2022
0.3.0 609 4/1/2022

Bugfix - Removed PackagePath