[Gtk-sharp-list] TreeViews

Dominik Zabłotny dominz at wp.pl
Tue Jun 14 20:54:45 EDT 2005

On wto, 2005-06-14 at 19:51 +0100, Milen Dzhumerov wrote:
> Hi all,
> I've been thinking of starting converting this tutorial
> http://scentric.net/tutorial/treeview-tutorial.html to C# since it's
> quite useful. However, I have a question on embedding an image in a
> treeview using Gtk.CellRendererPixbuf. The thing is that there's no way
> to use a Gtk.Image for the Pixbuf. I want to use Gtk.Image because of
> the Stock items available. Is there a way to convert from a Gtk.Image to
> Gdk.Pixbuf so I can use it to assign it as a property of
> Gtk.CellRenderedPixbuf ? Any advice is greatly appreciated.

You can put StockId directly to renderer as string like this:

col.AddAttribute (rendererpb, "stock-id", (int)Row.StockId);
col.AddAttribute (rendererpb, "stock-size",

If you want to mix stock and non-stock images, you can 
use "RenderIcon" method of any widget to make pixbuf, ex:

Pixbuf pb = window.RenderIcon(Stock.Add, IconSize.Menu, null);

Dominik Zabłotny

More information about the Gtk-sharp-list mailing list