RadGridView没有使用ItemsSource更新的项目在TabItem中更改

问题描述 投票:0回答:1

我在tabItem中有一个Grid没有在Windows_Load / Constructor中聚焦,如果我提供ItemsSource属性,Items属性继续为0,直到我转到tabItem。我猜它的渲染有问题。

这是代码:

IList<ProdutosProxy> lstProxy = ProdutosProxy.RetornarDadosProdutos(lstProdutos);
    this.grdProdutosEservicos.ItemsSource = lstProxy;
    this.grdProdutosEservicos.Items.Refresh();

ItemsSource获取1项,但Items继续为0,直到我关注tabItem。已经尝试过Rebind()和UpdateLayout()。

有人知道这件事吗?谢谢

radgridview tabitem itemssource
1个回答
0
投票

我解决了这个问题..只是强制从标签/网格上更新Window_Loaded并返回到原始标签。

    private void AtualizarGrid(String gridHeader)
    {
        for (var tabIndex = tabControl1.Items.Count - 1; tabIndex >= 0; tabIndex--)
        {
            if ((tabControl1.Items[tabIndex] as TabItem).Header.ToString() == gridHeader)
            {
                tabControl1.SelectedIndex = tabIndex;
                tabControl1.UpdateLayout();
            }
        }
    }
© www.soinside.com 2019 - 2024. All rights reserved.