Closed
Description
Hi there,
I have a user component with multiple properties which I want to bind to.
<User bind-Name="@UserName" bind-IsActive="@UserIsActive" />
- In
User
, if I define *Changed delegate properties for bothName
andIsActive
:
<input type="text" bind="@Name" />
<input type="checkbox" bind="@IsActive" />
@functions
{
public string Name { get; set; }
public Action<string> NameChanged { get; set; }
public bool IsActive { get; set; }
public Action<bool> IsActiveChanged { get; set; }
}
Build fails with:
D:\Development\.NuGet\microsoft.aspnetcore.blazor.build\0.2.0\targets\RazorCompilation.targets(281,5): error : rzc generate exited with code 1. [D:\Development\Maraf\Money\src\Money.UI.Blazor\Money.UI.Blazor.csproj]
- When I originally defined only a single Changed property, generated code looked like:
builder.OpenComponent<Money.UI.Blazor.Components.User>(14);
builder.AddAttribute(15, "Name", Microsoft.AspNetCore.Blazor.Components.BindMethods.GetValue(UserName));
builder.AddAttribute(16, "NameChanged", new System.Action<System.String>(__value => UserName = __value));
builder.AddAttribute(17, "Name", Microsoft.AspNetCore.Blazor.Components.BindMethods.GetValue(UserIsActive));
builder.AddAttribute(18, "NameChanged", new System.Action<System.String>(__value => UserIsActive = __value));
builder.CloseComponent();
Which tried to bind both expressions to property Name
and failed build with:
obj\Debug\netstandard2.0\Pages\Summary.g.cs(61,112): error CS0029: Cannot implicitly convert type 'string' to 'bool' [D:\Development\Maraf\Money\src\Money.UI.Blazor\Money.UI.Blazor.csproj]