From 67acd6fe4bc464e0b2aa6663d4b74c99fa12bc1b Mon Sep 17 00:00:00 2001 From: SamProf Date: Sat, 13 Jun 2020 17:05:33 +0200 Subject: [PATCH] Check PR: Add public change handler to checkbox #576 --- .../Properties/launchSettings.json | 2 +- src/MatBlazor.Demo/Pages/DemoTestPage.razor | 67 ++++++++++--------- 2 files changed, 36 insertions(+), 33 deletions(-) diff --git a/src/MatBlazor.Demo.ServerApp/Properties/launchSettings.json b/src/MatBlazor.Demo.ServerApp/Properties/launchSettings.json index 915ee15b..4d4b2452 100644 --- a/src/MatBlazor.Demo.ServerApp/Properties/launchSettings.json +++ b/src/MatBlazor.Demo.ServerApp/Properties/launchSettings.json @@ -11,7 +11,7 @@ "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, - "launchUrl": "Autocomplete", + "launchUrl": "Test", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/src/MatBlazor.Demo/Pages/DemoTestPage.razor b/src/MatBlazor.Demo/Pages/DemoTestPage.razor index 1a48e7d1..af2b7ff7 100644 --- a/src/MatBlazor.Demo/Pages/DemoTestPage.razor +++ b/src/MatBlazor.Demo/Pages/DemoTestPage.razor @@ -4,42 +4,45 @@ @inject IJSRuntime JsRuntime; @inject DemoUserService service; +Source + + @foreach (var item in items) + { + + + + } + -

Selected Tab: @service.ActiveTabIndex

+Result +@foreach (var item in items) +{ +
@item.Name - @item.IsSelected
+} - - - First Content - - - Second Content - - - - Third - - - Third Content - - +@code +{ + void OnItemSelected(ItemClass item, bool value) + { + item.IsSelected = value; + // here you can dot something + } + - + ItemClass[] items = Enumerable.Range(1, 10) + .Select(i => new ItemClass($"Item {i}", i % 2 == 0)) + .ToArray(); + class ItemClass + { + public string Name { get; set; } + public bool IsSelected { get; set; } -@code -{ - // int activeTab = 0; - // - // int ActiveTab - // { - // get - // { - // return activeTab; - // } - // set - // { - // activeTab = value; - // } - // } + public ItemClass(string name, bool isSelected) + { + Name = name; + IsSelected = isSelected; + } + } } \ No newline at end of file