How to get element references of Virtualize component's children?

441 Views Asked by At

I use Virtualize component like this:

<Virtualize Items="Items" Context="row">
   <Row Data="row" @key="row" />
</Virtualize>

How do I get references to current <Row> components?

I need to explicitly call refresh on them.

1

There are 1 best solutions below

0
On

I suppose you could do something like this:

<Virtualize Items="Items" Context="row">
    <Row Data="row" @key="row" @ref="references[row.id]" />
</Virtualize>

@code {

    IDictionary<string, ElementReference> references = new Dictionary<string, ElementReference>()
    {
        { "<first row id>", new ElementReference() },
        { "<second row id>", new ElementReference() },
        { "<third row id>", new ElementReference() },
        
        ...      
    };

}