[Gtk-sharp-list] GTk# dynamic treeview population

Michael Hutchinson m.j.hutchinson at gmail.com
Mon Aug 9 22:15:49 EDT 2010

On Mon, Aug 9, 2010 at 7:58 PM, Rampage <atomikramp at email.it> wrote:
> Hello everyone, i have a question about populating treeviews.
> i was following this tutorial:
> http://www.mono-project.com/GtkSharp_TreeView_Tutorial
> and there is a part of the article that explains how to populate a tree.
> The problem is that as it's explained in that tutorial, it looks like i have
> to define the tree structure immediatelly before rendering it.
> i was wondering: is there a way to populate the tree dynamically?
> what i mean is:
> try to expand a node
> an event is triggered and a method is called
> the method returns me a list of eventually available children
> if the returned value is not null, append the values to the parent
> else if the returned value is null: that node doesn't have children

Yes, there is an event on the TreeView:

In an eventhandler for that event, you can inspect the treestore and
add any rows needed.

Michael Hutchinson

More information about the Gtk-sharp-list mailing list