c# - How to update ArrayList to match user-ordered TreeView -
i have gtk treeview
displaying list of items in arraylist
. treeview
set reorderable, user can drag , drop items in list re-order them.
my question is, how update original arraylist
match new treeview
ordering once reordering has taken place?
i have managed come solution - code below prints out items in list; can see how doing can find correct index items , reorder them in associated arraylist.
treeiter iter; yournodeview.model.getiterfirst (out iter); (int = 0; < yournodeview.model.iternchildren(); i++) { string result = ((typeoflistitem)sequencernodeview.model.getvalue (iter, 0)).tostring(); //here add typeoflistitem instance new arraylist, , after loop swap out old arraylist new one. console.writeline("print item "+result); yournodeview.model.iternext(ref iter); }
the typeoflistitem of course time. have written class called mylistitem has parameters such title , description, can access them with:
string result = ((mylistitem)sequencernodeview.model.getvalue (iter, 0)).title;
Comments
Post a Comment