[Gtk-sharp-list] how to create zebra stripes in treeview

Brad Taylor brad at getcoded.net
Thu Jun 4 14:22:20 EDT 2009


On Thu, 2009-06-04 at 19:40 +0200, Miroslav Biňas wrote:
> hello
> 
> i am new to gtk#, so maybe my question is something obvious, but - not
> yet for me. so...
> 
> my problem is to create stripes in TreeView with ListStore model. i was
> trying to search for example, going through some source codes, but
> without any success. the best result, what i was able to do, was the
> creeation of method for rendering the row for the specific column with
> the SetCellDataFunc() method. problem is, when i sort the rows in the
> store by clicking on the header, it stops working - sorry - it still
> works, but there can be several rows of the same color grouped together
> based on the sort criteria.

Check out TreeView.RulesHint.

http://go-mono.org/docs/monodoc.ashx?link=P%3aGtk.TreeView.RulesHint

Simply:

myTreeView.RulesHint = true;

should do the trick.  If you're on Windows however, you may need to hack
your theme to make them display (as they don't by default).  If this is
the case, let me know and I can tell you how you can get them to show.

Best,

-Brad



More information about the Gtk-sharp-list mailing list