// create a new treeview column with a text renderer and set the title TreeViewColumn column = new TreeViewColumn(); column.Title = "Name"; // create a cell renderer that displays text CellRendererText textRenderer = new CellRendererText(); // add the text renderer to the column and add the column to the treeview column.PackStart(textRenderer, true); treeview.AppendColumn(column); // set the data to be displayed in the text renderer column.AddAttribute(textRenderer, "text", 0);
// create a new treeview column with an image renderer and set the title TreeViewColumn column = new TreeViewColumn(); column.Title = "Thumbnail"; // create a cell renderer that displays an image CellRendererPixbuf imageRenderer = new CellRendererPixbuf(); // add the image renderer to the column and add the column to the treeview column.PackStart(imageRenderer, true); treeview.AppendColumn(column); // set the data to be displayed in the image renderer column.AddAttribute(imageRenderer, "pixbuf", 1);This code creates a new Gtk TreeViewColumn with an image renderer that displays data from the second column of the data model. The column is added to the Gtk TreeView widget. Package library: The Gtk TreeViewColumn widget is part of the Gtk# (GtkSharp) library, which is a .NET language binding for the Gtk+ graphical user interface toolkit.