mirror of
https://github.com/PacktPublishing/Learn-WinUI-3-Second-Edition.git
synced 2026-06-20 12:23:09 +00:00
Add chapter 12 blazor project
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
@page "/tasks"
|
||||
<h3>Tasks - (@taskList.Count(task => !task.IsComplete)) incomplete</h3>
|
||||
<ul>
|
||||
@foreach (var task in taskList)
|
||||
{
|
||||
<li>
|
||||
<input type="checkbox" @bind="task.IsComplete" />
|
||||
<input @bind="task.Name" />
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
<input placeholder="Enter new task..." @bind="newTask" />
|
||||
<button @onclick="AddTask">Add task</button>
|
||||
@code {
|
||||
private IList<TaskItem> taskList = new List<TaskItem>();
|
||||
private string? newTask;
|
||||
private void AddTask()
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(newTask))
|
||||
{
|
||||
taskList.Add(new TaskItem { Name = newTask });
|
||||
newTask = string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user