Updating TreeList ItemSource
本文关键字:ItemSource TreeList Updating | 更新日期: 2023-09-27 18:11:32
我正在尝试更新Devexpress TreeList
's ItemSource
。当我第一次按下按钮时,它似乎可以工作,但随后它就不再工作了……是否有其他东西我必须更新以改变ItemSource
.
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()); }
};
我在DevExpress
Grid中有类似的问题。
根据他们的指导方针/技术支持,当数据源被修改/更改时,您必须调用RefreshDataSource
方法。
你的代码应该是这样的
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()); }
};