Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

How binding and rendering observable properties in blazor?

$
0
0

I Investigate Blazor and attempting binding observable property to Sf Progress Bar. Property looks like following and created in backend lib.

    public long Counter    {        get => _counterSubject.Value;        set => _counterSubject.OnNext(value);    }    public IObservable<long> CounterState => _counterSubject;

This property changes when method load data.

In service that injected to blazor page this property init another not observable property.

public long Counter { get; set; } = 0;//some codepublic async Task<long> GetAsync(OemCatalogRequest request){    Counter = _someService.Counter;}

The part of the Blazor page with property binding to progress bar looks like:

<SfProgressBar Value="@FetchService.Counter" IsActive="@_loadingFlag" Minimum="0" Maximum="@FetchService.TotalCount" TrackThickness="12" ProgressThickness="12"><ProgressBarAnimation Enable="@_loadingFlag"></ProgressBarAnimation></SfProgressBar><h2>Tonal count: @FetchService.TotalCount</h2><h2>Counter: @FetchService.Counter</h2>

On Debug i see that @FetchService.Counter chaneged but not rendering on blazor page. And progress bar changing when data loading completed.I new in Blazor. What i doing wring?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>