I'm using a state container to basically one-way bind the data to the state container (see https://www.youtube.com/watch?v=KlPaM0yWWbQ). I cannot use to CascadingParameter because the code would trigger unnecessary UI updates, so State Container serves my purposes perfectly. Generally, the blazor code w/ the Grid is:
<TelerikGrid Data="@Elements" Sortable="true" FilterMode="Telerik.Blazor.GridFilterMode.FilterRow">
<GridColumns>
<GridColumn Field="@(nameof(ClaimObject.Text))" Title="Text" />
</GridColumns>
</TelerikGrid>
@code {
protected override void OnInitialized()
{
AppState.StateChanged += OnClaimStateChange;
}
public List<ClaimObject> Elements => AppState.GetElements();
void OnClaimStateChange(object sender, EventArgs e) => StateHasChanged();
}
When the first ClaimObject is added, the grid refreshes. However, adding any subsequent ClaimObjects does not update the UI.
Conversely, the following code updates every time:
foreach (var element in Elements)
{
<div>@element.Text</div>
}
Both Grid and TreeView are updating working this way. Any suggestions to get the grid to refresh when the State Container updates the data?