首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >更新TreeList ItemSource

更新TreeList ItemSource
EN

Stack Overflow用户
提问于 2015-09-07 03:28:00
回答 1查看 48关注 0票数 0

我正在尝试更新一个Devexpress TreeListItemSource。它似乎在我第一次按下按钮时就能工作了,但是它不再起作用了……还有什么东西我必须更新才能改变ItemSource

代码语言:javascript
复制
window.randButton.Click += delegate
            {
                string st = window.nList.CurrentCellValue.ToString();
                System.Diagnostics.Debug.WriteLine("Called: "+st);

                try {
                    window.treeList.ItemsSource = null;
                    window.treeList.ItemsSource = drawOrderBook(currCycle, st);
                    // currCylce is static data
                    // drawOrderBook computes what to display based on the filer st
                }
                catch(Exception er) { System.Diagnostics.Debug.WriteLine(er.ToString());  }


            };
EN

回答 1

Stack Overflow用户

发布于 2015-09-07 04:07:18

我对DevExpress网格也有类似的问题。

根据他们的指导方针/技术支持,当数据排序被修改/更改时,您必须调用RefreshDataSource方法。

所以你的代码应该是这样的。

代码语言:javascript
复制
window.randButton.Click += delegate
{
    string st = window.nList.CurrentCellValue.ToString();
    System.Diagnostics.Debug.WriteLine("Called: "+st);

    try 
    {
        window.treeList.ItemsSource = null;
        window.treeList.ItemsSource = drawOrderBook(currCycle, st);
        window.treeList.RefreshDataSource();
        // currCylce is static data
        // drawOrderBook computes what to display based on the filer st
    }
    catch(Exception er) { System.Diagnostics.Debug.WriteLine(er.ToString());  }

};
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32430675

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档