[Gtk-sharp-list] Word wrapping in a Gtk# TreeView

Baltasar García Perez-Schofield baltasarq at gmail.com
Wed Jan 11 12:36:12 UTC 2017


Hi, Andrey,

Thank you, I was able to make it work using your example.
The problem I'm facing now is that my window is resizable, so I've added an
event handler to the treeview's onexpose, with this code:

==
private void OnTreeViewResized()
{
    foreach (Gtk.TreeViewColumn column in this.tvTable.Columns) {
        ( (Gtk.CellRendererText) column.CellRenderers[ 0 ] ).WrapWidth =
column.Width;
    }
}
==
...and it (almost) works. The problem is that, when I make the window
larger, the text adapts to the new width correctly, but the height that was
needed before in order to accomodate the text in each row is still
used/wasted as blank space.
This is weird... how could I solve that?

-- Baltasar


El mié., 11 ene. 2017 a las 12:49, Andrey Gankov via Gtk-sharp-list (<
gtk-sharp-list at lists.dot.net>) escribió:

> Yes, This is possible.
> Try set max width for warp, WrapWidth or MaxWidth or both.
>
> The following code 100% works
> ActivityCell.WrapMode = Pango.WrapMode.WordChar;
> ActivityCell.WrapWidth = 500;
> ActivityColumn.MaxWidth = 500;
>
>
>
> --
> View this message in context:
> http://mono.1490590.n4.nabble.com/Word-wrapping-in-a-Gtk-TreeView-tp4669628p4669631.html
> Sent from the Mono - Gtk# mailing list archive at Nabble.com.
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.dot.net
> http://lists.dot.net/mailman/listinfo/gtk-sharp-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dot.net/pipermail/gtk-sharp-list/attachments/20170111/5d4b9049/attachment.html>


More information about the Gtk-sharp-list mailing list