我通过下一个方法在我的项目中填充树视图:
Gtk.ListStore treeview1ListStore = new Gtk.ListStore (typeof (String), typeof (String));
protected void FillTreeView(TreeView MyTreeView, Gtk.ListStore TreeViewListStore, String[] Column1, String[] Column2)
{
for(Int32 i=0;i!=Column1.Length;i++)
{
TreeViewListStore.AppendValues(Column1[i],Column2[i]);
}
MyTreeView.Model=TreeViewListStore
}
我通过以下方式调用此方法:
String[] column1 = new String[]{"column1_1","column1_2","column1_3"};
String[] column2 = new String[]{"column2_1","column2_2","column2_3"};
this.FillTreeView(this.treeview1, treeview1ListStore, column1,column2);
现在我想更改一些树视图值,但是当我使用时:
foreach(Gtk.Object currentNode in treeviewListStore)
{
}
我的程序崩溃了。如何更改 ListStore 的值?