【问题标题】:How to get element references of Virtualize component's children?如何获取 Virtualize 组件子项的元素引用?
【发布时间】:2021-02-17 02:44:09
【问题描述】:

我像这样使用 Virtualize 组件:

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

如何获取对当前&lt;Row&gt; 组件的引用?

我需要对它们显式调用刷新。

【问题讨论】:

    标签: c# blazor ui-virtualization


    【解决方案1】:

    我想你可以这样做:

    <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() },
            
            ...      
        };
    
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-05-25
      • 2019-07-17
      • 2017-05-07
      • 2019-12-04
      • 2023-03-10
      • 1970-01-01
      • 2019-12-17
      • 1970-01-01
      相关资源
      最近更新 更多