Skip to content

Instantly share code, notes, and snippets.

ctrl-alt-d / index.razor
Created Mar 2, 2021
Blazor server sending 500 upates per second
View index.razor
@page "/"
Tics per second: <input type="range" min="1" max="500" @bind="@CurrentValue" class="slider" id="myRange"> @CurrentValue
<div style="width:500px; height:10px; background-color: blue; position: relative;">
<div class="ball" style="@position_txt"></div>
<span>Number of renders: @nRenders.ToString("N0")</span>
ctrl-alt-d / MyGrid.razor
Created Mar 29, 2020
Cache for data grid component
View MyGrid.razor
public IEnumerable<object> DataSource {set; get; }
private IEnumerable<object> Cache {set; get; } = null;
List<MyColumn> Columns = new List<MyColumn>();
public void AddColumn(MyColumn column)
var seg = DataSource;
Cache ??= DataSource.ToList();
DataSource = Cache;