Is it possible to do the following using the new Blazor framework?
I have a page that displayed a list of people. The list is essentially a bindable list of Person objects.
Desired Result I would like to show each person fade-in independently of each other.
For example: The 1st row starts fading in first. The Nth row person will be the last to fade in.
What I tried I've tried a couple of things using Task.Delay() and tried to get Dispatcher.BeginInvoke() to work.
But now i am starting to think this is not possible without doing some kind of hack.
Is this kind of effect even possible via Blazor? Is there a Dispatcher.BeginInvoke() equivalent?
One option, if your
Blazorapplication is run on client-side, is to use a combination ofCSS3 animationsto fade in rows and aTask.Delayto add rows delayed.I will give you an example based on the default
Blazor(.NET core 3.0 preview 3) template.Inspired by this SO answer you could add the following
CSS classto your site.css or some costomCSSfile:Now we will modify the FetchData.razor page, which by default shows a
HTMLtable with some forecast info.First we add a style class to the table rows
<tr>as following:Next we will change the type of the
forecastsfrom anarrayto aList:As a last step we replace the
forecastspreparation in theOnInitAsyncwith the following call:and add the method for the delayed fading in:
And this should be your result:
Based on this demo, you should now be able to apply this method to your
Personmodel and individual razor page(s). Ofcourse the animation, delay and other things are just an example and can be customized.