using Gtk; // Create a new TreeStore with two columns TreeStore store = new TreeStore(typeof(string), typeof(int)); // Add some data to the TreeStore store.AppendValues("Apple", 3); store.AppendValues("Banana", 2); store.AppendValues("Orange", 4);
using Gtk; // Get the TreeStore from a Gtk.TreeView TreeStore store = (TreeStore)treeView.Model; // Get the selected row from the TreeView TreeIter iter; treeView.Selection.GetSelected(out iter); // Get the data from the selected row string name = (string)store.GetValue(iter, 0); int count = (int)store.GetValue(iter, 1);
using Gtk; // Get the TreeStore from a Gtk.TreeView TreeStore store = (TreeStore)treeView.Model; // Get the selected row from the TreeView TreeIter iter; treeView.Selection.GetSelected(out iter); // Update the data in the selected row store.SetValue(iter, 1, 5);The Gtk# library is a wrapper around the GTK+ GUI toolkit. It can be installed on Debian-based systems using the libgtk2.0-cil package, or on Red Hat-based systems using the gtk-sharp2 package.