Blazor.Bindable 1.0.0

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

// Install Blazor.Bindable as a Cake Tool
#tool nuget:?package=Blazor.Bindable&version=1.0.0

Blazor.Bindable

Source Generator Project to add Bindable Attribute that creates binding for blazor parameters.

How to use

If have a property with the Bindable attribute in a partial class

[Parameter, Bindable] public string TestPropertyName { get; set; }

It will append the generate the following code in the project's analyzer (allowing you to use Roslyn intellisense for properties and whatnot).

[Microsoft.AspNetCore.Components.Parameter] public Microsoft.AspNetCore.Components.EventCallback<string> TestPropertyNameChanged { get; set; }

private string CurrentTestPropertyName 
{
    get 
    {
        return this.TestPropertyName;
    }
    set
    {
        var hasChanged = value != this.TestPropertyName;
        if (hasChanged)
        {
            this.TestPropertyName = value;
            _ = this.TestPropertyNameChanged.InvokeAsync(this.TestPropertyName);
        }
    }
}

This allows you to easily bind to a Blazor parameter without rewriting boilerplate code.

There are no supported framework assets in this 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
1.0.1 5,916 5/5/2022
1.0.0 418 5/5/2022