Search code examples
c#monogtk#gtktreeview

Gtk# TreeView set a single cell to have a different renderer?


OK this is probably insane, but I want to be able to have a check box at the very top of every row in my tree view. This box will "disable" or "enable" the ability to use the column. Oh I think it should be mentioned that I'm using a ListStore and am using C#, mono, GTK#. However, ill take anything and try to figure it out.

I'll even accept a way to make two views where the columns line up.

So, possible? or just insane?


Solution

  • I know it's an old post, but the answer might help someone else.

    It's possible and quite simple to be honest. You have to add your custom widget (for instance a Gtk.ToggleButton or your own implementation of a checkbox) to the Gtk.TreeViewColumn.Widget property.

    Job done! :)

    You might find also quite useful a Gtk.TreeViewColumn.Clicked event to subscribe to.

    Hope it helps.