[Mono-list] [ASK] NodeStore filter
mdedirudianto at gmail.com
Fri Jul 10 22:26:33 EDT 2009
Dear Mono masters,
I am newbie gtk# programmer, migrating from winform.
Is there any way to filter the content of NodeView instead using
Since I'm using TreeNode to make it easier to hook.
Here is the code sample:
class Employee : TreeNode
public string Name;
public string Address;
public Employee (string name, string address)
Name = name;
Address = address;
It's very easy to hook to the NodeView
Gtk.NodeView view = new Gtk.NodeView ();
view.NodeStore = PopulateStore (); // generate list of employee
But, if I'm using TreeModelFilter, I should use TreeStore instead of TreeNode.
TreeStore ts = new TreeStore (typeof (Employee));
// add something to treestore...
Gtk.TreeModelFilter filter = new Gtk.TreeModelFilter (ts, null);
view.Model = filter;
And it was cumbersome to set SetCellDataFunc on each cell to show the value,
since there are a lot of fields will be used.
nameColumn.SetCellDataFunc (nameCell, new Gtk.TreeCellDataFunc (RenderName));
addressColumn.SetCellDataFunc (addressCell, new Gtk.TreeCellDataFunc
// and others
Is there any way to use TreeModelFilter with custom TreeNode?
Or I missed something. CMIIW. Thank you very much.
More information about the Mono-list