blazor-client-side

Blazor - razor page not updating after property from DI Service is changed

风格不统一 提交于 2020-01-30 07:49:07
问题 Using dotnet 3.1.100-preview2-014569 Ok consider the following example: Create a new Blazor WebAssemply project from template, then add the following: books.razor @page "/books" @inject BookService bookService @if (bookService.isLoaned) { <p><em>Book loaned</em></p> } else { <p><em>Book returned</em></p> } BookService.cs public class BookService { public int BookId { get; set; } public string Title { get; set; } public bool isLoaned { get; set; } } Startup.cs public void ConfigureServices

Blazor - razor page not updating after property from DI Service is changed

隐身守侯 提交于 2020-01-30 07:49:06
问题 Using dotnet 3.1.100-preview2-014569 Ok consider the following example: Create a new Blazor WebAssemply project from template, then add the following: books.razor @page "/books" @inject BookService bookService @if (bookService.isLoaned) { <p><em>Book loaned</em></p> } else { <p><em>Book returned</em></p> } BookService.cs public class BookService { public int BookId { get; set; } public string Title { get; set; } public bool isLoaned { get; set; } } Startup.cs public void ConfigureServices

Blazor Grid Bound Column by Field Name

核能气质少年 提交于 2020-01-24 18:23:06
问题 I'm studying some paid grid components and they have a pretty cool "Bound Column" technique: <TelerikGrid Data=@GridData> <GridColumns> <GridColumn Field="TemperatureC" Title="Temp. C" /> <GridColumn Field="Summary" /> </GridColumns> <GridToolBar> <GridCommandButton Command="Add" Icon="add">Add Forecast</GridCommandButton> </GridToolBar> </TelerikGrid> <DxDataGrid Data="@DataSource"> <DxDataGridColumn Field="@nameof(ProductFlat.Id)"> </DxDataGridColumn> <DxDataGridColumn Field="@nameof

Port React app to Blazor app with JavaScript library imported using JavaScript interop

╄→гoц情女王★ 提交于 2020-01-16 09:01:13
问题 I currently have a React app that I'm trying to convert to a Blazor WebAssembly app. The React app has a component that imports a JavaScript library, the sample code for which can be seen here. The imported charting_library code itself isn't accessible without access being granted, but that shouldn't be an issue for answering this question. In my React app, as per the sample code, I have the following code (stripped for brevity): import { widget } from '../../charting_library/charting_library

Upload progress using HttpClient in Blazor Wasm

扶醉桌前 提交于 2020-01-06 08:16:51
问题 I'm trying to get file upload progress inside a blazor web assembly app. var handler = new ProgressMessageHandler(); handler.InnerHandler = new WebAssemblyHttpMessageHandler(); handler.HttpSendProgress += (object sender, HttpProgressEventArgs e) => { Console.WriteLine("bytes transfered= " + e.BytesTransferred.ToString()); Console.WriteLine("total bytes= " + e.TotalBytes.ToString()); Console.WriteLine("progress percentage= " + e.ProgressPercentage.ToString()); }; var http = new HttpClient

Child Blazor app on Blazor Server side app

前提是你 提交于 2019-12-24 16:07:58
问题 Adding a Client side Blazor app to a Server Side Blazor app Hi Following on to the helpful answer here Blazor sub app 404 error after upgrade to Preview 6 I have run into a situation where it would be helpful to be able to add a Client side Blazor app to a Blazor server side app I have created the Blazor Server app, attached a client app the the server app, and adjusted the server startup.cs to map the child app. I have also confirmed the client apps index.html base value is correct app

Share Data Through Service in ASP.NET Blazor (Client Side)

南笙酒味 提交于 2019-12-11 11:01:54
问题 I use to have a common service in MVC Application , register it as Transient service and access its value across whole application without any issue . I tried to implement same mechanism inside my client side blazor app First created a class AppState public class AppState { public string BaseUrl { get; set; } } registered as a service services.AddSingleton<AppState, AppState>(); Used in Blazor Component Index Component public class IndexComponent : ComponentBase { [Inject] HttpClient Http {

@RenderSection Equivalent in Blazor?

一笑奈何 提交于 2019-12-11 07:34:36
问题 Razor pages have a mechanism where you can reference named sections in your layout, and then specify them in your pages that use that layout. For example, if your Layout (_Layout.cshtml) looks like this: @using... ... <!DOCTYPE html> ... <body> ... @RenderSection("modals", required: false) ... and then in your dashboard page, for example, you'd have: <div> ... </div> ... ... @section modals { <div class="modal-container>...</div> <div class="modal-container>...</div> } that would inject the