aspnetcore/test/testapps/BasicTestApp/CounterComponent.cshtml

20 lines
462 B
Plaintext

@using Microsoft.AspNetCore.Blazor
<h1>Counter</h1>
<p>Current count: @currentCount</p>
<p><button onclick="@((handleClicks ? (Action<UIMouseEventArgs>)IncrementCount : null))">Click me</button></p>
<label>
<input type="checkbox" bind="@handleClicks" />
Toggle click handler registration
</label>
@functions {
int currentCount = 0;
bool handleClicks = true;
void IncrementCount(UIMouseEventArgs e)
{
currentCount++;
}
}