Skip to content

Commit b040de8

Browse files
Refactor
1 parent fab9d0c commit b040de8

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/Blazor.AdminLte.Site.Shared/Pages/Forms/General.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
}
2020
@for (int i = 0; i < Checkboxes.Count; i++)
2121
{
22-
<CustomCheckbox @bind-State="Checkboxes[i]" /> <text>Checked: @Checkboxes[i].IsChecked;</text>
22+
<CustomCheckbox @bind-Value="Checkboxes[i]" /> <text>Checked: @Checkboxes[i].IsChecked;</text>
2323
}
2424
</FormGroup>
2525
</Body>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@namespace Blazor.AdminLte
22
<div class="custom-control custom-checkbox">
3-
<input class="custom-control-input" type="checkbox" id="@State.Identifier" value="@State.Value" disabled="@State.IsDisabled" checked="@State.IsChecked" @onchange="DoChange">
4-
<label for="@State.Identifier" class="custom-control-label">@((MarkupString)State.Label)</label>
3+
<input class="custom-control-input" type="checkbox" id="@Value.Identifier" value="@Value.Value" disabled="@Value.IsDisabled" checked="@Value.IsChecked" @onchange="DoChange">
4+
<label for="@Value.Identifier" class="custom-control-label">@((MarkupString)Value.Label)</label>
55
</div>
66

src/Blazor.AdminLte/Forms/CustomCheckbox.razor.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ namespace Blazor.AdminLte
55
public partial class CustomCheckbox
66
{
77
[Parameter]
8-
public CustomCheckboxState State { get; set; }
8+
public CustomCheckboxState Value { get; set; }
99

1010
[Parameter]
11-
public EventCallback<CustomCheckboxState> StateChanged { get; set; }
11+
public EventCallback<CustomCheckboxState>ValueChanged { get; set; }
1212

1313
[Parameter]
1414
public EventCallback<CustomCheckboxState> OnChange { get; set; }
1515

1616
private void DoChange(ChangeEventArgs e)
1717
{
18-
State.IsChecked = (bool?)e.Value;
19-
StateChanged.InvokeAsync(State);
18+
Value.IsChecked = (bool?)e.Value;
19+
ValueChanged.InvokeAsync(Value);
2020
if (OnChange.HasDelegate)
21-
OnChange.InvokeAsync(State);
21+
OnChange.InvokeAsync(Value);
2222
}
2323
}
2424
}

0 commit comments

Comments
 (0)